/* gck-canteen-main/public/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-hue: 221;
    --primary: hsl(var(--primary-hue), 70%, 50%);
    --primary-light: hsl(var(--primary-hue), 80%, 65%);
    --primary-dark: hsl(var(--primary-hue), 70%, 40%);
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --gray: #6b7280;
    --light-gray: #f3f4f6;
    --white: #ffffff;
    --card-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --border-radius: 16px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--light-gray);
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    background: var(--white);
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .app-container {
        max-width: 450px;
        margin: 2rem auto;
        border-radius: 24px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.1);
        min-height: calc(100vh - 4rem);
    }
}

/* Login Screen */
.login-screen {
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
    color: var(--white);
}

.app-logo {
    width: 80px;
    height: 80px;
    background: var(--white);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--primary);
    box-shadow: var(--card-shadow);
    margin: 0 auto 20px;
}

.app-title {
    font-size: 28px;
    font-weight: 700;
}

.app-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.login-form {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--card-shadow);
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all var(--transition-speed) ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px hsla(var(--primary-hue), 70%, 50%, 0.1);
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

/* Dashboard */
.dashboard {
    min-height: 100vh;
    background: var(--light-gray);
    padding-bottom: 80px; /* Space for bottom nav */
}

.header {
    background: var(--primary);
    padding: 20px 20px 30px 20px;
    color: var(--white);
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
}

.header-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.user-info .welcome-text {
    font-size: 14px;
    opacity: 0.8;
}

.user-info .user-name {
    font-size: 24px;
    font-weight: 700;
    margin: 2px 0;
}

.user-info .user-dept {
    font-size: 14px;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.main-content {
    padding: 20px;
    margin-top: -20px; /* Pull content up slightly */
}

/* Stats Card */
.stats-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.stats-grid {
    display: flex;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    margin-top: 4px;
}

/* Meal Cards */
.meal-section {
    display: grid;
    gap: 15px;
}

.meal-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.meal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

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

.meal-title {
    font-size: 18px;
    font-weight: 600;
}

.meal-date {
    font-size: 14px;
    color: var(--gray);
}

.meal-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-booked { background: hsl(var(--primary-hue), 80%, 90%); color: var(--primary-dark); }
.status-available { background: #d1fae5; color: #065f46; }
.status-expired { background: #fee2e2; color: #991b1b; }
.status-consumed { background: #e5e7eb; color: var(--gray); }

.meal-actions {
    display: flex;
    gap: 10px;
}

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =================================== */
/* === REALISTIC TICKET STYLES === */
/* =================================== */

.ticket-container {
    padding: 20px 0 0; /* Add 20px padding to the top */
}

.ticket-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    position: relative;
    height: 480px; /* Fixed height for a consistent ticket shape */
    margin: 0 auto;
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 30px;
    background: var(--light-gray);
    border-radius: 50%;
    left: 115px; /* Position based on stub width */
    transform: translate(-50%, -50%);
    border: 1px solid #e5e7eb;
}

.ticket-stub {
    width: 130px;
    background: var(--primary);
    color: var(--white);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    position: relative;
    border-right: 2px dashed rgba(255,255,255,0.3);
}

.stub-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 30px;
}

.stub-header .logo {
    font-size: 18px;
}
.stub-header .college-name {
    font-weight: 700;
    font-size: 20px;
}

.stub-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stub-item {
    display: flex;
    flex-direction: column;
}

.stub-item span {
    font-size: 12px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stub-item strong {
    font-size: 14px;
    font-weight: 600;
}

.stub-footer {
    font-size: 12px;
    opacity: 0.7;
    font-family: monospace;
}

.ticket-main {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.main-header {
    text-align: center;
}

.main-header h4 {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-header p {
    font-size: 14px;
    color: var(--gray);
}

.ticket-qr {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px auto;
    width: 200px; /* Fixed width */
    height: 200px; /* Fixed height */
    border: 1px solid var(--light-gray);
    position: relative;
}

.ticket-qr.validated::after {
    content: "VALIDATED";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 36px;
    font-weight: 800;
    color: rgba(239, 68, 68, 0.4);
    border: 4px solid rgba(239, 68, 68, 0.4);
    padding: 10px 20px;
    border-radius: 10px;
    z-index: 10;
}

.ticket-actions {
    text-align: center;
}

.ticket-actions .btn {
    width: auto;
    padding: 12px 20px;
}

.ticket-program {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    color: var(--gray);
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =================================== */
/* === END OF TICKET STYLES === */
/* =================================== */


/* History Page */
.history-container {
    padding: 0;
}
.history-container h3 {
    margin: 0 20px 20px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 15px 20px;
    border-bottom: 1px solid var(--light-gray);
}
.history-item:first-child { 
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}
.history-item:last-child { 
    border-bottom: none;
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.history-date { font-weight: 600; }
.history-time { font-size: 12px; color: var(--gray); }
.history-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Profile Page */
.profile-container { padding: 0; }
.profile-container > h3 {
    margin: 0 20px 20px;
}
.profile-card h3 { margin-bottom: 20px; font-weight: 600; }

.profile-card {
    background: var(--white);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
    padding: 20px;
}

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

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 15px;
}

.profile-name { font-size: 20px; font-weight: 700; }
.profile-info { font-size: 14px; color: var(--gray); }

.profile-details {
    list-style: none;
    padding: 0;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--light-gray);
}
.profile-item:last-child { border-bottom: none; }
.profile-label { color: var(--gray); }
.profile-value { font-weight: 500; }

/* Canteen Scanner Styles */
#canteenHome.main-content {
    margin-top: 0;
    padding: 0 20px 20px;
}
.scanner-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: -30px; /* Overlap with header */
    position: relative;
    z-index: 2;
}
.scanner-stat {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    box-shadow: var(--card-shadow);
}
.scanner-box {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 20px 0 0;
    box-shadow: var(--card-shadow);
}
.scanner-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
}
#qr-reader {
    border-radius: 8px;
    overflow: hidden;
}

/* Validation Result Overlay */
.validation-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}
.validation-overlay.show { display: flex; }

