/* ============================================
   Notice 提醒助手 - 样式
   ============================================ */

:root {
    --primary: #1890ff;
    --primary-dark: #096dd9;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    --bg: #f0f2f5;
    --card-bg: #fff;
    --text: #262626;
    --text-secondary: #8c8c8c;
    --border: #e8e8e8;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 12px rgba(0,0,0,0.06);
    --sidebar-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ============ Loading ============ */
.app-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    color: var(--text-secondary);
}
.loading-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Auth ============ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.auth-container {
    display: flex;
    width: 900px;
    max-width: 95vw;
    min-height: 550px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.auth-left {
    width: 45%;
    background: linear-gradient(135deg, var(--primary) 0%, #096dd9 100%);
    color: #fff;
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-brand { margin-bottom: 40px; }
.brand-icon { font-size: 48px; margin-bottom: 12px; }
.auth-brand h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.brand-desc { font-size: 14px; opacity: 0.85; line-height: 1.6; }
.feature-item { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 14px; }
.feature-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: rgba(255,255,255,0.2); border-radius: 50%; font-size: 12px; font-weight: 700; }
.auth-right {
    width: 55%;
    padding: 48px 36px;
    display: flex;
    align-items: center;
}
.auth-form { width: 100%; max-width: 360px; margin: 0 auto; }
.auth-form h2 { font-size: 24px; margin-bottom: 6px; }
.form-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: #555; }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(24,144,255,0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; }
.input-with-btn .btn { white-space: nowrap; min-width: 100px; }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; }
.form-hint { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 16px; }
.auth-links a { color: var(--primary); font-size: 13px; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    gap: 6px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline { background: transparent; border-color: rgba(255,255,255,0.3); color: rgba(255,255,255,0.8); }
.btn-outline:hover { border-color: #fff; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 18px; padding: 4px 8px; border-radius: 4px; transition: background 0.2s; }
.btn-icon:hover { background: var(--bg); }
.btn-icon-danger:hover { background: #fff1f0; }
.help-link { color: var(--primary); font-size: 12px; }

/* ============ Layout ============ */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #001529;
    color: rgba(255,255,255,0.85);
    display: flex;
    flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: transform 0.3s;
}
.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.brand-icon-sm { font-size: 28px; }
.brand-text { color: #fff; }
.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,0.6); font-size: 20px; cursor: pointer; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px; font-size: 14px;
    cursor: pointer; transition: all 0.2s;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; border-radius: 0 8px 8px 0; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.user-info-sidebar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-avatar-sm {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 600;
    color: #fff; flex-shrink: 0;
}
.user-name { font-size: 13px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 99; }

/* Main */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}
.topbar {
    display: flex;
    align-items: center;
    padding: 16px 28px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; margin-right: 12px; }
.page-title { font-size: 18px; font-weight: 600; flex: 1; }
.topbar-right { color: var(--text-secondary); font-size: 14px; }
.current-time { font-variant-numeric: tabular-nums; }

.content-body { padding: 24px 28px; flex: 1; }

.stat-card {
    display: none;
}
/* ============ Stats Grid ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    display: block;
    background: #fff;
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--stat-color, var(--primary));
}
.stat-value { font-size: 32px; font-weight: 700; color: var(--stat-color, var(--primary)); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* ============ Cards ============ */
.section-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 0;
    margin-bottom: 24px;
}
.section-header { padding: 0 20px 16px; border-bottom: 1px solid var(--border); }
.section-header h3 { font-size: 16px; font-weight: 600; }

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    background: #fff;
    min-width: 120px;
}
.filter-group select:focus,
.filter-group input:focus { border-color: var(--primary); }

/* ============ Reminder List ============ */
.reminder-list { padding: 0; }
.reminder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}
.reminder-item:last-child { border-bottom: none; }
.reminder-item:hover { background: #fafafa; }

.reminder-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.reminder-status-dot.status-0 { background: var(--warning); }
.reminder-status-dot.status-1 { background: var(--success); }
.reminder-status-dot.status-2 { background: var(--text-secondary); }

.reminder-time-tag {
    min-width: 120px;
    font-size: 12px;
    color: var(--primary);
    background: #e6f7ff;
    padding: 4px 10px;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}
.reminder-info { flex: 1; min-width: 0; }
.reminder-title { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.reminder-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.reminder-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ============ Badges ============ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
}
.badge-once { background: #e6f7ff; color: var(--primary); }
.badge-daily { background: #f6ffed; color: var(--success); }
.badge-weekly { background: #fffbe6; color: var(--warning); }
.badge-monthly { background: #f9f0ff; color: #722ed1; }
.badge-yearly { background: #fff0f6; color: #eb2f96; }
.badge-cron { background: #f5f5f5; color: #595959; }
.badge-method { background: #f0f5ff; color: var(--primary); }

/* ============ Type Selector ============ */
.type-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.type-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.type-btn:hover { border-color: var(--primary); color: var(--primary); }
.type-btn.active { border-color: var(--primary); background: #e6f7ff; color: var(--primary); font-weight: 500; }

.week-selector { display: flex; gap: 6px; }
.day-btn {
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.day-btn:hover { border-color: var(--primary); }
.day-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.method-selector { display: flex; flex-wrap: wrap; gap: 12px; }
.method-check {
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; font-size: 14px;
    padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.method-check:hover { border-color: var(--primary); }
.method-check input { margin: 0; }
.method-check small { color: var(--text-secondary); font-size: 12px; }

/* ============ Form ============ */
.form-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.form-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group.half { flex: 1; }
.required { color: var(--danger); }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.profile-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #096dd9);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 600; color: #fff;
    flex-shrink: 0;
}

/* ============ Table ============ */
.table-wrap {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    padding: 12px 16px;
    text-align: left;
    background: #fafafa;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: #fafafa; }

.status-tag {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
}
.status-tag.status-success { background: #f6ffed; color: var(--success); }
.status-tag.status-failed { background: #fff1f0; color: var(--danger); }
.status-tag.status-pending { background: #fffbe6; color: var(--warning); }

.text-muted { color: var(--text-secondary); }
.text-error { color: var(--danger); }
.t-truncate { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ Empty ============ */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { margin-bottom: 16px; }
.loading-more { text-align: center; padding: 20px; color: var(--text-secondary); }

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.sidebar-open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay { display: block; }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .content-body { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .auth-container { flex-direction: column; border-radius: 0; min-height: auto; }
    .auth-left { width: 100%; padding: 32px 24px; }
    .auth-right { width: 100%; padding: 32px 24px; }
    .form-row { flex-direction: column; }
    .form-row .form-group.half { width: 100%; }
    .section-toolbar { flex-direction: column; align-items: stretch; }
    .type-selector { gap: 6px; }
    .type-btn { padding: 6px 10px; font-size: 12px; }
    .reminder-time-tag { min-width: 90px; font-size: 11px; }
    .reminder-actions { flex-direction: column; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 24px; }
}

/* ============ Tablets ============ */
@media (min-width: 769px) and (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ===== API Data Source styles for user ===== */
.api-source-selector {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}
.api-source-info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.api-source-info-box h4 { margin: 0; font-size: 14px; }
.api-source-info-box p { margin: 0; font-size: 12px; color: var(--text2); }
.api-param-input { font-size: 13px; }
.api-preview-result {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  border-radius: 6px;
  padding: 12px;
  margin: 8px 0;
}
.api-preview-var { 
  padding: 4px 0; font-size: 13px;
}
.api-preview-var strong { color: var(--success); }
.css-hint {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
}
.css-hint code {
  background: #fff7e6;
  padding: 1px 4px;
  border-radius: 3px;
}
