/**
 * STYLE.CSS - Main Dashboard Theme
 * Implements the dark glassmorphism theme for hi.html,
 * including the food menu, shopping cart, and layout.
 */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-light);
    overflow: hidden;
    /* Desktop: prevent scroll if content fits, widely overridden on mobile */
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}


@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 50px);
    }
}

.container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-dim);
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.footer-link {
    text-align: center;
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.footer-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-link a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.hidden {
    display: none;
}

/* Form switch animation */
.form-container {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.message.success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Additions for items page */
.items-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s;
}

.item-row:hover {
    transform: translateX(5px);
    background: rgba(15, 23, 42, 0.6);
}

.item-name {
    font-weight: 500;
    font-size: 1.1rem;
}

.item-price {
    font-weight: 700;
    color: #4ade80;
    font-size: 1.1rem;
}

.item-price::before {
    content: '₹';
    margin-right: 2px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0;
        /* Remove body padding to maximize width */
        align-items: flex-start;
        overflow-y: auto !important;
        /* Force scroll on mobile */
        height: auto;
        min-height: 100vh;
    }

    .container {
        max-width: 100%;
        padding: 0;
        /* Remove container padding */
    }

    .glass-card {
        padding: 16px;
        /* Reduce internal card padding */
        border-radius: 16px;
    }

    .header h1 {
        font-size: 1.5rem;
        /* Slightly smaller header */
    }

    .header {
        padding: 0 1rem;
        /* Prevent text touching edges */
    }

    .btn-primary {
        padding: 12px;
    }

    /* Adjust floating shapes for mobile performance/visibility */
    body::before,
    body::after {
        width: 200px;
        height: 200px;
        filter: blur(60px);
    }

    /* Force 2 column grid on mobile */
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px !important;
        /* Very tight gap */
        padding: 6px !important;
        /* Minimal container padding */
        max-width: 100vw;
        box-sizing: border-box;
    }

    .item-card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    .card-image {
        width: 100% !important;
        aspect-ratio: 4/3 !important;
        height: auto !important;
        border-radius: 8px !important;
        margin-bottom: 4px !important;
        object-fit: cover;
    }

    .card-content {
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
    }

    .card-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0 !important;
        margin-bottom: 0 !important;
    }

    .item-title {
        font-size: 0.85rem !important;
        /* Smaller font */
        line-height: 1.1 !important;
        margin: 0 !important;
        text-align: left !important;
        color: white !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100% !important;
    }

    .item-price {
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        padding: 0 !important;
        background: transparent !important;
        color: white !important;
        text-align: left !important;
        margin-top: 2px !important;
    }

    .item-price::before {
        content: none !important;
        margin-right: 0;
    }

    .item-desc {
        display: none !important;
    }

    .btn-add-cart {
        padding: 4px 8px !important;
        /* Very compact button */
        font-size: 0.75rem !important;
        width: 100% !important;
        border-radius: 6px !important;
        background: rgba(99, 102, 241, 0.3) !important;
        border: 1px solid rgba(99, 102, 241, 0.5) !important;
        margin-top: 4px;
        height: auto !important;
        min-height: 24px !important;
    }

    .admin-link {
        padding: 8px 16px;
        /* Larger touch target */
        font-size: 0.9rem;
    }
}

/* Admin Link Styles */
.admin-link-container {
    text-align: center;
    margin-top: 1.5rem;
}

.admin-link {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.admin-link:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
}

.close-modal {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: white;
}

.modal-body {
    overflow-y: auto;
    flex: 1;
}

.order-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.order-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.order-id {
    font-weight: 600;
    color: #6366f1;
}

.order-status {
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.status-unused {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.status-used {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.order-items {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-bottom: 8px;
}

/* Menu Grid Layout */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

.item-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: #2c3e50;
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.item-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.item-price {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
}

.item-desc {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex: 1;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.btn-add-cart {
    background: #6366f1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.btn-add-cart:hover {
    background: #4f46e5;
}

.qty-control {
    display: none;
    /* Hidden by default */
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px;
    width: 100%;
    justify-content: space-between;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: white;
    color: black;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: #e2e8f0;
}

/* Loading Animation */
.loader-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 3rem;
    grid-column: 1 / -1;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-bottom-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loader-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Cart Modal Styles */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    color: white;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.cart-item-price {
    color: #94a3b8;
    font-size: 0.9rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Reconstructed Cart Bottom Section */
.cart-total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}

#cart-total-display {
    color: #4ade80;
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

/* Navigation Buttons (Cart, Orders, Logout) */
.nav-btn,
.logout-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn:hover,
.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* --- Splash Screen --- */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s;
}

#splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.logo-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.splash-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 2;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
}

/* White Glimpse Rotating Ring */
.logo-container {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.glimpse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: #0ef;
    /* Cyan/Electric blue spark */
    border-right-color: rgba(0, 238, 255, 0.3);
    box-shadow: 0 0 15px #0ef, 0 0 30px rgba(0, 238, 255, 0.4);
    filter: blur(1px);
    animation: rotateGlimpse 1s linear infinite;
    z-index: 1;
}

/* Secondary blur spark for depth */
.glimpse-ring::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-bottom-color: #ff00ff;
    /* Magenta tail */
    border-left-color: rgba(255, 0, 255, 0.2);
    filter: blur(4px);
    animation: rotateGlimpse 1.5s linear infinite reverse;
}

@keyframes rotateGlimpse {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text-container {
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 300px;
}

#loading-sentence {
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-align: center;
    transition: opacity 0.5s ease;
}

/* Force 2-column mobile layout - Override */
@media (max-width: 768px) {
    .menu-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        padding: 8px !important;
    }

    .item-card {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 2.5rem;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: splashEntrance 1.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.splash-logo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
    animation: logoPulse 2.5s infinite ease-in-out;
}

.splash-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.splash-timer-container {
    display: none;
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: fadeIn 0.8s ease;
}

.splash-timer {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to bottom, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.splash-message {
    color: var(--text-dim);
    font-size: 0.9rem;
    max-width: 280px;
    line-height: 1.5;
    text-align: center;
}

@keyframes splashEntrance {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes logoPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
        border-color: var(--primary);
    }

    50% {
        transform: scale(1.08);
        box-shadow: 0 0 40px rgba(99, 102, 241, 0.7);
        border-color: var(--secondary);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
        border-color: var(--primary);
    }
}