/**
 * Driver's License Scanner - Styles
 * Clean, functional, responsive design
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, rgba(139, 13, 18, 0.12) 0%, rgba(232, 27, 35, 0.15) 100%),
                linear-gradient(to bottom, var(--gray-50) 0%, var(--gray-200) 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 84px; /* 80px + 4px for patriotic stripe */
    color: var(--gray-800);
}

/* Navigation Bar */
.navbar {
    position: fixed;
    top: 4px; /* below patriotic stripe */
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--gop-red-dark) 0%, var(--gop-red-darkest) 100%);
    color: white;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-bottom: 3px solid var(--gold);
}

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

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    font-size: var(--font-size-lg);
    font-weight: 600;
    transition: background 0.2s, border-bottom 0.2s;
    border-bottom: 2px solid transparent;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 4px solid var(--gold);
}

.nav-links a.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 700;
    border-bottom: 4px solid var(--gold);
}

.nav-mode-switch {
    background: rgba(0, 40, 104, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-mode-switch:hover {
    background: rgba(0, 40, 104, 0.7) !important;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--gop-red-dark) 0%, var(--gop-red-darkest) 100%);
    color: white;
    padding: 40px;
    text-align: center;
    border-bottom: 4px solid var(--gop-navy);
    position: relative;
    overflow: hidden;
}

header::after {
    content: '\2605';
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8rem;
    opacity: 0.06;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 800;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Sections */
section {
    padding: 30px 40px;
    border-bottom: 1px solid var(--gray-200);
}

section:last-of-type {
    border-bottom: none;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--gop-navy);
    font-weight: 700;
    border-bottom: 3px solid var(--gop-red);
    padding-bottom: 10px;
    display: inline-block;
}

/* Session Control */
.session-control {
    background: linear-gradient(to right, var(--gray-50) 0%, #fff 50%, var(--gray-50) 100%);
    border-left: 5px solid var(--gop-red);
    border-right: 5px solid var(--gop-navy);
}

.session-status {
    text-align: center;
    margin-bottom: 20px;
}

.status-badge {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-badge.active {
    background: var(--gop-red);
    color: white;
    border: 2px solid var(--gop-navy);
}

.status-badge.inactive {
    background: var(--gray-500);
    color: white;
}

/* Live Attendee Counter */
.live-counter {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, var(--gop-navy) 0%, var(--gop-navy-dark) 100%);
    border-radius: 12px;
    border: 3px solid var(--gop-red);
    box-shadow: 0 4px 20px rgba(0, 40, 104, 0.3);
}

.counter-label {
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.counter-value {
    font-size: 4rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Courier New', monospace;
    transition: transform 0.2s ease;
}

/* Animation for count change */
.counter-value.pulse {
    animation: counterPulse 0.4s ease-out;
}

@keyframes counterPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: var(--success); }
    100% { transform: scale(1); }
}

/* Smaller swipe-count animation */
.swipe-count.updated {
    animation: swipeCountPulse 0.3s ease-out;
}

.session-id-display {
    text-align: center;
    margin-bottom: 20px;
}

.session-id-display label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin-bottom: 5px;
}

.session-id {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gop-red);
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
}

.session-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 14px 32px;
    border: none;
    border-radius: 4px;
    font-size: var(--font-size-lg);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-height: 48px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-primary {
    background: var(--gop-red);
    color: white;
    box-shadow: 0 2px 4px rgba(232, 27, 35, 0.3);
}

.btn-primary:hover {
    background: var(--gop-red-dark);
}

.btn-secondary {
    background: var(--gop-red-darkest);
    color: white;
}

.btn-secondary:hover {
    background: var(--gop-red-dark);
}

.btn-success {
    background: var(--gop-navy);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 40, 104, 0.3);
}

.btn-success:hover {
    background: var(--gop-navy-dark);
}

.btn-success:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-clear {
    background: var(--gray-500);
    color: white;
    padding: 12px 20px;
}

.btn-clear:hover {
    background: var(--gray-600);
}

/* Swipe Input */
.swipe-input {
    background: #fefefe;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.swipe-field {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: 'Courier New', monospace;
}

.swipe-field:focus {
    border-color: var(--gop-navy);
    box-shadow: var(--focus-ring);
}

.swipe-feedback {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-weight: 500;
}

