body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #eef2f7;
}

/* ADMIN LAYOUT */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #eef2f7;
}

/* SIDEBAR */

.admin-sidebar {
    width: 260px;
    min-width: 260px;
    background: #07152f;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    padding: 30px 20px;
    box-sizing: border-box;
}

.sidebar-top {
    text-align: center;
    margin-bottom: 40px;
}

.sidebar-logo {
    width: 90px;
    margin-bottom: 15px;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: 0.3s;
}

.sidebar-menu li:hover,
.sidebar-menu li.active {
    background: #1e293b;
}

/* MAIN CONTENT */

.admin-main {
    flex: 1;
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    background: #eef2f7;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 24px;
    overflow-x: auto;
}

.admin-main>* {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* HEADER */

.admin-header {
    background: white;
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
    flex-wrap: wrap;
    border-bottom: 1px solid #e2e8f0;
}

.admin-header-left {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-system-title h1 {
    font-size: 34px;
    color: #0f172a;
    margin: 0 0 8px;
}

.admin-system-title p {
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.admin-system-status {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.status-badge.online {
    background: #dcfce7;
    color: #166534;
}

.status-badge.sync {
    background: #dbeafe;
    color: #1d4ed8;
}

/* QUICK ACTIONS */

.admin-quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-quick-actions button {
    border: none;
    background: linear-gradient(135deg, #14532d, #166534);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.25s ease;
}

.admin-quick-actions button:hover {
    transform: translateY(-2px);
}

/* ADMIN USER */

.admin-user {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-user-box {
    background: white;
    padding: 14px 18px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.admin-user-box strong {
    font-size: 14px;
    color: #0f172a;
}

.admin-user-box span {
    font-size: 12px;
    color: #64748b;
}

.logout-btn {
    border: none;
    background: #dc2626;
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
}

.logout-btn:hover {
    opacity: 0.9;
}

/* CONTENT */

#adminContent {
    flex: 1;
    padding: 40px;
}

/* BUILDFRAME FOOTER */

.admin-footer {
    width: 100%;
    margin-top: auto;
    padding: 18px 24px;
    background:
        linear-gradient(rgba(10, 38, 71, 0.96), rgba(10, 38, 71, 0.96)),
        linear-gradient(to right, rgba(56, 189, 248, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(56, 189, 248, 0.12) 1px, transparent 1px);
    background-size: cover, 34px 34px, 34px 34px;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid rgba(56, 189, 248, 0.22);
}

.admin-footer-inner {
    width: 100%;
    max-width: 980px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    text-align: center;
}

.admin-footer-left,
.admin-footer-right {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-footer-left strong {
    color: white;
    font-weight: 800;
}

.admin-footer-left span {
    color: rgba(255, 255, 255, 0.72);
}

.admin-footer-right a {
    color: white;
    text-decoration: none;
    padding: 7px 13px;
    background: rgba(56, 189, 248, 0.10);
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.admin-footer-right a:hover {
    background: #38bdf8;
    color: #082f49;
}

/* RESPONSIVE */

@media (max-width: 768px) {
    .admin-sidebar {
        position: relative;
        width: 100%;
        min-width: 100%;
        height: auto;
    }

    .admin-layout {
        flex-direction: column;
    }

    .admin-main {
        margin-left: 0;
        width: 100%;
    }

    .admin-header {
        padding: 25px 20px;
    }

    #adminContent {
        padding: 20px;
    }

    .admin-system-title h1 {
        font-size: 28px;
    }

    .admin-quick-actions,
    .admin-quick-actions button {
        width: 100%;
    }
}

/* =========================================
   MOBILE ADMIN SIDEBAR TOGGLE
========================================= */

.admin-mobile-menu-btn {
    display: none;
}

.admin-sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {

    .admin-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 260px;
        min-width: 260px;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
    }

    .admin-sidebar.open {
        left: 0;
    }

    .admin-main {
        margin-left: 0;
        width: 100%;
    }

    .admin-mobile-menu-btn {
        display: flex;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 2100;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 12px;
        background: #07152f;
        color: white;
        font-size: 24px;
        cursor: pointer;
        box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
    }

    .admin-sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1900;
    }

    .admin-sidebar-backdrop.show {
        display: block;
    }

    .admin-header {
        padding-top: 78px;
    }
}

.sidebar-subtitle {
    margin: 4px 0 0;
    font-size: 12px;
    color: #9fb3c8;
}

.sidebar-menu li {
    cursor: pointer;
}

/* =========================================
   ADMIN WIDTH EXPANSION FIX
========================================= */

.admin-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
}

.admin-content {
    width: 100%;
    max-width: 100%;
}

.admin-content table {
    width: 100%;
}

/* =========================================
   STANDALONE ADMIN MODULE PAGES
========================================= */

.admin-standalone-page {
    min-height: 100vh;
    background: #eef2f7;
    padding: 32px;
}

.admin-back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #07152f;
    text-decoration: none;
    font-weight: 800;
}

.admin-page-hero {
    background: linear-gradient(135deg, #07152f, #12345a);
    color: #ffffff;
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: 0 18px 45px rgba(7, 21, 47, 0.2);
}

.admin-page-hero span {
    display: inline-block;
    color: #7dffca;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.admin-page-hero h1 {
    margin: 0 0 8px;
    font-size: 32px;
}

.admin-page-hero p {
    margin: 0;
    color: #dbeafe;
}

.admin-module-card {
    background: #ffffff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    overflow-x: auto;
}

.admin-simple-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 18px;
}

.admin-simple-table th,
.admin-simple-table td {
    padding: 14px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.admin-simple-table th {
    background: #f8fafc;
    color: #07152f;
}

/* =========================================
   ORDERS MODULE OVERFLOW FIX
========================================= */

.admin-content {
    overflow-x: hidden;
}

.admin-content form,
.admin-content .module-card {
    max-width: 100%;
    overflow-x: auto;
}

.admin-content table {
    max-width: 100%;
    table-layout: auto;
}

.admin-content th,
.admin-content td {
    white-space: nowrap;
}

#cartItemsTable,
#orderItemsTable,
.order-items-table {
    max-width: 100%;
    overflow-x: auto;
}

/* =========================================
   SYSTEM HEALTH PAGE
========================================= */

.system-health-top {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.system-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.system-status-card {
    background: #f8fafc;
    border-radius: 18px;
    padding: 18px;
    border: 1px solid #e2e8f0;
}

.system-status-card strong {
    display: block;
    margin-bottom: 8px;
    color: #07152f;
}

.system-status-card span {
    font-weight: 800;
}

.status-good {
    color: #15803d;
}

.status-pending {
    color: #b45309;
}

.status-bad {
    color: #dc2626;
}

@media (max-width: 900px) {
    .system-status-grid {
        grid-template-columns: 1fr;
    }
}

html {
    overflow-y: scroll;
}