/* OneStepWeb Theme - Dark Mode Default */
:root {
    color-scheme: dark;
    --bg: #0a0e1a;
    --panel: #12182a;
    --panel-deep: #0d1220;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1e293b;
    --chip: #0f172a;
    --accent: #3b82f6;
    --row-hover: #151d30;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #60a5fa;
    --excellent: #10b981;
    --good: #3b82f6;
    --purple: #8b5cf6;
    --gradient-1: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-2: linear-gradient(135deg, #10b981, #3b82f6);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
}

/* Light mode override */
[data-theme="light"] {
    --bg: #f8fafc;
    --panel: #ffffff;
    --panel-deep: #f1f5f9;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --chip: #f1f5f9;
    --row-hover: #f8fafc;
}

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Containers */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* Header */
.header {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.logo { height: 32px; width: auto; }
.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav pills */
.nav-pills { display: flex; gap: 4px; background: var(--chip); border-radius: 12px; padding: 4px; }
.nav-pill {
    color: var(--muted);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-pill:hover { background: var(--row-hover); color: var(--text); text-decoration: none; }
.nav-pill--active { background: var(--accent); color: #fff; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: #2563eb; }
.btn-secondary {
    background: var(--chip);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.icon-btn {
    background: var(--chip);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
}
.icon-btn:hover { background: var(--row-hover); color: var(--text); border-color: var(--accent); }

/* Cards */
.card {
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
}
.card:hover { border-color: rgba(59, 130, 246, 0.3); }
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.2s;
}
.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.stat-icon.icon-keywords { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.stat-icon.icon-health { background: rgba(16, 185, 129, 0.15); color: var(--excellent); }
.stat-icon.icon-business { background: rgba(139, 92, 246, 0.15); color: var(--purple); }
.stat-icon.icon-cooldown { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.icon-engagement { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.stat-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.stat-delta { font-size: 0.75rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.stat-delta.up { background: rgba(16, 185, 129, 0.15); color: var(--excellent); }
.stat-delta.down { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-delta.flat { background: rgba(148, 163, 184, 0.1); color: var(--muted); }

/* Health meter */
.health-meter {
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.health-meter-label {
    font-size: 0.875rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.health-meter-value {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.health-meter-track {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    overflow: hidden;
}
.health-meter-fill {
    height: 100%;
    background: var(--gradient-2);
    border-radius: 999px;
    transition: width 0.6s ease;
}

/* Health pills */
.health-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
}
.health-pill.excellent { background: rgba(16, 185, 129, 0.15); color: var(--excellent); }
.health-pill.good { background: rgba(59, 130, 246, 0.15); color: var(--good); }
.health-pill.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.health-pill.critical { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 8px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-deep);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: var(--accent);
}
.form-input::placeholder { color: var(--muted); }
.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 6px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-deep);
}
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 14px 16px;
    background: var(--chip);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
th:hover { color: var(--text); }
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--row-hover); }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 16px 20px;
    border-radius: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--info); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Auth pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}
.auth-card {
    background: var(--panel);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
}
.auth-logo {
    display: block;
    height: 48px;
    margin: 0 auto 24px;
}
.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
}
.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--muted);
    font-size: 0.875rem;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
    .main-content { padding: 16px; }
    .header { padding: 12px 16px; }
    .health-meter { flex-direction: column; gap: 16px; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-pills { display: none; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; }
}
