/* ============================================================
   NextUg — Admin Panel Styles
   ============================================================ */

:root {
    --nav: #0f172a;
    --nav2: #020617;
    --accent: #06b6d4;
    --accent2: #3b82f6;
    --link: #2563eb;
    --price: #ef4444;
    --bg: #0f172a;
    --panel: #1e293b;
    --soft: #334155;
    --border: #475569;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.24);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.3), 0 4px 6px -2px rgba(0,0,0,.2);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --panel: #1e293b;
    --soft: #334155;
    --border: #475569;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --nav: #0f172a;
    --nav2: #020617;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* Keep dropdown options readable on the dark theme */
select {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .5rem .6rem;
}
select option,
select optgroup {
    background: var(--panel);
    color: var(--text);
}
select option:hover,
select option:focus,
select option:checked {
    background: var(--accent2);
    color: #fff;
}

/* ========== APP LAYOUT ========== */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0f172a 0%, #0d1929 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .25s ease, width .25s ease;
    border-right: 1px solid rgba(148, 163, 184, .1);
    box-shadow: 2px 0 8px rgba(0,0,0,.2);
}
.sidebar.collapsed { transform: translateX(-100%); }
.brand {
    font-size: 1.25rem;
    font-weight: 800;
    padding: 1.2rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: .4rem;
    background: rgba(59, 130, 246, .05);
}
.brand span { color: #06b6d4; }
.sidebar nav { flex: 1; padding: .8rem 0; overflow-y: auto; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .9rem 1.2rem;
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 500;
    transition: all .2s;
    border-left: 3px solid transparent;
    margin: 0 .5rem;
    border-radius: 0 8px 8px 0;
    letter-spacing: .3px;
}
.sidebar nav a:hover {
    background: rgba(6, 182, 212, .1);
    color: #fff;
    border-left-color: #06b6d4;
}
.sidebar nav a.active {
    background: rgba(59, 130, 246, .15);
    color: #fff;
    border-left-color: #3b82f6;
    font-weight: 600;
}
.sidebar nav a .ico { width: 22px; text-align: center; font-size: 1.1rem; }
.sidebar nav a .lbl { flex: 1; }
.sidebar nav a.logout { color: #f87171; }
.sidebar nav a.logout:hover { background: rgba(248, 113, 113, .1); border-left-color: #f87171; }

/* Collapsible nav groups */
.sidebar nav .nav-group { display: flex; flex-direction: column; }
.sidebar nav .nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: calc(100% - 1rem);
    padding: .9rem 1.2rem;
    margin: 0 .5rem;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: .3px;
    cursor: pointer;
    text-align: left;
    transition: all .2s;
}
.sidebar nav .nav-group-toggle:hover { background: rgba(6, 182, 212, .1); color: #fff; border-left-color: #06b6d4; }
.sidebar nav .nav-group-toggle .ico { width: 22px; text-align: center; font-size: 1.1rem; }
.sidebar nav .nav-group-toggle .lbl { flex: 1; }
.sidebar nav .nav-group-toggle .caret { font-size: .75rem; opacity: .7; transition: transform .2s; }
.sidebar nav .nav-group.open .nav-group-toggle .caret { transform: rotate(180deg); }
.sidebar nav .nav-group.open .nav-group-toggle { color: #fff; }
.sidebar nav .nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height .28s ease;
}
.sidebar nav .nav-group.open .nav-group-items { max-height: 600px; }
.sidebar nav .nav-group-items a {
    font-size: .92rem;
    padding-left: 2.6rem;
}
.sidebar nav .nav-group-items a .ico { font-size: 1rem; }
.sidebar nav .nav-sep {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: .6rem 1.2rem;
}

.main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ========== TOPBAR ========== */
.topbar {
    background: linear-gradient(180deg, #1e293b 0%, #1a1f2e 100%);
    border-bottom: 1px solid rgba(148, 163, 184, .1);
    padding: .8rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.icon-btn {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, .2);
    background: rgba(59, 130, 246, .05);
    color: var(--text);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 1rem;
    transition: all .2s;
    position: relative;
}
.icon-btn:hover { 
    background: rgba(59, 130, 246, .15);
    border-color: rgba(148, 163, 184, .3);
}
.notify-wrap .icon-btn {
    background: rgba(239, 68, 68, .15);
    border-color: rgba(239, 68, 68, .3);
    color: #fca5a5;
}
.notify-wrap .icon-btn:hover {
    background: rgba(239, 68, 68, .25);
    border-color: rgba(239, 68, 68, .5);
}
.topbar-search {
    flex: 1;
    max-width: 420px;
    display: flex;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(59, 130, 246, .05);
    transition: all .2s;
}
.topbar-search:focus-within {
    border-color: rgba(59, 130, 246, .4);
    background: rgba(59, 130, 246, .08);
}
.topbar-search input {
    flex: 1;
    border: none;
    padding: .5rem .8rem;
    background: transparent;
    color: var(--text);
    outline: none;
}
.topbar-search input::placeholder {
    color: var(--muted);
}
.topbar-search button {
    background: transparent;
    border: none;
    padding: 0 .9rem;
    cursor: pointer;
    color: var(--muted);
    border-left: 1px solid rgba(148, 163, 184, .2);
    transition: all .2s;
}
.topbar-search button:hover {
    color: #06b6d4;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-left: auto;
}
.notify-wrap { position: relative; }
.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: .8rem;
    z-index: 200;
}
.notif-panel.open { display: block; }
.notif-panel strong { display: block; padding: .2rem .4rem .6rem; font-size: .9rem; }
.notif-item {
    display: flex;
    gap: .6rem;
    padding: .5rem .4rem;
    border-radius: 6px;
    font-size: .85rem;
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.read { opacity: .6; }
.notif-icon { font-size: 1.1rem; }
.notif-item div { flex: 1; }
.notif-item small { color: var(--muted); display: block; margin-top: .15rem; }
.notif-badge {
    position: absolute;
    top: -6px; right: -6px;
    background: var(--price);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .4rem;
    border-radius: 99px;
    min-width: 18px;
    text-align: center;
}
.topbar-user {
    font-size: .85rem;
    color: var(--muted);
    padding: 0 .4rem;
}

/* ========== MAIN CONTENT ========== */
.content { 
    padding: 1.5rem; 
    flex: 1;
    background: var(--bg);
}
.alert {
    padding: .8rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: .9rem;
    font-weight: 500;
    border-left: 4px solid;
}
.alert-error { 
    background: rgba(239, 68, 68, .15);
    color: #fca5a5;
    border-left-color: #ef4444;
}
.alert-success { 
    background: rgba(34, 197, 94, .15);
    color: #86efac;
    border-left-color: #22c55e;
}

/* ========== STATS ========== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, .15) 0%, rgba(6, 182, 212, .05) 100%);
    border: 1px solid rgba(59, 130, 246, .2);
    border-radius: 12px;
    padding: 1.2rem 1.2rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .1);
    position: relative;
    overflow: hidden;
    transition: all .3s ease;
}
.stat-card:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, .2) 0%, rgba(6, 182, 212, .1) 100%);
    border-color: rgba(59, 130, 246, .4);
    box-shadow: 0 8px 20px rgba(59, 130, 246, .15);
    transform: translateY(-2px);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: -40px;
    width: 120px; height: 120px;
    background: rgba(59, 130, 246, .1);
    border-radius: 50%;
}
.stat-num {
    font-size: 1.8rem;
    font-weight: 800;
    color: #06b6d4;
    line-height: 1.2;
    position: relative;
    z-index: 1;
}
.stat-label {
    font-size: .8rem;
    color: var(--muted);
    margin-top: .4rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.stat-card.stat-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}
.stat-card.stat-link:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, .4);
    box-shadow: 0 8px 20px rgba(59, 130, 246, .15);
}
.notif-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; margin: 0; padding: 0; }
.notif-list li { border-left: 3px solid var(--accent2); padding: .5rem .7rem; background: rgba(59, 130, 246, .06); border-radius: 0 8px 8px 0; }
.notif-msg { font-size: .9rem; }

/* ========== DASHBOARD GRID ========== */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.card {
    background: linear-gradient(135deg, #1e293b 0%, #172139 100%);
    border: 1px solid rgba(148, 163, 184, .15);
    border-radius: 12px;
    padding: 1.2rem 1.2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    transition: all .3s ease;
}
.card:hover {
    border-color: rgba(148, 163, 184, .3);
    box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: .8rem;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: .6rem;
}

/* ========== CHARTS ========== */
.chart-card { min-height: 280px; }
.chart-total { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; margin: .25rem 0 .5rem; }
.chart-total span { font-size: .8rem; color: var(--muted, #94a3b8); text-transform: uppercase; letter-spacing: .05em; }
.chart-total strong { font-size: 1.5rem; font-weight: 700; color: var(--text, #fff); }
.bars {
    display: flex;
    align-items: flex-end;
    gap: .5rem;
    height: 180px;
    padding-top: .5rem;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.bar {
    width: 100%;
    max-width: 40px;
    background: linear-gradient(180deg, #06b6d4 0%, #0891b2 100%);
    border-radius: 6px 6px 0 0;
    transition: all .3s ease;
    position: relative;
    box-shadow: 0 4px 12px rgba(6, 182, 212, .2);
}
.bar:hover {
    background: linear-gradient(180deg, #22d3ee 0%, #06b6d4 100%);
    box-shadow: 0 6px 16px rgba(6, 182, 212, .3);
}
.bar-val {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: .65rem;
    color: #06b6d4;
    white-space: nowrap;
    font-weight: 700;
}
.bar-label {
    font-size: .7rem;
    color: var(--muted);
    text-align: center;
}
.donut-wrap {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
}
.donut {
    width: 140px; height: 140px;
    border-radius: 50%;
    flex-shrink: 0;
}
.legend { list-style: none; flex: 1; min-width: 140px; }
.legend li {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
    font-size: .85rem;
}
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ========== TABLES ========== */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.table th, .table td {
    padding: .7rem .7rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, .1);
}
.table th {
    font-weight: 600;
    color: var(--muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: rgba(59, 130, 246, .05);
}
.table tbody tr:hover { 
    background: rgba(59, 130, 246, .05);
    border-left: 3px solid rgba(6, 182, 212, .3);
    padding-left: 4px;
}
.table img.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid rgba(148, 163, 184, .2); }
.table .actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: .3rem .7rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-ok { background: rgba(34, 197, 94, .15); color: #86efac; border: 1px solid rgba(34, 197, 94, .3); }
.badge-off { background: rgba(239, 68, 68, .15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.badge-info { background: rgba(59, 130, 246, .15); color: #93c5fd; border: 1px solid rgba(59, 130, 246, .3); }
.badge-warn { background: rgba(245, 158, 11, .15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .3); }

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .5rem .9rem;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    line-height: 1.3;
}
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-primary { 
    background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(59, 130, 246, .3);
}
.btn-primary:hover { 
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    box-shadow: 0 6px 16px rgba(59, 130, 246, .4);
    transform: translateY(-1px);
}
.btn-danger { 
    background: rgba(239, 68, 68, .2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, .4);
}
.btn-danger:hover { 
    background: rgba(239, 68, 68, .3);
    border-color: rgba(239, 68, 68, .6);
}
.btn-ghost {
    background: rgba(148, 163, 184, .05);
    color: var(--text);
    border-color: rgba(148, 163, 184, .2);
}
.btn-ghost:hover { 
    background: rgba(148, 163, 184, .1);
    border-color: rgba(148, 163, 184, .3);
}

/* ========== TOOLBAR ========== */
.toolbar {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filters {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}
.filters input, .filters select {
    padding: .45rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--accent2); }

/* ========== FORMS ========== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.2rem;
}
.form-main { min-width: 0; }
.form-side { min-width: 0; }
.card label {
    display: block;
    margin-bottom: .5rem;
    font-size: .85rem;
    font-weight: 600;
    color: #f1f5f9;
}
.card input[type="text"],
.card input[type="email"],
.card input[type="password"],
.card input[type="number"],
.card input[type="date"],
.card select,
.card textarea {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 8px;
    background: rgba(6, 182, 212, .05);
    color: var(--text);
    margin-top: .25rem;
    outline: none;
    transition: all .2s;
}
.card input:focus, 
.card select:focus, 
.card textarea:focus { 
    border-color: rgba(59, 130, 246, .4);
    background: rgba(59, 130, 246, .08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}
.checkbox {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .9rem;
    cursor: pointer;
}
.checkbox input { width: auto; }

/* ========== DASHBOARD PAGINATION ========== */
.dash-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: .75rem .25rem 0;
    border-top: 1px solid var(--border);
    margin-top: .75rem;
    flex-wrap: wrap;
}
.dash-pager .muted { font-size: .85rem; }
.product-form label {
    display: block;
    margin-bottom: .6rem;
    font-size: .85rem;
    font-weight: 600;
}
.product-form input[type="text"],
.product-form input[type="number"],
.product-form input[type="file"],
.product-form select,
.product-form textarea {
    width: 100%;
    padding: .5rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    margin-top: .25rem;
    outline: none;
}
.variant-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .5rem;
    align-items: end;
    padding: .6rem;
    background: var(--soft);
    border-radius: 8px;
    margin-bottom: .5rem;
}
.variant-row label { display: block; font-size: .8rem; font-weight: 600; }
.variant-row input { width: 100%; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 4px; background: var(--panel); color: var(--text); }
.img-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: .8rem;
    background: var(--soft);
    border-radius: 8px;
    margin-bottom: .6rem;
}
.img-preview img { max-height: 160px; object-fit: contain; border-radius: 6px; }
.gallery { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.gallery img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }

/* ========== LOGIN ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}
.login-card {
    background: var(--panel);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}
.login-card h1 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: .2rem;
}
.login-card h1 span { color: var(--accent2); }
.login-card p { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; }
.login-form { display: flex; flex-direction: column; gap: .8rem; }
.login-form label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: .2rem;
}
.login-form input {
    width: 100%;
    padding: .55rem .8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    outline: none;
}
.login-form input:focus { border-color: var(--accent2); }

/* ========== MISC ========== */
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.actions { white-space: nowrap; }
.section-title { font-size: 1.1rem; font-weight: 700; margin: 1rem 0 .5rem; }
.form-actions { display: flex; gap: .5rem; margin-top: .8rem; }
.vendor-form { margin-bottom: 1rem; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
    .content { padding: 1.2rem; }
}
@media (max-width: 1024px) {
    .sidebar { width: 220px; }
    .main { margin-left: 220px; }
}
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); width: 240px; }
    .sidebar.collapsed { transform: translateX(-100%); }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 0 100vmax rgba(0,0,0,.45);
        z-index: 200;
    }
    .main { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 768px) {
    .content { padding: .9rem; }
    .card { padding: 1rem; }
    .stat-card { padding: 1rem; }
    .stat-num { font-size: 1.5rem; }
    .card.chart-card { min-height: 0; }
    .bars { height: 150px; }
    .donut-wrap { justify-content: center; }
    .table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
@media (max-width: 640px) {
    .stats { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; }
    .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
    .topbar-user { display: none; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar .filters { width: 100%; }
    .table { font-size: .82rem; }
    .table th, .table td { padding: .55rem .5rem; }
}
@media (max-width: 480px) {
    .content { padding: .7rem; }
    .card { padding: .8rem; }
    .stat-num { font-size: 1.3rem; }
    .stat-label { font-size: .72rem; }
    .bar-label { font-size: .6rem; }
    .topbar { padding: .7rem .8rem; gap: .6rem; }
}

/* ============================================================
   NextUg — Courier (Delivery Rider) Panel
   ============================================================ */
.delivery-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: .5rem;
}
.delivery-card {
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 12px;
    padding: .9rem 1rem;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.delivery-card.status-picked_up { border-left-color: #f59e0b; }
.delivery-card.status-out_for_delivery { border-left-color: #3b82f6; }
.delivery-card.status-delivered { border-left-color: #22c55e; opacity: .85; }
.delivery-card.status-failed { border-left-color: #ef4444; }
.dc-top { display: flex; justify-content: space-between; align-items: center; }
.dc-no { font-weight: 700; }
.dc-customer { font-weight: 600; }
.dc-addr { font-size: .85rem; color: var(--muted); }
.dc-phone { display: inline-block; font-size: .85rem; color: var(--accent); text-decoration: none; }
.dc-total { margin-top: .2rem; font-size: .85rem; }
.dc-actions { display: flex; gap: .4rem; margin-top: .3rem; flex-wrap: wrap; }

.delivery-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .6rem;
    margin: 1rem 0;
    padding: .8rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.delivery-meta span { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; }
.delivery-addr h4, .delivery-meta h4 { margin: 0 0 .3rem; font-size: .95rem; }
.delivery-addr p { margin: .1rem 0; }
.delivery-note-form, .delivery-set-form, .profile-form {
    display: flex; flex-direction: column; gap: .6rem; margin-top: .5rem;
}
.delivery-note-form textarea, .profile-form textarea,
.profile-form input, .profile-form select { width: 100%; }
.delivery-set-form { flex-direction: row; align-items: center; gap: .5rem; }
.table-responsive { width: 100%; overflow-x: auto; }
.profile-form { max-width: 420px; }
.profile-form h4 { margin-top: .4rem; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---- Courier: status colours for the expanded flow ---- */
.delivery-card.status-assigned   { border-left-color: #8b5cf6; }
.delivery-card.status-accepted   { border-left-color: #22c55e; }
.delivery-card.status-arrived    { border-left-color: #0ea5e9; }
.delivery-card.status-cust_unavailable { border-left-color: #f59e0b; }
.delivery-card.status-returned   { border-left-color: #a855f7; }
.delivery-card.status-rejected   { border-left-color: #94a3b8; opacity: .7; }
.dc-body { display: flex; flex-direction: column; gap: .25rem; }
.dc-meta { margin-top: .2rem; }

/* ---- Amazon-style tracking timeline ---- */
.amz-track { display: flex; align-items: center; padding: 1rem 0 .5rem; flex-wrap: wrap; }
.amz-step { display: flex; align-items: center; gap: .5rem; }
.amz-dot {
    width: 30px; height: 30px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--border); color: var(--muted); font-weight: 700; font-size: .85rem;
}
.amz-step.done .amz-dot { background: #22c55e; color: #fff; }
.amz-step.current .amz-dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.18); }
.amz-step-label { font-size: .82rem; color: var(--muted); }
.amz-step.done .amz-step-label, .amz-step.current .amz-step-label { color: var(--text); font-weight: 600; }
.amz-line { flex: 1; height: 3px; min-width: 24px; background: var(--border); margin: 0 .5rem; }
.amz-line.done { background: #22c55e; }

/* ---- Two-column address block ---- */
.delivery-addr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .8rem; }
.delivery-addr { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; }

/* ---- Communication row on delivery page ---- */
.comm-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--border); }

/* ---- Availability toggle ---- */
.availability-toggle { display: flex; align-items: center; gap: .5rem; }
.availability-toggle select { padding: .35rem .5rem; }

/* ---- Proof of delivery ---- */
.proof-form { display: flex; flex-direction: column; gap: .7rem; max-width: 420px; }
.proof-form input[type=file] { font-size: .85rem; }
.proof-thumb { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--border); margin: .3rem 0; display: block; }
.proof-summary { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---- Wallet ---- */
.wallet-balance { font-size: 2rem; font-weight: 800; color: var(--primary); }

/* ---- Chat / Messages ---- */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; align-items: start; }
.chat-list { display: flex; flex-direction: column; gap: .4rem; }
.chat-item {
    display: flex; flex-direction: column; gap: .1rem;
    padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px;
    text-decoration: none; color: var(--text); background: var(--panel);
}
.chat-item.active { border-color: var(--primary); background: rgba(37,99,235,.08); }
.chat-panel { display: flex; flex-direction: column; min-height: 420px; }
.chat-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding: 1rem 0; max-height: 460px; }
.bubble { max-width: 75%; padding: .55rem .8rem; border-radius: 12px; font-size: .9rem; }
.bubble.mine { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 2px; }
.bubble.theirs { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 2px; }
.bubble-meta { font-size: .68rem; opacity: .75; margin-bottom: .15rem; }
.chat-compose { display: flex; gap: .5rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.chat-compose input { flex: 1; }

@media (max-width: 720px) {
    .chat-layout { grid-template-columns: 1fr; }
    .delivery-addr-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Customer Management — Dark Dashboard Theme
   ============================================================ */
.cust-page { display: flex; flex-direction: column; gap: 24px; }
.cust-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cust-header h1 { font-size: 1.5rem; font-weight: 700; color: #fff; margin: 0; }
.cust-header p { margin: 4px 0 0; font-size: 0.875rem; color: #6b7280; }
.cust-btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 8px; border: none; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all .2s; box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.cust-btn-primary:hover { box-shadow: 0 6px 16px rgba(37,99,235,.4); transform: translateY(-1px); }

.cust-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cust-stat-card { background: #151728; border: 1px solid rgba(255,255,255,.05); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 16px; transition: all .2s; }
.cust-stat-card:hover { border-color: rgba(255,255,255,.1); }
.cust-stat-icon { width: 40px; height: 40px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.cust-stat-icon.green { background: rgba(34,197,94,.15); color: #22c55e; }
.cust-stat-icon.blue { background: rgba(59,130,246,.15); color: #3b82f6; }
.cust-stat-icon.amber { background: rgba(245,158,11,.15); color: #f59e0b; }
.cust-stat-icon.purple { background: rgba(139,92,246,.15); color: #8b5cf6; }
.cust-stat-info { display: flex; flex-direction: column; gap: 2px; }
.cust-stat-label { font-size: 0.875rem; color: #6b7280; font-weight: 500; }
.cust-stat-value { font-size: 1.25rem; font-weight: 700; color: #fff; }

.cust-table-card { background: #151728; border: 1px solid rgba(255,255,255,.05); border-radius: 12px; overflow: hidden; }
.cust-table-header { padding: 16px; border-bottom: 1px solid rgba(255,255,255,.05); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cust-table-header h3 { margin: 0; font-size: 0.875rem; font-weight: 600; color: #fff; }
.cust-search { position: relative; max-width: 28rem; width: 100%; }
.cust-search input { width: 100%; padding: 8px 12px 8px 36px; border-radius: 8px; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.05); color: #d1d5db; font-size: 0.875rem; outline: none; }
.cust-search input:focus { border-color: rgba(59,130,246,.4); background: rgba(59,130,246,.08); }
.cust-search input::placeholder { color: #6b7280; }
.cust-search::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 0.8rem; opacity: .6; pointer-events: none; }

.cust-table { width: 100%; border-collapse: collapse; }
.cust-table thead tr { background: rgba(255,255,255,.02); }
.cust-table th { padding: 12px 24px; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #4b5563; }
.cust-table td { padding: 16px 24px; border-bottom: 1px solid rgba(255,255,255,.05); font-size: 0.875rem; color: #d1d5db; vertical-align: middle; }
.cust-table tbody tr:last-child td { border-bottom: none; }
.cust-table tbody tr:hover { background: rgba(255,255,255,.02); }

.cust-user { display: flex; align-items: center; gap: 12px; }
.cust-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #8b5cf6); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.875rem; flex-shrink: 0; }
.cust-user-info { display: flex; flex-direction: column; gap: 2px; }
.cust-name { font-weight: 500; color: #fff; }
.cust-email { font-size: 0.8rem; color: #6b7280; }

.cust-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; color: #9ca3af; }
.cust-meta .ico { font-size: 0.8rem; opacity: .7; }

.cust-pill { display: inline-flex; padding: 4px 10px; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.cust-pill-active { background: rgba(34,197,94,.15); color: #22c55e; }
.cust-pill-inactive { background: rgba(107,114,128,.15); color: #6b7280; }

.cust-actions { display: flex; gap: 8px; align-items: center; }
.cust-icon-btn { width: 32px; height: 32px; border-radius: 6px; border: none; background: transparent; color: #6b7280; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .2s; }
.cust-icon-btn:hover { background: rgba(255,255,255,.05); color: #fff; }
.cust-icon-btn.edit:hover { background: rgba(34,197,94,.1); color: #22c55e; }
.cust-icon-btn.delete:hover { background: rgba(239,68,68,.1); color: #ef4444; }

.cust-delete-confirm { display: inline-flex; gap: 8px; align-items: center; }
.cust-delete-confirm button { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 500; cursor: pointer; border: none; }
.cust-btn-confirm-yes { background: #ef4444; color: #fff; }
.cust-btn-confirm-yes:hover { background: #dc2626; }
.cust-btn-confirm-no { background: rgba(255,255,255,.1); color: #9ca3af; }
.cust-btn-confirm-no:hover { background: rgba(255,255,255,.15); color: #fff; }

.cust-empty { padding: 32px 24px; text-align: center; color: #6b7280; }

/* Modal */
.cust-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 50; display: none; align-items: center; justify-content: center; padding: 1rem; }
.cust-modal-overlay.open { display: flex; }
.cust-modal { background: #151728; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; width: 100%; max-width: 32rem; box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04); display: flex; flex-direction: column; max-height: 90vh; }
.cust-modal-header { padding: 24px; border-bottom: 1px solid rgba(255,255,255,.05); display: flex; justify-content: space-between; align-items: center; }
.cust-modal-header h2 { margin: 0; font-size: 1.125rem; font-weight: 600; color: #fff; }
.cust-modal-close { background: none; border: none; color: #6b7280; cursor: pointer; font-size: 1.25rem; line-height: 1; }
.cust-modal-close:hover { color: #fff; }
.cust-modal-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.cust-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cust-form-group { display: flex; flex-direction: column; gap: 6px; }
.cust-form-group label { font-size: 0.875rem; font-weight: 500; color: #9ca3af; }
.cust-form-group input, .cust-form-group select { padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); color: #d1d5db; outline: none; font-size: 0.875rem; width: 100%; }
.cust-form-group input:focus, .cust-form-group select:focus { border-color: rgba(59,130,246,.5); background: rgba(59,130,246,.08); }
.cust-modal-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.05); display: flex; justify-content: flex-end; gap: 12px; }
.cust-btn-cancel { padding: 8px 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); color: #9ca3af; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.cust-btn-cancel:hover { background: rgba(255,255,255,.1); color: #fff; }
.cust-btn-submit { padding: 8px 16px; border-radius: 8px; border: none; background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.cust-btn-submit:hover { opacity: .9; }
.cust-btn-submit:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 768px) {
    .cust-stat-grid { grid-template-columns: 1fr; }
    .cust-form-row { grid-template-columns: 1fr; }
    .cust-table-header { flex-direction: column; align-items: stretch; }
    .cust-table th, .cust-table td { padding: 10px 14px; }
}

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 50; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-card { position: relative; background: #151728; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; width: 100%; max-width: 32rem; box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04); display: flex; flex-direction: column; max-height: 90vh; }
.modal-card h2 { margin: 0; font-size: 1.125rem; font-weight: 600; color: #fff; padding: 24px 24px 0; }
.modal-close { position: absolute; right: 1rem; top: 1rem; background: none; border: none; color: #6b7280; cursor: pointer; font-size: 1.25rem; line-height: 1; }
.modal-close:hover { color: #fff; }
#riderForm { padding: 1.25rem 24px 24px; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
#riderForm label { display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; font-weight: 500; color: #9ca3af; }
#riderForm input, #riderForm select { padding: .55rem .7rem; border-radius: 8px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.05); color: #d1d5db; outline: none; font-size: .9rem; width: 100%; }
#riderForm input:focus, #riderForm select:focus { border-color: rgba(59,130,246,.5); background: rgba(59,130,246,.08); }
#riderForm .btn { align-self: flex-end; }
.muted small { font-size: .8rem; color: #6b7280; font-weight: 400; }

/* Product image lightbox */
.pdp-lightbox { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60; align-items: center; justify-content: center; padding: 1.5rem; cursor: pointer; }
.pdp-lightbox.open { display: flex; }
.pdp-lightbox img { max-width: 90vw; max-height: 88vh; object-fit: contain; border-radius: 8px; cursor: default; }
.pdp-lightbox-close { position: absolute; top: 1rem; right: 1.5rem; background: rgba(255,255,255,.15); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.pdp-lightbox-close:hover { background: rgba(255,255,255,.3); }
.image-zoom { position: relative; cursor: zoom-in; overflow: hidden; }
.image-zoom img { transition: transform .15s ease; transform-origin: var(--zoom-x, 50%) var(--zoom-y, 50%); }
.image-zoom:hover img { transform: scale(2.5); }

