/* ============================================================
   PriceWise — Design System
   ============================================================ */
:root {
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --brand-soft: #eef2ff;
    --brand-soft-2: #f5f3ff;
    --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e5e9f2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 6px 24px rgba(15, 23, 42, .07);
    --shadow-lg: 0 16px 48px rgba(79, 70, 229, .18);
    --radius: 1rem;
    --radius-sm: .65rem;
    --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: .9375rem;
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.01em; }

a { text-decoration: none; }

::selection { background: rgba(79, 70, 229, .18); }

/* ------------------------------------------------------------
   Scrollbar
------------------------------------------------------------ */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------
   Sidebar
------------------------------------------------------------ */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform .25s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.25rem 1.35rem;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--gradient);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.25rem;
    box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
    flex: 0 0 auto;
}

.brand-name { font-weight: 800; font-size: 1.15rem; line-height: 1.15; }
.brand-tag { font-size: .7rem; color: var(--muted); font-weight: 500; }

.side-nav { padding: 1rem .8rem; overflow-y: auto; flex: 1; }

.nav-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #94a3b8;
    padding: .9rem .9rem .4rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .9rem;
    border-radius: .75rem;
    color: #475569;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .2rem;
    transition: background .15s, color .15s, transform .15s;
    position: relative;
}

.nav-link i { font-size: 1.05rem; width: 22px; text-align: center; }

.nav-link:hover { background: var(--brand-soft); color: var(--brand); }

.nav-link.active {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 6px 18px rgba(99, 102, 241, .35);
}

.nav-link.active i { color: #fff; }

.sidebar-foot {
    padding: 1rem 1.35rem;
    border-top: 1px solid var(--border);
    font-size: .78rem;
    color: var(--muted);
}

.sidebar-foot .user-email { display: block; font-weight: 600; color: var(--text); }

/* ------------------------------------------------------------
   Layout
------------------------------------------------------------ */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar .page-title { font-size: 1.05rem; font-weight: 700; margin: 0; }

.topbar .page-sub { font-size: .78rem; color: var(--muted); }

.topbar-spacer { flex: 1; }

.menu-btn { display: none; }

.page {
    flex: 1;
    padding: 1.75rem 1.5rem 3rem;
    max-width: 1220px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-header h1 { font-size: 1.5rem; margin: 0; }

.page-header .lead { color: var(--muted); font-size: .92rem; margin-top: .2rem; }

/* ------------------------------------------------------------
   Cards & stats
------------------------------------------------------------ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-body { padding: 1.35rem; }

.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }

.stat-card { transition: transform .18s ease, box-shadow .18s ease; position: relative; overflow: hidden; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid; place-items: center;
    font-size: 1.25rem;
    color: #fff;
    flex: 0 0 auto;
}

.stat-value { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 600; }

.stat-trend { font-size: .75rem; font-weight: 700; }

.g-icon-indigo  { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.g-icon-violet  { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.g-icon-green   { background: linear-gradient(135deg, #10b981, #34d399); }
.g-icon-amber   { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.g-icon-rose    { background: linear-gradient(135deg, #ef4444, #f87171); }
.g-icon-sky     { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }

/* ------------------------------------------------------------
   Buttons
------------------------------------------------------------ */
.btn { font-weight: 600; border-radius: .7rem; padding: .55rem 1.15rem; font-size: .9rem; transition: all .15s ease; }

.btn-primary {
    background: var(--gradient);
    border: none;
    box-shadow: 0 6px 18px rgba(99, 102, 241, .3);
}
.btn-primary:hover, .btn-primary:focus { background: var(--gradient); filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(99, 102, 241, .38); }

.btn-outline-primary { color: var(--brand); border-color: #c7d2fe; background: #fff; }
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

.btn-light { background: #f1f5f9; border-color: transparent; color: #334155; }
.btn-light:hover { background: #e2e8f0; color: #0f172a; }

.btn-ghost { background: transparent; border: none; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }

.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; border-radius: .85rem; }

.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: .6rem; }

/* ------------------------------------------------------------
   Forms
------------------------------------------------------------ */
.form-label { font-weight: 600; font-size: .8rem; margin-bottom: .35rem; color: #334155; }

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: .7rem;
    padding: .6rem .85rem;
    font-size: .925rem;
    transition: border-color .15s, box-shadow .15s;
    background-color: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .14);
}

.input-group-text {
    background: #f8fafc;
    border: 1.5px solid var(--border);
    color: #475569;
    font-weight: 600;
    border-radius: .7rem 0 0 .7rem;
}

.input-group .form-control { border-radius: 0 .7rem .7rem 0 !important; }

.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

.form-switch .form-check-input { width: 2.4em; }

.input-hint { font-size: .73rem; color: var(--muted); margin-top: .25rem; }

/* ------------------------------------------------------------
   Advanced section accordion / collapsible
------------------------------------------------------------ */
.collapse-card {
    border: 1.5px dashed #c7d2fe;
    border-radius: var(--radius);
    background: #fbfaff;
}

.collapse-card > .collapse-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: .9rem 1.1rem;
    background: none; border: none; font-weight: 700; color: var(--brand);
    border-radius: var(--radius); text-align: left;
}

.collapse-card .chev { transition: transform .2s; }
.collapse-card:has(.collapse.show) .chev { transform: rotate(180deg); }

/* ------------------------------------------------------------
   Hero / result banner
------------------------------------------------------------ */
.hero-result {
    background: var(--gradient);
    color: #fff;
    border-radius: 1.25rem;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero-result::before {
    content: "";
    position: absolute;
    width: 340px; height: 340px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .09);
    top: -140px; right: -100px;
}

.hero-result::after {
    content: "";
    position: absolute;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .07);
    bottom: -110px; left: 40%;
}

