/* =============================================
   GP Crackers — Admin Panel Styles
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    --gold:         #FFBA00;
    --gold-warm:    #FF8F00;
    --gold-light:   #FFD54F;
    --navy:         #0C2D5E;
    --navy-dark:    #061A3A;
    --navy-mid:     #0a2040;
    --sidebar-w:    260px;
    --sidebar-collapsed-w: 80px;
    --sidebar-bg:   #07183a;
    --topbar-h:     64px;
    --content-bg:   #f0f4f8;
    --white:        #ffffff;
    --text-primary: #1a2b45;
    --text-muted:   #6b7c99;
    --border:       rgba(255,255,255,0.07);
    --card-radius:  16px;
    --transition:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ===========================================
   LAYOUT SHELL
   =========================================== */

.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* ===========================================
   SIDEBAR
   =========================================== */

.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}

/* Brand */
.sidebar-brand {
    padding: 24px 20px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.brand-logo-box {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--gold), var(--gold-warm));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--navy-dark);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(255,186,0,0.3);
}

.brand-text .brand-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.brand-text .brand-tag {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-label {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 12px 10px 6px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(255,186,0,0.18), rgba(255,143,0,0.1));
    color: var(--gold);
    font-weight: 600;
    border: 1px solid rgba(255,186,0,0.15);
}

.nav-item.active i { color: var(--gold); }

.nav-badge {
    margin-left: auto;
    background: var(--gold);
    color: var(--navy-dark);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
}

/* Dropdown Nav */
.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
}

.nav-dropdown-toggle > div {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-dropdown-toggle i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.nav-dropdown-toggle:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.nav-dropdown-icon {
    font-size: 0.8rem;
    transition: var(--transition);
}

.dropdown-active .nav-dropdown-icon {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 34px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-submenu.open {
    max-height: 200px;
    margin-top: 4px;
}

.nav-submenu .nav-item {
    font-size: 0.82rem;
    padding: 10px 14px;
}

/* Sidebar Collapsed Overrides */
.sidebar.collapsed .nav-dropdown-toggle span { display: none; }
.sidebar.collapsed .nav-dropdown-icon { display: none; }
.sidebar.collapsed .nav-submenu { padding-left: 0; }
.sidebar.collapsed .nav-dropdown-toggle { justify-content: center; padding: 12px 0; width: 48px; margin: 0 auto; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--border);
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    margin-bottom: 10px;
}

.admin-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--gold), var(--gold-warm));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--navy-dark);
    font-size: 1rem;
    flex-shrink: 0;
}

.admin-info .admin-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.admin-info .admin-role {
    font-size: 0.7rem;
    color: var(--gold);
    letter-spacing: 0.5px;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: rgba(220,53,69,0.1);
    border: 1px solid rgba(220,53,69,0.2);
    border-radius: 10px;
    color: #ff8b8b;
    font-family: 'Poppins', sans-serif;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(220,53,69,0.2);
    border-color: rgba(220,53,69,0.4);
    color: #ff6b6b;
}

/* ===========================================
   TOPBAR
   =========================================== */

.main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

.admin-shell:has(.sidebar.collapsed) .main-area {
    margin-left: var(--sidebar-collapsed-w);
}

.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid #e8eef4;
    display: flex;
    align-items: center;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    gap: 16px;
}

.topbar-title {
    flex: 1;
}

.topbar-title h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.topbar-title p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--content-bg);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
}

.topbar-icon-btn:hover {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

/* Hamburger (mobile only) */
.hamburger-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--content-bg);
    border: 1px solid #e2e8f0;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
}

/* ===========================================
   CONTENT AREA
   =========================================== */

.content-area {
    flex: 1;
    padding: 28px;
}

/* ===========================================
   PANELS (pages)
   =========================================== */

.panel { display: none; animation: panelFade 0.35s ease both; }
.panel.active { display: block; }

@keyframes panelFade {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===========================================
   DASHBOARD PANEL
   =========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    border: 1px solid #edf2f7;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.gold   { background: rgba(255,186,0,0.12); color: var(--gold-warm); }
.stat-icon.navy   { background: rgba(12,45,94,0.1);   color: var(--navy); }
.stat-icon.green  { background: rgba(25,135,84,0.1);  color: #198754; }
.stat-icon.purple { background: rgba(111,66,193,0.1); color: #6f42c1; }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.dashboard-empty {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 60px 20px;
    text-align: center;
    border: 2px dashed #e2e8f0;
}

.dashboard-empty i {
    font-size: 3.5rem;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.dashboard-empty h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===========================================
   SECTION HEADER
   =========================================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===========================================
   SEARCH & FILTER BAR
   =========================================== */

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--white);
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(12,45,94,0.08);
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--white);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    border-color: var(--navy);
}

