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

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

    /* NAVBAR (LEFT) */
    .admin-layout > :first-child {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        transition: width 0.25s ease;
    }

/* Collapsed state: shrink fixed wrapper + outer padding together */
.admin-layout:has(.admin-sidebar.collapsed) {
    padding-left: 80px;
}

.admin-layout:has(.admin-sidebar.collapsed) > :first-child {
    width: 80px;
}

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

.admin-sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease;
}

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

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

.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 {
    display: none;
}

.collapse-btn {
    border: none;
    background: none;
    font-size: 18px;
    cursor: pointer;
}

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

/* =========================
   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;
}

/* =========================
   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;
}

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

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

.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;
}

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

    .menu-item:hover {
        background: #f1f3ff;
    }

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

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

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

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

    .submenu-item:hover {
        background: #f5f6ff;
    }

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

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

/* =========================
   ADMIN PAGE
========================= */

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

/* =========================
   ADMIN HEADER
========================= */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

    .admin-header h2 {
        font-size: 1.6rem;
        font-weight: 700;
    }

/* =========================
   CARD
========================= */

.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-family: 'DM Sans', sans-serif;
    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-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);
    }
/* FOOTER */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #eee;
}

.logout {
    color: #e94b6a;
}

    .logout:hover {
        background: #ffe8ec;
    }

/* COLLAPSED STATE */
.admin-sidebar.collapsed .logo-text,
.admin-sidebar.collapsed span,
.admin-sidebar.collapsed .chevron,
.admin-sidebar.collapsed .submenu-item {
    display: none;
}

@media (max-width: 768px) {
    .admin-layout {
        padding-left: 0;
        flex-direction: column;
    }

    .admin-layout > :first-child {
        position: sticky;
        top: 0;
        width: 100%;
        z-index: 500;
        box-shadow: 0 2px 12px rgba(0,0,0,.07);
    }

    .admin-sidebar,
    .admin-sidebar.collapsed {
        position: static;
        width: 100%;
        flex-direction: row;
        align-items: center;
        height: auto;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid #eee;
        overflow: hidden;
    }

    .sidebar-header {
        flex-shrink: 0;
        height: 54px;
        padding: 0 14px;
        border-bottom: none;
        border-right: 1px solid #eee;
    }

    .sidebar-menu {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        flex: 1;
        padding: 8px;
        gap: 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-menu::-webkit-scrollbar { display: none; }

    .menu-item {
        flex-direction: column;
        flex-shrink: 0;
        gap: 3px;
        padding: 6px 12px;
        font-size: 10px;
        border-radius: 10px;
        white-space: nowrap;
        margin-bottom: 0;
    }

    .menu-item i { width: auto; font-size: 16px; }

    .menu-group { margin-bottom: 0; }

    .submenu-item,
    .menu-group > .menu-item + div,
    .admin-sidebar.collapsed .logo-text {
        display: none;
    }

    .admin-sidebar span,
    .admin-sidebar.collapsed span {
        display: inline;
    }

    .sidebar-footer {
        flex-direction: row;
        border-top: none;
        border-left: 1px solid #eee;
        padding: 8px;
        flex-shrink: 0;
    }

    .sidebar-footer .menu-item {
        margin-bottom: 0;
    }

    /* AdminNavBar renders an empty admin-content inside — hide it on mobile */
    .admin-layout .admin-layout .admin-content {
        display: none;
    }

    /* Actual page content area */
    .admin-layout > .admin-content {
        height: auto;
        min-height: 60vh;
        overflow-y: visible;
    }
}

@media (max-width: 480px) {
    .admin-layout > .admin-content {
        padding: 14px;
    }
}
