:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #7c3aed;
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
    --success-color: #059669;
    --danger-color: #dc2626;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-image: radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.08), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.08), transparent 25%);
}

.page-container {
    max-width: 100%; /* Changed from 1200px to allow maximum width */
    margin: 0 auto;
    padding: 2rem;
}

/* Glassmorphism Cards - Lighter */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Typography */
h1, h2, h3 {
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    background: #ffffff;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem;
    text-decoration: none;
    color: var(--text-main);
}

.dashboard-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1);
}

.dashboard-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Scanner & Camera */
.camera-container {
    width: 100%;
    max-width: 100%; /* No pixel limit, takes full width of the card */
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #e2e8f0;
    border: 2px solid var(--border-color);
}

video {
    width: 100%;
    display: block;
    object-fit: contain;
    transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
}

#reader {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
}

/* Nav Menu Override */
.navbar {
    background: var(--card-bg) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}
.navbar-brand {
    color: var(--text-main) !important;
    font-weight: 700;
}
.nav-link {
    color: var(--text-muted) !important;
    transition: color 0.3s ease;
    font-weight: 500;
}
.nav-link:hover, .nav-link.active {
    color: var(--primary-color) !important;
    background-color: rgba(79, 70, 229, 0.05);
    border-radius: 6px;
}

/* Layout overrides */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main {
    flex: 1;
}

.success-message {
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success-color);
    border-radius: 12px;
    margin-top: 1rem;
    text-align: center;
}

/* QR Scanner Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.animated-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#qr-reader {
    position: relative;
}

#qr-reader video {
    display: block;
    width: 100%;
    height: auto;
}

/* Focus guide and tracking overlay */
#qr-reader canvas {
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 576px) {
    .page-container {
        padding: 1rem;
    }

    .glass-card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .glass-card h2 {
        font-size: 1.35rem;
    }

    .glass-card h4 {
        font-size: 1.1rem;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline-secondary {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    .camera-container {
        border-radius: 10px;
    }

    .success-message {
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }

    .dashboard-card {
        padding: 2rem 1rem;
    }
}

/* History table */
.table {
    color: var(--text-main);
}
.table td, .table th {
    border-color: var(--border-color);
    background: transparent;
}
.table thead th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}