.hero-result .price {
    font-size: clamp(2.6rem, 7vw, 4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1;
}

.hero-chip {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(255,255,255,.16);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 99px;
    padding: .3rem .8rem;
    font-size: .78rem;
    font-weight: 600;
}

.price-option {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.1rem;
    text-align: center;
    transition: transform .18s, box-shadow .18s, border-color .18s;
    cursor: pointer;
}

.price-option:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.price-option.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }

.price-option .po-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.price-option .po-value { font-size: 1.35rem; font-weight: 800; color: var(--text); }
.price-option .po-sub { font-size: .72rem; color: var(--muted); margin-top: .15rem; }

/* ------------------------------------------------------------
   Gauge (health score)
------------------------------------------------------------ */
.gauge-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto; }

.gauge {
    width: 150px; height: 150px;
    border-radius: 50%;
    background: conic-gradient(var(--gauge-color, #10b981) calc(var(--score) * 1%), #eef2f7 0);
    display: grid; place-items: center;
    -webkit-mask: radial-gradient(farthest-side, transparent 62%, #000 63%);
    mask: radial-gradient(farthest-side, transparent 62%, #000 63%);
}

.gauge-inner { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge-inner .score { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.gauge-inner .of { font-size: .7rem; color: var(--muted); }

/* ------------------------------------------------------------
   Tables
------------------------------------------------------------ */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .8rem .9rem; vertical-align: middle; }
.table thead th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    border-bottom: 1.5px solid var(--border) !important;
    background: #fafbfd;
}

.table tbody td { border-color: #eef1f6; }

.table-hover tbody tr:hover { background: #f8faff; }

/* ------------------------------------------------------------
   Breakdown bars
------------------------------------------------------------ */
.breakdown-row { display: flex; align-items: center; gap: .9rem; padding: .55rem 0; }
.breakdown-label { width: 180px; flex: 0 0 auto; font-size: .82rem; color: #475569; font-weight: 600; }
.breakdown-track { flex: 1; height: 9px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.breakdown-fill { height: 100%; border-radius: 99px; background: var(--gradient); width: 0; transition: width .6s ease; }
.breakdown-value { width: 120px; text-align: right; font-weight: 700; font-size: .85rem; flex: 0 0 auto; }

@media (max-width: 575.98px) {
    .breakdown-label { width: 120px; }
    .breakdown-value { width: 90px; font-size: .78rem; }
}

/* ------------------------------------------------------------
   Alerts / warnings
------------------------------------------------------------ */
.alert { border-radius: .8rem; border: none; font-size: .875rem; }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.alert-danger  { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-info    { background: #f0f9ff; color: #075985; border-left: 4px solid var(--info); }
.alert-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }

.warning-item {
    display: flex; gap: .8rem; align-items: flex-start;
    padding: .85rem 1rem;
    border-radius: .8rem;
    background: #fff;
    border: 1px solid var(--border);
    margin-bottom: .6rem;
}
.warning-item .w-icon { font-size: 1.1rem; margin-top: .15rem; flex: 0 0 auto; }

/* ------------------------------------------------------------
   Toast / flash
------------------------------------------------------------ */
.flash-stack { position: fixed; top: 1rem; right: 1rem; z-index: 2000; display: flex; flex-direction: column; gap: .6rem; max-width: min(360px, calc(100vw - 2rem)); }

.flash {
    background: #fff;
    border-radius: .85rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--info);
    padding: .9rem 1.1rem;
    font-size: .875rem;
    animation: slideIn .25s ease;
    display: flex; gap: .6rem; align-items: flex-start;
}

.flash.success { border-left-color: var(--success); }
.flash.danger  { border-left-color: var(--danger); }
.flash.warning { border-left-color: var(--warning); }

.flash .f-icon { font-size: 1.05rem; }

@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------
   Empty states
------------------------------------------------------------ */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state .e-icon {
    width: 84px; height: 84px; margin: 0 auto 1.1rem;
    border-radius: 24px; background: var(--brand-soft);
    display: grid; place-items: center; font-size: 2.2rem; color: var(--brand);
}
.empty-state h3 { font-size: 1.15rem; }
.empty-state p { color: var(--muted); max-width: 380px; margin: 0 auto 1.2rem; }

/* ------------------------------------------------------------
   Slider (profit simulator)
------------------------------------------------------------ */
input[type="range"].sim-slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 8px; border-radius: 99px;
    background: linear-gradient(90deg, var(--brand) var(--fill, 50%), #e2e8f0 var(--fill, 50%));
    outline: none;
}

input[type="range"].sim-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 22px; height: 22px; border-radius: 50%;
    background: #fff; border: 3px solid var(--brand);
    box-shadow: 0 2px 8px rgba(99,102,241,.4);
    cursor: pointer;
}

input[type="range"].sim-slider::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; border: 3px solid var(--brand); cursor: pointer;
}

/* ------------------------------------------------------------
   Simulator table special
------------------------------------------------------------ */
.sim-profit-positive { color: var(--success); font-weight: 700; }
.sim-profit-negative { color: var(--danger); font-weight: 700; }

/* ------------------------------------------------------------
   Auth pages
------------------------------------------------------------ */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.auth-side {
    flex: 1;
    background: var(--gradient);
    color: #fff;
    padding: 3rem;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.auth-side::after {
    content: "";
    position: absolute; width: 420px; height: 420px; border-radius: 50%;
    background: rgba(255,255,255,.08); top: -140px; right: -140px;
}

.auth-side .feature { display: flex; gap: .9rem; margin-bottom: 1.3rem; align-items: flex-start; }
.auth-side .feature i {
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
    border-radius: 12px; width: 42px; height: 42px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: 1.1rem;
}

.auth-main {
    flex: 1.15;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem 1.5rem;
}

.auth-box { width: 100%; max-width: 420px; }

@media (min-width: 992px) { .auth-side { display: flex; } }

/* ------------------------------------------------------------
   Responsive
------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .page { padding: 1.25rem 1rem 2.5rem; }
}

@media (max-width: 575.98px) {
    .topbar { padding: .6rem 1rem; }
    .page-header h1 { font-size: 1.25rem; }
    .card-body { padding: 1.1rem; }
    .stat-value { font-size: 1.15rem; }
    .hero-result { padding: 1.4rem; }
}

/* ------------------------------------------------------------
   Utilities
------------------------------------------------------------ */
.text-brand { color: var(--brand) !important; }
.bg-brand-soft { background: var(--brand-soft) !important; }

.divider { height: 1px; background: var(--border); margin: 1rem 0; }

.mini-table td, .mini-table th { padding: .5rem .6rem; font-size: .85rem; }

.fade-up { animation: fadeUp .4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .1s; }
.delay-3 { animation-delay: .15s; }

.hover-lift { transition: transform .18s ease, box-shadow .18s ease; }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.currency-pill {
    background: var(--brand-soft); color: var(--brand);
    border-radius: 99px; padding: .35rem .9rem;
    font-weight: 700; font-size: .8rem;
}

.list-check li { list-style: none; padding-left: 1.6rem; position: relative; margin-bottom: .55rem; }
.list-check li::before {
    content: "\F26A"; font-family: "bootstrap-icons";
    position: absolute; left: 0; color: var(--success); font-weight: 700;
}
