/* **********
   CSS Variables & Root Styles (Glassmorphism & Modern Palette)
   ********** */
:root {
    /* Color Palette */
    --bg-gradient-1: #0f172a;
    --bg-gradient-2: #1e1b4b;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --primary-color: #ff4b2b;
    --primary-gradient: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --primary-gradient-hover: linear-gradient(135deg, #ff4b2b 0%, #ff416c 100%);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-orange: #f97316;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;

    /* Spacing & Borders */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* **********
   Global Reset
   ********** */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', sans-serif;
}

body {
    background: var(--bg-gradient-1);
    background-image: radial-gradient(circle at 15% 50%, rgba(255, 65, 108, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 25%);
    color: var(--text-main);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    color: inherit;
    transition: var(--transition);
}

.scroll-hidden::-webkit-scrollbar {
    display: none;
}
.scroll-hidden {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* **********
   Glassmorphism Utilities & Common
   ********** */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

.mobile-only {
    display: none !important;
}

/* **********
   Table View (index.html) Layout
   ********** */
.tablet-view #app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

/* Left 70%: Menu Section */
#menu-section {
    flex: 7;
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

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

.brand i {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.glass-pill {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 6px;
    display: flex;
    gap: 8px;
}

.category-btn {
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.category-btn.active, .category-btn:hover {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 65, 108, 0.3);
}

/* Menu Grid Layout */
#menu-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding-bottom: 20px;
    align-content: start;
}

.menu-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.menu-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-image {
    width: 100%;
    height: 180px;
    position: relative;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.menu-card:hover .card-image img {
    transform: scale(1.1);
}

.price-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.menu-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.menu-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    flex: 1;
    margin-bottom: 16px;
    line-height: 1.4;
}

.btn-add-cart {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.btn-add-cart:hover {
    background: var(--text-main);
    color: var(--bg-gradient-1);
}

/* Right 30%: Cart Section */
#cart-section {
    flex: 3;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.cart-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-number {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
}

#cart-items-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-info {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.item-price {
    color: var(--accent-orange);
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-qty-minus, .btn-qty-plus {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-qty-minus:hover, .btn-qty-plus:hover {
    background: var(--primary-gradient);
}

.item-qty {
    font-size: 1.1rem;
    font-weight: 700;
    width: 20px;
    text-align: center;
}

.btn-remove {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.btn-remove:hover {
    color: var(--accent-red);
}

.cart-footer {
    padding: 24px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.3);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1rem;
    color: var(--text-muted);
}

.summary-row.total {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
}

.btn-gradient-pulse {
    width: 100%;
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(255, 65, 108, 0.4);
    animation: pulse 2s infinite;
}

.btn-gradient-pulse:hover {
    background: var(--primary-gradient-hover);
    transform: scale(1.02);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 65, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0); }
}

/* **********
   Admin View (admin.html) Layout
   ********** */
.admin-view {
    overflow: auto;
}

#admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    margin: 20px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}

.admin-nav {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.nav-item.active {
    border-left: 4px solid var(--accent-orange);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.admin-user .avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

/* Admin Main */
.admin-main {
    flex: 1;
    padding: 20px 20px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 10px 20px;
}

.admin-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.date-badge {
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    border: 1px solid var(--glass-border);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    border: 1px solid var(--glass-border);
}

.stat-info h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    flex: 1;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.btn-refresh {
    background: rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 50%;
}

.btn-refresh:hover {
    background: var(--text-main);
    color: var(--bg-gradient-1);
    transform: rotate(180deg);
}

/* Tables */
.table-responsive {
    padding: 20px;
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th, .modern-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.modern-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.badge-table {
    background: rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}
.badge-status.pending {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}
.badge-status.processing {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}
.badge-status.completed {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}
.badge-status.cancelled {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-right: 6px;
}
.btn-action.complete { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); }
.btn-action.complete:hover { background: var(--accent-green); color: #fff; }
.btn-action.cancel { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.btn-action.cancel:hover { background: var(--accent-red); color: #fff; }

/* Forms */
.modern-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.modern-form input, .modern-form select, .modern-form textarea {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.modern-form input:focus, .modern-form select:focus, .modern-form textarea:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.modern-form select option {
    background: var(--bg-gradient-1);
    color: var(--text-main);
}

.btn-primary-solid {
    background: var(--primary-gradient);
    color: #fff;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 10px;
}

.btn-primary-solid:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 65, 108, 0.4);
}

/* **********
   Responsive Adjustments (max-width: 1024px)
   ********** */
@media (max-width: 1024px) {
    body { overflow-y: auto; overflow-x: hidden; }
    .content-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .tablet-view #app-container { flex-direction: column; height: auto; min-height: 100vh; }
    #menu-grid { overflow-y: visible; padding-bottom: 20px; }
    #cart-section { width: 100%; height: auto; margin-top: 20px; }
}

/* **********
   Mobile Responsive Patterns (max-width: 768px)
   ********** */
@media (max-width: 768px) {
    /* Reveal Mobile Only Elements */
    #mobile-cart-bar.mobile-only {
        display: flex !important;
    }
    #btn-close-cart.mobile-only,
    #admin-menu-toggle.mobile-only {
        display: inline-flex !important;
    }
    #admin-overlay.mobile-only {
        display: block !important;
    }

    /* Index App Container Adaptations */
    .tablet-view #app-container {
        padding: 16px;
        padding-bottom: 90px; /* Space for the floating cart bar */
        gap: 16px;
    }

    .menu-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    #category-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 6px;
        justify-content: flex-start;
    }

    .category-btn {
        white-space: nowrap;
        font-size: 0.95rem;
        padding: 8px 18px;
    }

    /* Mobile Menu Grid */
    #menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        align-content: start;
    }

    .card-image {
        height: 120px;
    }

    .menu-title {
        font-size: 1.05rem;
        margin-bottom: 4px;
    }

    .menu-desc {
        font-size: 0.8rem;
        margin-bottom: 12px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .btn-add-cart {
        padding: 10px;
        font-size: 0.9rem;
    }

    .price-badge {
        font-size: 0.85rem;
        padding: 4px 10px;
        top: 8px;
        right: 8px;
    }

    /* Bottom Sheet Cart Overrides */
    #cart-section {
        position: fixed;
        bottom: -100%;
        left: 0;
        width: 100%;
        height: 85vh;
        z-index: 1000;
        margin: 0;
        border-radius: 24px 24px 0 0;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.6);
        transition: bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }

    #cart-section.open {
        bottom: 0;
    }

    .cart-header {
        padding: 20px;
    }

    .cart-footer {
        padding: 20px;
        background: rgba(0, 0, 0, 0.5);
    }

    .btn-gradient-pulse {
        padding: 16px;
        font-size: 1.15rem;
    }

    /* Floating Mobile Cart Bar */
    #mobile-cart-bar {
        position: fixed;
        bottom: 20px;
        left: 5%;
        width: 90%;
        background: var(--primary-gradient);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 10px 30px rgba(255, 65, 108, 0.5);
        border-radius: 50px;
        padding: 16px 24px;
        justify-content: space-between;
        align-items: center;
        z-index: 990;
        color: #fff;
        transition: transform 0.2s ease, opacity 0.3s ease;
    }

    #mobile-cart-bar:active {
        transform: scale(0.97);
    }

    #mobile-cart-bar.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateY(20px);
    }

    .mobile-cart-summary {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .mobile-qty-badge {
        background: rgba(255, 255, 255, 0.25);
        padding: 4px 12px;
        border-radius: 20px;
        font-weight: 700;
        font-size: 0.95rem;
        backdrop-filter: blur(4px);
    }

    .mobile-price {
        font-weight: 800;
        font-size: 1.25rem;
    }

    .mobile-cart-action {
        display: flex;
        align-items: center;
        gap: 6px;
        font-weight: 600;
        font-size: 1rem;
    }

    /* Admin View Mobile Adjustments */
    .admin-main {
        padding: 16px;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0 20px 0;
        gap: 16px;
    }

    .admin-header h1 {
        font-size: 1.6rem;
    }

    .date-badge {
        align-self: flex-start;
    }

    .stats-grid, .content-grid {
        grid-template-columns: 1fr;
    }

    /* Off-Canvas Sidebar */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        z-index: 1100;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border-right: 1px solid var(--glass-border);
        transition: left 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    }

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

    /* Admin Overlay Layer */
    #admin-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        z-index: 1050;
        transition: opacity 0.3s ease;
    }

    #admin-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* Adjust Admin Form Row */
    .form-row {
        flex-direction: column;
        gap: 16px;
    }
}
```