/* =========================
   ADMIN LAYOUT
========================= */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f6f7fb;
    padding-left: 260px;
    transition: padding-left 0.25s ease;
}

/* Collapsed: narrow sidebar */
.admin-layout:has(.admin-sidebar.collapsed) {
    padding-left: 80px;
}

/* =========================
   SIDEBAR (fixed on desktop)
========================= */

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
    z-index: 500;
}

.admin-sidebar.collapsed {
    width: 80px;
}

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

.sidebar-header {
    height: 70px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
    color: #111;
}

.sidebar-logo-img {
    height: 36px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

.admin-sidebar.collapsed .sidebar-logo-img,
.admin-sidebar.collapsed .logo-text {
    display: none;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.collapse-btn {
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: #555;
    padding: 4px 6px;
    border-radius: 8px;
}

.collapse-btn:hover {
    background: #f1f3ff;
    color: #4f46e5;
}

/* =========================
   NOTIFICATION BELL
========================= */

.notif-bell-btn {
    position: relative;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: #555;
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

.notif-bell-btn:hover {
    background: #f1f3ff;
    color: #4f46e5;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
}

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

.sidebar-menu {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: #444;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 6px;
    transition: background 0.2s ease;
    width: 100%;
}

.menu-item i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.menu-item:hover  { background: #f1f3ff; }
.menu-item.active { background: #eef2ff; color: #4f46e5; }

.menu-group { margin-bottom: 6px; }

.submenu-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.submenu-item {
    display: block;
    margin-left: 36px;
    padding: 8px 12px;
    border-radius: 10px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.submenu-item:hover  { background: #f5f6ff; }
.submenu-item.active { color: #4f46e5; background: #eef2ff; }

/* Collapsed: hide labels */
.admin-sidebar.collapsed span,
.admin-sidebar.collapsed .chevron,
.admin-sidebar.collapsed .submenu-item {
    display: none;
}

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

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.logout           { color: #e94b6a; }
.logout:hover     { background: #ffe8ec; }

/* =========================
   ADMIN CONTENT
========================= */

.admin-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 24px;
    background: #f9fafb;
}

/* =========================
   MOBILE TOP BAR
   (hidden on desktop, shown on mobile)
========================= */

.admin-mobile-topbar {
    display: none;
}

.admin-mobile-overlay {
    display: none;
}

.mobile-menu-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.mobile-menu-btn:hover {
    background: #f1f3ff;
    color: #4f46e5;
}

/* =========================
   ORDER TOAST
========================= */

.order-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left: 4px solid #4f46e5;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    min-width: 280px;
    max-width: 360px;
    transition: transform 0.35s cubic-bezier(.22,1,.36,1), opacity 0.35s ease;
}

.order-toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.order-toast--hidden {
    transform: translateY(80px);
    opacity: 0;
    pointer-events: none;
}

.order-toast-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 17px;
    color: #4f46e5;
}

.order-toast-body   { flex: 1; min-width: 0; }
.order-toast-title  { font-size: 14px; font-weight: 700; color: #111; }
.order-toast-sub    { font-size: 12px; color: #666; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-toast-close  { border: none; background: none; font-size: 20px; color: #aaa; cursor: pointer; line-height: 1; padding: 0 2px; flex-shrink: 0; }
.order-toast-close:hover { color: #555; }

/* =========================
   SHARED PAGE COMPONENTS
========================= */

.admin-page     { width: 100%; max-width: 1200px; margin: auto; }

.admin-header   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h2 { font-size: 1.6rem; font-weight: 700; }

.admin-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,.06);
}

/* TABLE */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 0.8rem; color: #888; padding-bottom: 12px; }
.admin-table td { padding: 14px 0; border-top: 1px solid #eee; font-size: 0.95rem; }
.admin-table tbody tr:hover { background: rgba(0,0,0,0.03); }

/* TABLE SKELETON */
.skeleton-table td { padding: 16px 0; border-top: 1px solid #f0f0f0; }
.skeleton-cell {
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
    background-size: 600px 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
    0%   { background-position: -300px 0; }
    100% { background-position: 300px 0; }
}

/* EMPTY STATE */
.admin-empty { padding: 40px; text-align: center; color: #999; }

.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 64px 24px; text-align: center;
}
.empty-state-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: #f5f4f2; border: 1.5px solid #ebebeb;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 20px; font-size: 24px; color: #ccc;
}
.empty-state-title { font-size: 15px; font-weight: 600; color: #111; margin: 0 0 8px; }
.empty-state-sub   { font-size: 13px; color: #aaa; margin: 0 0 24px; max-width: 280px; line-height: 1.6; }

/* ACTION BUTTONS */
.action-cell { text-align: center; }
.action-label { display: block; font-size: 13px; color: #9a9a9a; margin-bottom: 6px; }
.action-buttons { display: flex; justify-content: center; gap: 10px; }

.trash-btn {
    width: 36px; height: 36px; border-radius: 10px; border: none;
    background: #ffe8ec; color: #e94b6a; cursor: pointer; transition: all 0.2s ease;
}
.trash-btn:hover { background: #e94b6a; color: #fff; transform: scale(1.05); }

.update-btn {
    height: 36px; padding: 0 14px; border-radius: 10px; border: none;
    background: #eef2ff; color: #4f46e5; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
}
.update-btn:hover { background: #4f46e5; color: #fff; transform: scale(1.05); }

/* =========================
   MOBILE  ≤ 768px
========================= */

@media (max-width: 768px) {

    /* Layout becomes vertical column */
    .admin-layout {
        padding-left: 0;
        flex-direction: column;
    }

    /* Show mobile top bar */
    .admin-mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 56px;
        padding: 0 16px;
        background: #fff;
        border-bottom: 1px solid #eee;
        position: sticky;
        top: 0;
        z-index: 600;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(0,0,0,.05);
    }

    /* Sidebar becomes slide-out drawer */
    .admin-sidebar,
    .admin-sidebar.collapsed {
        position: fixed;
        top: 0;
        left: -300px;
        bottom: 0;
        height: 100%;
        width: 280px;
        z-index: 1001;
        border-right: none;
        box-shadow: none;
        overflow-y: auto;
        transition: left 0.3s cubic-bezier(.4,0,.2,1), box-shadow 0.3s ease;
    }

    .admin-sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,.2);
    }

    /* Restore hidden text in collapsed state on mobile */
    .admin-sidebar span,
    .admin-sidebar .chevron,
    .admin-sidebar .submenu-item {
        display: revert;
    }

    /* Dark overlay behind the drawer */
    .admin-mobile-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1000;
        cursor: pointer;
        animation: overlayFade 0.2s ease;
    }

    @keyframes overlayFade {
        from { opacity: 0; }
        to   { opacity: 1; }
    }

    /* Content area fills remaining height */
    .admin-content {
        height: auto;
        min-height: calc(100vh - 56px);
        overflow-y: visible;
        padding: 16px;
    }

    /* Page header stacks on mobile */
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 16px;
    }

    .admin-header h2 { font-size: 1.3rem; }

    .admin-card { padding: 14px; }

    /* Scrollable tables instead of overflow-clip */
    .admin-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Order toast full-width at bottom on mobile */
    .order-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        min-width: unset;
        max-width: unset;
    }
}

@media (max-width: 480px) {
    .admin-content { padding: 12px; }
    .admin-header h2 { font-size: 1.15rem; }
}