.validation-content {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    width: 90%;
    max-width: 320px;
    transform: scale(0.9);
    animation: popIn 0.3s ease forwards;
}
.validation-content button {
    margin-top: 30px;
    width: 100%;
}
.validation-icon {
    width: 80px; height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}
.validation-success .validation-icon { background: #d1fae5; color: var(--success); }
.validation-error .validation-icon { background: #fee2e2; color: var(--danger); }
.validation-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.validation-message { font-size: 14px; color: var(--gray); line-height: 1.6; }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 450px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0 0 24px 24px;
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
    }
}

.nav-item {
    flex: 1;
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    color: var(--gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 11px; font-weight: 500; }

/* Utils & Modals */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.hidden { display: none !important; }

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none; justify-content: center; align-items: center;
    z-index: 1000;
}
.modal-content {
    background: white; padding: 30px; border-radius: var(--border-radius);
    width: 90%; max-width: 400px;
    position: relative;
}
.modal-close {
    position: absolute; top: 15px; right: 20px;
    font-size: 24px; cursor: pointer; color: var(--gray);
}

#toast-container {
    position: fixed; top: 20px; left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background-color: var(--dark); color: var(--white);
    padding: 12px 20px; border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeIn 0.5s forwards, fadeOut 0.5s 2.5s forwards;
}
.toast.success { background-color: var(--success); }
.toast.error { background-color: var(--danger); }

.confirmation-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center;
    z-index: 10001;
}
.confirmation-content {
    background: white; padding: 30px; border-radius: var(--border-radius);
    width: 90%; max-width: 400px; text-align: center;
}
.confirmation-content h3 { margin-bottom: 15px; }
.confirmation-content p { margin-bottom: 25px; color: var(--gray); }
.confirmation-buttons { display: flex; justify-content: center; gap: 15px; }

.skeleton-container { padding: 20px; margin-top: -20px; }
.skeleton {
    background-color: #e0e0e0;
    border-radius: var(--border-radius);
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.stats-card.skeleton { height: 90px; margin-bottom: 20px; }
.meal-card.skeleton { height: 120px; margin-bottom: 15px; }
.scanner-stat.skeleton { height: 80px; }


.notification-bar {
    background-color: var(--success);
    color: var(--white);
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    margin-bottom: 20px;
    border-radius: 8px;
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); } }
@keyframes pulse { 50% { opacity: .5; } }