* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Login Page Styles */
.login-container {
    width: 100%;
    max-width: 450px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.logo h1 {
    color: #667eea;
    font-size: 32px;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-size: 14px;
}

.auth-step {
    display: none;
}

.auth-step.active {
    display: block;
}

.auth-step h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.info-text {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.message.show {
    display: block;
}

.message.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.message.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.message.info {
    background: #eef;
    color: #33c;
    border: 1px solid #ccf;
}

/* Scanner Page Styles */
body.scanner-page {
    background: #f5f5f5;
    padding: 0;
}

.scanner-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.scanner-header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left h1 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 5px;
}

.scanner-user {
    color: #666;
    font-size: 14px;
}

.btn-logout {
    background: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.scanner-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.scanner-box {
    position: relative;
    margin-bottom: 20px;
}

#reader {
    border: 3px solid #667eea;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

#reader.scanner-paused {
    opacity: 0.3;
    filter: grayscale(80%);
    pointer-events: none;
}

.scanner-box.scanner-paused {
    position: relative;
}

.scanner-box.scanner-paused::after {
    content: '⏸️ Scanner Paused';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: none;
}

.scanner-status {
    text-align: center;
    padding: 20px;
}

.status-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

#scanner-message {
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

.scan-result {
    display: none;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 16px;
    animation: slideIn 0.3s ease;
}

.scan-result.show {
    display: block;
}

.scan-result.success {
    background: #4caf50;
    color: white;
}

.scan-result.error {
    background: #f44336;
    color: white;
}

.scan-result .result-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.scan-result .result-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.scan-result .result-details {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 10px;
}

/* Person Count Selector Styles */
.person-selector {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 25px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: slideIn 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

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

.person-selector-title {
    margin-bottom: 10px;
}

.valid-indicator {
    background: #4caf50;
    color: white;
    font-size: 20px;
    font-weight: bold;
    padding: 12px 24px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.person-selector-header h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 5px;
}

.person-selector-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
}

.person-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.person-btn {
    background: white;
    border: 3px solid transparent;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.person-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
    background: linear-gradient(135deg, #f5f7ff 0%, #e8ebff 100%);
}

.person-btn:active {
    transform: translateY(-2px);
}

.person-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.person-number {
    font-size: 28px;
    font-weight: bold;
    color: #667eea;
}

/* Responsive design for person buttons */
@media (max-width: 600px) {
    .person-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .person-btn {
        padding: 15px;
        min-height: 80px;
    }
    
    .person-icon {
        font-size: 24px;
    }
    
    .person-number {
        font-size: 24px;
    }
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.stat-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
    min-width: 0; /* Fix for grid overflow */
}

.stat-number {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.recent-scans {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.recent-scans h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.logout-section {
    text-align: center;
    margin-top: 50px;
}

#recent-scans-list {
    max-height: 300px;
    overflow-y: auto;
}

.scan-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-left: 4px solid #667eea;
    background: #f9f9f9;
    margin-bottom: 10px;
    border-radius: 4px;
    align-items: flex-start;
}

.scan-item.rejected {
    border-left-color: #f44336;
}

.scan-icon {
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.scan-content {
    flex: 1;
    min-width: 0;
}

.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.scan-title {
    font-weight: bold;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.person-badge {
    display: inline-flex;
    align-items: center;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.scan-time {
    color: #666;
    font-size: 12px;
    white-space: nowrap;
}

.scan-code {
    font-size: 11px;
    color: #999;
    font-family: 'Courier New', monospace;
    margin-top: 4px;
    word-break: break-all;
}

.scan-message {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .scanner-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-right {
        margin-top: 10px;
        width: 100%;
    }
    
    .btn-logout {
        width: 100%;
    }
    
    .stats-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 12px;
    }
    
    .stat-box {
        padding: 15px;
    }
    
    .stat-number {
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
    }
}