.swipe-feedback.success {
    background: var(--success-light);
    color: var(--success-dark);
    border: 1px solid var(--success);
}

.swipe-feedback.error {
    background: var(--danger-light);
    color: var(--danger-dark);
    border: 1px solid var(--danger);
}

.swipe-feedback.warning {
    background: var(--warning-light);
    color: var(--warning-dark);
    border: 1px solid var(--warning);
}

.last-swipe {
    padding: 15px;
    background: var(--gray-100);
    border-radius: 6px;
    color: var(--gray-700);
    font-size: 0.95rem;
}

.last-swipe strong {
    color: var(--gray-900);
}

/* Last Swipe Container with Undo Button */
.last-swipe-container {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.last-swipe-container .last-swipe {
    flex: 1;
    min-width: 200px;
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 12px 24px;
    font-size: var(--font-size-sm);
    min-height: 44px;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-danger:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
}

@keyframes swipeCountPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); background: var(--success); }
    100% { transform: scale(1); background: var(--gop-red); }
}

/* Swipes List */
.swipes-list {
    background: #fefefe;
}

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

.swipe-count {
    background: var(--gop-red);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

.swipe-count span {
    font-size: 1.2rem;
}

.table-container {
    overflow-x: auto;
}

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

thead {
    background: linear-gradient(135deg, var(--gop-navy) 0%, var(--gop-navy-dark) 100%);
}

th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    color: white;
    border-bottom: 3px solid var(--gop-red);
    text-transform: uppercase;
    font-size: var(--font-size-sm);
    letter-spacing: 0.5px;
}

td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}

tbody tr:nth-child(even) {
    background: var(--gray-50);
}

tbody tr:hover {
    background: var(--gop-blue-tint);
    border-left: 3px solid var(--gop-red);
}

.no-data {
    text-align: center;
    color: var(--gray-600);
    font-style: italic;
    padding: 40px !important;
}

/* Export Section */
.export-section {
    text-align: center;
    background: linear-gradient(to right, var(--gray-50) 0%, #fff 50%, var(--gray-50) 100%);
    border-left: 5px solid var(--gop-red);
    border-right: 5px solid var(--gop-navy);
}

.export-section p {
    margin-bottom: 20px;
    color: var(--gray-600);
}

/* Session Lookup Section */
.session-lookup {
    padding: 40px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(to right, var(--gray-50) 0%, #fff 50%, var(--gray-50) 100%);
    border-left: 5px solid var(--gop-red);
    border-right: 5px solid var(--gop-navy);
}

.session-lookup h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--gop-navy);
    font-weight: 700;
    border-bottom: 3px solid var(--gop-red);
    padding-bottom: 10px;
    display: inline-block;
}

.session-lookup p {
    color: var(--gray-600);
    margin-bottom: 20px;
    font-size: var(--font-size-sm);
}

.lookup-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: stretch;
}

.session-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    transition: border-color 0.3s ease;
}

.session-input:focus {
    border-color: var(--gop-navy);
    box-shadow: var(--focus-ring);
}

.lookup-info-card {
    background: white;
    border: 2px solid var(--gop-navy);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-200);
}

.info-row:last-of-type {
    border-bottom: none;
    margin-bottom: 15px;
}

.info-label {
    font-weight: 600;
    color: var(--gray-600);
}

.info-value {
    color: var(--gray-900);
    font-family: 'Courier New', monospace;
}

.status-active {
    color: var(--gop-red) !important;
    font-weight: 700;
}

.status-closed {
    color: var(--gray-600) !important;
}

/* Lookup buttons container */
.lookup-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.lookup-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* Footer */
footer {
    padding: 20px 40px;
    text-align: center;
    background: linear-gradient(135deg, var(--gop-navy) 0%, var(--gop-navy-dark) 100%);
    color: #ffffff;
    font-size: var(--font-size-sm);
    border-top: 3px solid var(--gop-red);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--gop-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    section {
        padding: 20px;
    }

    .session-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .input-group {
        flex-direction: column;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    table {
        font-size: var(--font-size-sm);
    }

    th, td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: var(--font-size-sm);
    }

    .session-id {
        font-size: 1.5rem;
    }

    table {
        font-size: var(--font-size-sm);
    }

    th, td {
        padding: 10px 8px;
    }
}
