/* Cart Item Styles */
.cart-item {
    transition: background-color 0.3s ease;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
}

.cart-item.draft {
    background-color: #ffffff;
    /* White for draft */
    border-left: 4px solid #9ca3af;
    /* Grey indicator */
}

.cart-item.synced {
    background-color: #dcfce7;
    /* Green for synced (db) */
    border-left: 4px solid #22c55e;
    /* Green indicator */
}

/* Unavailable Item Styles */
.food-card.unavailable {
    opacity: 0.6;
    background-color: #f3f4f6;
    position: relative;
    cursor: not-allowed;
}

.food-card.unavailable::after {
    content: "Unavailable";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    pointer-events: none;
}

/* Admin Toggle Button */
.toggle-availability-btn {
    margin-top: 0.5rem;
    width: 100%;
    padding: 5px;
    font-size: 0.8rem;
    cursor: pointer;
}

.toggle-availability-btn.active {
    background-color: #ef4444;
    /* Red for 'Make Unavailable' action */
    color: white;
}

.toggle-availability-btn.inactive {
    background-color: #22c55e;
    /* Green for 'Make Available' action */
    color: white;
}

/* Admin Orders Section */
#admin-orders-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-card {
    border: 1px solid #e5e7eb;
    padding: 1rem;
    border-radius: 8px;
    background: white;
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

/* Order Card (Client) */
.order-card-client {
    border: 1px solid #e5e7eb;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.order-header-client {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.5rem;
}

.order-items-compact {
    font-size: 0.9rem;
    color: #4b5563;
    background: #f9fafb;
    padding: 0.5rem;
    border-radius: 4px;
}

.order-status.pending {
    color: #f59e0b;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: #fffbeb;
}

.order-status.confirmed {
    color: #2563eb;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: #eff6ff;
}

.order-status.completed {
    color: #10b981;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: #ecfdf5;
}

.order-status.cancelled {
    color: #ef4444;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: #fef2f2;
}

/* Button variants for order actions */
.btn-success {
    background-color: #10b981 !important;
    color: white !important;
    cursor: pointer;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-success:hover {
    background-color: #059669 !important;
}

.btn-error {
    background-color: #ef4444 !important;
    color: white !important;
    cursor: pointer;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-error:hover {
    background-color: #dc2626 !important;
}

.order-actions {
    margin-top: 1rem;
}

/* Outlet Status Badge */
.outlet-status-badge {
    cursor: pointer;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.outlet-status-badge:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.outlet-status-badge .icon {
    font-size: 1.4em;
}

.outlet-status-badge .details {
    display: flex;
    flex-direction: column;
}

.outlet-status-badge .label {
    font-size: 0.65em;
    text-transform: uppercase;
    font-weight: 800;
    opacity: 0.6;
    letter-spacing: 0.05em;
    line-height: 1;
    margin-bottom: 2px;
}

.outlet-status-badge .name {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.9em;
    line-height: 1;
}

/* Outlet Grid for Selection */
.outlet-grid button {
    background: white;
    border: 2px solid #f3f4f6;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex !important;
    width: 100%;
    margin-bottom: 8px;
}

.outlet-grid button:hover {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.02);
    transform: translateX(4px);
}

.outlet-grid button .details {
    text-align: left;
}

/* Ensure screens cover viewport */
.screen {
    min-height: 100vh;
    width: 100%;
}

/* Admin Search Box Styles */
.search-container {
    position: relative;
    max-width: 400px;
    margin-bottom: 1.5rem;
}

.search-container input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #f9fafb;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-container input:focus {
    outline: none;
    border-color: #4f46e5;
    background: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.search-container input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.search-cont#admin-history-search::placeholder {
    color: #9ca3af;
}

/* User Badge (Student Balance) */
#user-badge {
    margin: 8px 0;
}

.user-badge {
    background: #f0f4ff;
    padding: 6px 14px;
    border-radius: 50px;
    display: inline-flex !important;
    align-items: center;
    border: 1px solid #e0e7ff;
    font-size: 0.9rem;
    color: #4f46e5;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.1);
}

.balance-mask {
    font-family: inherit;
    letter-spacing: 1px;
    font-weight: 600;
}

#balance-btn {
    transition: transform 0.2s ease;
}

#balance-btn:hover {
    transform: scale(1.1);
}

.search-icon-wrapper {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 1;
}

/* Student Search Box Enhancements */
.search-bar.card {
    padding: 0;
    overflow: hidden;
    border-radius: 12px;
}

.search-input {
    display: flex;
    align-items: center;
    padding: 2px 16px;
    background: #f9fafb;
    border-radius: 12px;
}

#search-input {
    border: none !important;
    background: transparent !important;
    padding: 12px 10px !important;
    box-shadow: none !important;
    width: 100%;
}

#search-input:focus {
    transform: none !important;
}

/* Sidebar Badges */
.nav-badges {
    display: flex;
    gap: 3px;
    align-items: center;
}

.n-badge {
    font-size: 0.65rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.b-pending {
    background: #ef4444;
}

/* Red */
.b-confirmed {
    background: #3b82f6;
}

/* Blue */
.b-preparing {
    background: #f59e0b;
}

/* Orange */
.b-ready {
    background: #10b981;
}

/* Green */

/* Desktop Layout (Laptop & larger) */
@media (min-width: 1024px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }

    .main-content {
        display: grid;
        grid-template-columns: 320px 1fr 350px;
        /* Orders - Menu - Cart */
        grid-template-areas: "orders food cart";
        gap: 24px;
        align-items: start;
    }

    .food-section {
        grid-area: food;
    }

    /* Override Bottom Sheet styles for Desktop */
    #cart-sheet,
    #orders-sheet {
        position: sticky !important;
        top: 20px !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        width: auto !important;
        height: calc(100vh - 100px) !important;
        transform: none !important;
        z-index: 1 !important;
        background: transparent !important;
        box-shadow: none !important;
        display: block !important;
        /* Always show on desktop */
        transition: none !important;
    }

    #cart-sheet .card,
    #orders-sheet .card {
        height: 100% !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
        border: 1px solid #e5e7eb !important;
    }

    #orders-sheet {
        grid-area: orders;
    }

    #cart-sheet {
        grid-area: cart;
    }

    /* Hide mobile handles and close buttons on desktop */
    .cart-handle,
    #close-cart-btn,
    #close-orders-btn {
        display: none !important;
    }

    /* Hide bottom nav on desktop */
    .bottom-nav {
        display: none !important;
    }

    /* Adjust Order Card in Sidebar */
    .order-card-client {
        font-size: 0.9rem;
    }
}

/* Pickup Code Privacy */
.pickup-code-mask {
    font-family: monospace;
    letter-spacing: 2px;
    margin-right: 8px;
}

.pickup-code-val {
    display: none;
    font-weight: 800;
}

.code-reveal-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1em;
    padding: 0 4px;
    vertical-align: middle;
    opacity: 0.6;
}

.code-reveal-btn:hover {
    opacity: 1;
}

.revealed .pickup-code-mask {
    display: none;
}

.revealed .pickup-code-val {
    display: inline;
}