/*
 * ============================================================
 * Echo Stock — Global Design System (default_layout.css)
 * Single Source of Truth for all UI components
 * ============================================================
 */

/* ─────────────────── Design Tokens ─────────────────── */
:root {
    /* Light theme */
    --bg-body:          #F9FAFB;
    --bg-card:          #FFFFFF;
    --text-main:        #111827;
    --text-dim:         #6B7280;
    --deep-slate:       #0F172A;
    --deep-slate-navy:  #1E293B;
    --border:           #F3F4F6;
    --border-light:     #F1F5F9;
    --soft-shadow:      0 10px 40px -10px rgba(15, 23, 42, 0.08);
    --primary-gradient: linear-gradient(to bottom, #1E293B, #0F172A);
}

/* ─────────────────── Base ─────────────────── */
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Admin dark page */
body.admin-page {
    background-color: #0F172A;
    color: #E2E8F0;
}

/* Error full-page center */
body.error-page {
    margin: 0;
    padding: 0;
    background-color: #131314;
    color: #e3e3e3;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
    font-family: 'Pretendard', -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ─────────────────── Scrollbar ─────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #3f3f46; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background-color: #52525b; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* Date picker — neutral */
::-webkit-calendar-picker-indicator { opacity: 0.4; cursor: pointer; }
::-webkit-calendar-picker-indicator:hover { opacity: 0.7; }

/* ─────────────────── Cards ─────────────────── */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    border-radius: 16px;
}

/* Dashboard metric card — always centered, fixed height */
.card-metric {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 140px;
    padding: 20px;
    cursor: default;
}

/* Clickable metric card variant */
.card-metric--interactive {
    cursor: pointer;
    transition: box-shadow 0.2s, outline 0.2s;
    position: relative;
}
.card-metric--interactive:hover {
    outline: 2px solid #fde68a; /* amber-200 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Admin dark card */
.admin-page .card,
.card-admin {
    background: #1E293B;
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
}
.card-highlight {
    background: linear-gradient(135deg, #1E3A5F 0%, #1E293B 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Pricing PRO card */
.card-pro {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    border-color: transparent;
    box-shadow: 0 20px 60px -10px rgba(15, 23, 42, 0.4);
}

/* ─────────────────── Buttons ─────────────────── */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    font-weight: 500;
    letter-spacing: -0.02em;
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.2), 0 10px 15px -5px rgba(15, 23, 42, 0.1);
}
.btn-primary:disabled {
    background: #94A3B8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    border: 1px solid #E5E7EB;
    color: #4B5563;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.btn-secondary:hover {
    background-color: #F9FAFB;
    border-color: #D1D5DB;
}

/* Google/OAuth login button (identical gradient) */
.btn-google {
    background: var(--primary-gradient);
    color: white;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-google:hover {
    transform: translateY(-3px);
    background: linear-gradient(to bottom, #334155, #0F172A);
    box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.25), 0 10px 15px -5px rgba(15, 23, 42, 0.15);
}

/* Blue action button (for modal rename) */
.btn-blue {
    background: linear-gradient(to bottom, #3B4EBF, #2D3DA8);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-blue:hover { transform: translateY(-1px); }

/* Danger button (dark theme) */
.btn-danger-dark {
    background: #7F1D1D;
    color: #FCA5A5;
    border-radius: 10px;
    font-weight: 700;
    transition: all 0.2s;
}

/* Ghost button (semi-transparent, dark modal) */
.btn-ghost-dark {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-ghost-dark:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }

/* Error page home button */
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    background-color: #a8c7fa;
    color: #062e6f;
    text-decoration: none;
    border-radius: 100px;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn-home:hover { background-color: #d3e3fd; transform: scale(1.02); box-shadow: 0 4px 12px rgba(168, 199, 250, 0.3); }
.btn-home:active { transform: scale(0.98); }

/* ─────────────────── Inputs ─────────────────── */
.input-search {
    background-color: #F3F4F6;
    border: 1px solid transparent;
    border-radius: 10px;
    transition: all 0.2s ease;
}
.input-search:focus {
    background-color: white;
    border-color: var(--deep-slate);
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.1);
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-main);
    background: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus { border-color: #1E293B; box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08); }
.input-field:disabled { background: #F9FAFB; color: #9CA3AF; cursor: not-allowed; }

.input-elegant {
    background-color: #F9FAFB;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.input-elegant:focus { border-color: var(--deep-slate); background-color: white; outline: none; box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.1); }

/* Semi-transparent input for dark modals */
.input-glass {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 10px;
    outline: none;
}
.input-glass::placeholder { color: rgba(148, 163, 184, 0.8); }
.input-glass:focus { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5); }

/* ─────────────────── Status Pills ─────────────────── */
.status-pill { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.status-ok    { background: #ECFDF5; color: #059669; }
.status-low   { background: #FFFBEB; color: #D97706; }
.status-empty { background: #FEF2F2; color: #DC2626; }

/* ─────────────────── Tier Pills ─────────────────── */
.tier-pill  { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.tier-FREE  { background: rgba(100,116,139,0.2); color: #94A3B8; }
.tier-BASIC { background: rgba(16,185,129,0.15); color: #34D399; }
.tier-PRO   { background: rgba(59,130,246,0.15);  color: #60A5FA; }
.tier-MAX   { background: rgba(139,92,246,0.15);  color: #A78BFA; }
.tier-ADMIN { background: rgba(245,158,11,0.15);  color: #FCD34D; border: 1px solid rgba(245,158,11,0.3); }

/* ─────────────────── Admin Table ─────────────────── */
.admin-page table { border-collapse: separate; border-spacing: 0; }
.admin-page th    { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #64748B; }
.admin-page tr:hover td { background: rgba(148, 163, 184, 0.04); }
.admin-page td    { font-size: 13px; border-bottom: 1px solid rgba(148, 163, 184, 0.06); }

/* Admin stat */
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; }

/* ─────────────────── Modals ─────────────────── */
.modal-overlay-dark { background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(6px); }
.modal-overlay-soft { background: rgba(0, 0, 0, 0.60); backdrop-filter: blur(6px); }
.modal-surface-dark {
    background: linear-gradient(135deg, #0F172A 0%, #1A2744 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

/* ─────────────────── Chart ─────────────────── */
.chart-container { position: relative; width: 100%; height: 100px; }
.chart-canvas    { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* ─────────────────── Animations ─────────────────── */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%  { transform: translateX(-4px); }
    75%  { transform: translateX(4px); }
}
.animate-shake { animation: shake 0.2s ease-in-out 0s 2; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.fade-in-up.visible { opacity: 1; transform: translateY(0); }

/* ─────────────────── Login Page ─────────────────── */
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    box-shadow: var(--soft-shadow);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.feature-card:hover { transform: translateY(-5px); box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.12); }
.icon-box { background: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 100%); color: var(--deep-slate-navy); }
#legalModal { backdrop-filter: blur(8px); }

/* ─────────────────── Settings Page ─────────────────── */
.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #6B7280;
    transition: all 0.15s;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.nav-tab:hover, .nav-tab.active { background: #F3F4F6; color: #111827; }

.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9CA3AF;
    margin-bottom: 10px;
}

/* ─────────────────── Pricing Page ─────────────────── */
.check { color: #22C55E; }
.dash  { color: #D1D5DB; }

/* ─────────────────── Error Page ─────────────────── */
.error-container {
    max-width: 480px;
    width: 90%;
    text-align: center;
    padding: 40px;
    background: #1e1f20;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.error-page .error-icon { font-size: 64px; color: #f2b8b5; margin-bottom: 24px; }
.error-page h1 { font-size: 24px; font-weight: 500; margin: 0 0 16px 0; color: #e3e3e3; }
.error-page p  { font-size: 16px; line-height: 1.6; color: #c4c7c5; margin-bottom: 32px; }
.error-code    { margin-top: 40px; font-size: 13px; color: #5f6368; font-family: monospace; }

/* ─────────────────── Hover Safety ─────────────────── */
/* Apply to any container that must NEVER flash background on hover */
.bg-static { pointer-events: none; }
.bg-static * { pointer-events: auto; }
