@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --bg: #08090b;
    --panel: #11131a;
    --panel-2: #181b23;
    --text: #f3f4f6;
    --muted: #8e95a5;
    --accent: #f5f5f5;
    --border: #1f222c;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    --glow: 0 16px 50px rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
}
body {
    background: radial-gradient(80% 80% at 50% 18%, rgba(255, 255, 255, 0.03), transparent 55%), var(--bg);
    color: var(--text);
    font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    align-items: stretch;
}

a { color: inherit; text-decoration: none; }

.topbar {
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    height: 68px;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(11,11,13,0.92);
    backdrop-filter: blur(8px);
}

.topbar-left {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.admin-brand {
    display: none;
}

.admin-brand .admin-logo {
    height: 64px;
    width: auto;
    display: block;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    padding: 26px 18px 20px;
    background: linear-gradient(180deg, #0f1118 0%, #0b0d13 68%);
    border-right: 1px solid var(--border);
    box-shadow: 16px 0 50px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 12;
}

.sidebar-logo {
    padding: 4px 8px 14px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-img {
    height: 68px;
    width: auto;
    display: block;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.1px;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar-nav a.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    border-color: var(--border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.sidebar-footer {
    padding-top: 12px;
}

.desktop-storefront {
    width: 100%;
}

.topbar-storefront {
    display: none !important;
}

.admin-nav {
    display: none;
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #0f1118 0%, #0b0d13 80%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
    padding: 16px 0 14px;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.admin-nav.nav--open {
    display: flex;
}

.admin-nav a {
    color: var(--muted);
    padding: 12px 18px;
    position: relative;
    width: calc(100% - 36px);
    text-align: left;
    border-radius: 10px;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav a.active {
    color: var(--text);
    background: rgba(255,255,255,0.05);
}

.admin-actions {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.admin-hamburger {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
}

.admin-hamburger .hamburger-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.avatar-button {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #ffffff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0b0b0d;
    font-weight: 700;
    border: 1px solid var(--border);
    cursor: pointer;
}

.profile-menu {
    position: absolute;
    top: 48px;
    right: 0;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
    display: none;
    min-width: 220px;
}

.profile-menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 600;
}

.profile-menu a:hover {
    background: var(--panel);
}

.profile-menu.show {
    display: block;
}

.profile-menu .divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.profile-menu .muted {
    font-size: 13px;
}

.sidebar { display: none; }

.main {
    padding: 110px 32px 40px;
    margin-left: 260px;
    width: calc(100% - 260px);
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    flex: 1 1 auto;
    scrollbar-width: none;
}

.main::-webkit-scrollbar { display: none; }

.auth-shell {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(80% 80% at 50% 20%, rgba(255, 255, 255, 0.04), transparent 50%), var(--bg);
    padding: 32px 16px;
    overflow: auto;
}

.main-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
    min-width: 0;
    padding-top: 12px;
}

h1 {
    font-size: 34px;
    margin: 6px 0 8px;
    letter-spacing: -0.5px;
}

h2 {
    margin: 4px 0 0;
    font-size: 32px;
    letter-spacing: -0.35px;
}

h3 {
    margin: 0 0 12px;
    font-size: 20px;
    letter-spacing: -0.2px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.card {
    background: linear-gradient(180deg, var(--panel-2), #11131a 80%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 60%);
    pointer-events: none;
}

.muted { color: var(--muted); margin: 0; }

input, select, textarea {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 16px;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: #1f222c;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 12px 30px rgba(0, 0, 0, 0.35);
}

input[type="checkbox"] {
    width: auto;
    height: 18px;
    padding: 0;
    border-radius: 4px;
    accent-color: var(--accent);
    box-shadow: none;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; letter-spacing: 0.2px; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
    text-transform: capitalize;
}

.status--pending { background: rgba(255, 255, 255, 0.04); color: #f3f4f6; border-color: #2b2f3a; }
.status--processing { background: rgba(255, 193, 7, 0.15); color: #ffd666; border-color: rgba(255, 193, 7, 0.45); }
.status--shipped, .status--completed { background: rgba(86, 153, 255, 0.15); color: #bcd7ff; border-color: rgba(86, 153, 255, 0.45); }
.status--cancelled { background: rgba(255, 85, 115, 0.15); color: #ffc4d2; border-color: rgba(255, 85, 115, 0.45); }

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.icon-btn--danger {
    border-color: rgba(255, 85, 115, 0.5);
    color: #ffccd9;
}

.icon-btn--ghost {
    background: var(--panel-2);
}

.table-scroll {
    overflow-x: auto;
}

.sidebar-spacer {
    flex: 1 1 auto;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 16px;
}

.modal {
    width: 100%;
    max-width: 780px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 18px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.modal-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: var(--muted);
    cursor: pointer;
}

.modal-show {
    display: flex;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-form {
    display: grid;
    gap: 12px;
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: none; /* Firefox */
}

.auth-form::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.auth-card {
    width: 520px;
    max-width: 95vw;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-header {
    text-align: center;
    margin-bottom: 18px;
}

.auth-title {
    font-size: 18px;
    margin: 8px 0 0;
    color: var(--text);
    font-weight: 600;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-text {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0,0,0,0.15);
    border-top: 2px solid #0b0b0d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
    body { overflow: auto; }
    .admin-sidebar { display: none; }
    .admin-brand { display: block; }
    .admin-hamburger { display: inline-flex; }
    .topbar-storefront { display: inline-flex !important; }
    .desktop-storefront { display: none; }
    .topbar {
        left: 0;
        right: 0;
        height: 64px;
        padding: 10px 16px;
    }
    .admin-nav { top: 64px; }
    .main {
        margin-left: 0;
        width: 100%;
        padding: 88px 16px 24px;
        height: auto;
    }
    .main-inner {
        padding-top: 0;
        grid-template-columns: 1fr;
    }
    .grid { grid-template-columns: 1fr; }
    table { font-size: 14px; }
    th, td { padding: 10px; }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    height: 38px;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.btn-secondary {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.btn-primary { background: linear-gradient(135deg, var(--accent), #ffffff); color: #0a0b0d; box-shadow: var(--glow); border: 1px solid rgba(255,255,255,0.4); border-radius: 10px; height: 38px; padding: 0 16px; justify-content: center; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; } 
.btn-primary.loading { position: relative; pointer-events: none; opacity: 0.85; }
.btn-primary .spinner { display: none; }
.btn-primary.loading .spinner { display: inline-flex; }

@media (min-width: 901px) {
    .topbar-storefront { display: none !important; }
}

@media (max-width: 640px) {
    .card { padding: 14px; }
    table { font-size: 13px; }
    th, td { padding: 9px 8px; }
    .actions-cell { flex-wrap: wrap; gap: 8px; }
    .icon-btn { width: 100%; justify-content: center; }
    .modal {
        max-width: 96vw;
        margin: 0 auto;
        padding: 14px;
    }
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .main {
        padding: 88px 14px 24px;
    }
    .main-inner {
        gap: 14px;
    }
}