/* ===========================================
   CARDS (table containers)
   =========================================== */

.data-card {
    background: var(--white);
    border-radius: var(--card-radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    border: 1px solid #edf2f7;
    overflow: hidden;
}

/* ===========================================
   TABLE STYLES
   =========================================== */

.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.data-table thead th {
    background: linear-gradient(135deg, var(--navy-dark), var(--navy));
    color: rgba(255,255,255,0.8);
    padding: 14px 18px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table thead th:first-child { border-radius: 0; }

.data-table tbody tr {
    border-bottom: 1px solid #f0f4f8;
    transition: background 0.2s;
}

.data-table tbody tr:last-child { border-bottom: none; }

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

.data-table tbody td {
    padding: 14px 18px;
    color: var(--text-primary);
    vertical-align: middle;
}

/* User Avatar in table */
.user-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--navy), var(--navy-mid));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-cell-info .name     { font-weight: 600; color: var(--text-primary); }
.user-cell-info .email    { font-size: 0.75rem; color: var(--text-muted); }

/* Badge */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pill.admin    { background: rgba(255,186,0,0.15); color: #b8620a; border: 1px solid rgba(255,186,0,0.3); }
.badge-pill.customer { background: rgba(12,45,94,0.1);   color: var(--navy); border: 1px solid rgba(12,45,94,0.15); }

/* Product image in table */
.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #f0f4f8;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-cell-info .pname    { font-weight: 600; }
.product-cell-info .pcategory { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; }

/* Category tag */
.cat-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(12,45,94,0.08);
    color: var(--navy);
    text-transform: capitalize;
}

/* Price */
.price-cell { font-weight: 700; color: #1a7a4a; font-size: 0.95rem; }

/* ===========================================
   TOGGLE SWITCH STYLES
   =========================================== */

.status-toggle {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.status-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #198754;
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #198754;
}

input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Status Labels */
.status-text {
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

.status-text.active { color: #198754; }
.status-text.inactive { color: #dc3545; }

/* Action Buttons */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-size: 0.9rem;
    background: #f1f5f9;
}

.action-btn.trash { color: #64748b; }
.action-btn.restore { color: #0ea5e9; }
.action-btn.delete { color: #ef4444; }

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-btn.trash:hover { background: #64748b; color: #fff; border-color: #64748b; }
.action-btn.restore:hover { background: #0ea5e9; color: #fff; border-color: #0ea5e9; }
.action-btn.delete:hover { background: #ef4444; color: #fff; border-color: #ef4444; }

/* ===========================================
   EMPTY STATE
   =========================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.35; }
.empty-state p { font-size: 0.9rem; }

/* Loading Spinner */
.table-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 36px; height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--navy);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===========================================
   OVERLAY (mobile sidebar)
   =========================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(3px);
}

/* ===========================================
   SIDEBAR COLLAPSED (Desktop)
   =========================================== */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-w);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .admin-info,
.sidebar.collapsed .logout-text {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
    width: 48px;
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-brand {
    padding: 24px 0 20px;
    justify-content: center;
}

.sidebar.collapsed .brand-logo-box {
    margin: 0;
}

.sidebar.collapsed .admin-profile {
    justify-content: center;
    padding: 10px 0;
    background: transparent;
}

.sidebar.collapsed .admin-avatar {
    margin: 0 auto;
}

.sidebar.collapsed .btn-logout {
    padding: 10px 0;
    width: 48px;
    margin: 0 auto;
}

.d-none-mobile {
    display: flex;
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 992px) {
    .d-none-mobile { display: none !important; }
    .sidebar {
        left: calc(-1 * var(--sidebar-w));
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.show { display: block; }

    .main-area { margin-left: 0; }

    .hamburger-btn { display: flex; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .content-area { padding: 16px; }
    .topbar { padding: 0 16px; }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card { padding: 16px; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-value { font-size: 1.4rem; }

    .section-header { flex-direction: column; align-items: flex-start; }

    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: 100%; }
    .filter-select { width: 100%; }
}
