/* Modern QR Scanner Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1f3a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1rem;
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-sizing: border-box;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.stat-item {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Scanner */
.scanner-container {
    position: relative;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

/* Scanner Section */
.scanner-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
    overflow: hidden;
    border-radius: 24px;
    background: #000;
    position: relative;
    height: 60vh;
    max-height: 520px;
    min-height: 360px;
}

#reader {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

#reader video {
    object-fit: cover;
    border-radius: 24px;
}

#reader > div {
    height: 100% !important;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.scan-frame {
    width: 220px;
    height: 220px;
    border: 3px solid var(--primary);
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.scan-instruction {
    margin-top: 1.2rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

/* Actions */
.actions {
    margin: 0.35rem 0 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.btn-back:hover {
    color: var(--text-primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

.modal-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
}

.modal-icon.success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
}

.modal-icon.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
}

.modal-icon.error {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: white;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-details {
    margin-top: 0.5rem;
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.modal-detail-label {
    color: var(--text-secondary);
}

.modal-detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-body strong {
    color: var(--text-primary);
    display: block;
    margin-top: 0.5rem;
}

/* Search Page */
.search-box {
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem 1rem;
}

.search-hint {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

.visitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    gap: 1rem;
}

.visitor-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.visitor-info h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.visitor-info p,
.visitor-id {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.visitor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.visitor-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    display: inline-block;
}

.visitor-badge.checked-in {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.visitor-badge.not-checked-in {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

/* Stats */
.stats-container {
    margin-top: auto;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding: 0.5rem 0 0.25rem;
}

.stats-container .stat-row {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    align-items: baseline;
}

.stats-container .stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.scanner-status {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    min-height: 1.2em;
    margin-bottom: 0.4rem;
}

.scanner-status.error {
    color: var(--error);
}

.scanner-status.success {
    color: var(--success);
}

/* Responsive */
@media (max-width: 640px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .stats {
        flex-direction: column;
    }

    .scan-frame {
        width: 180px;
        height: 180px;
    }

    .scanner-section {
        height: 60vh;
        max-height: 460px;
        min-height: 320px;
    }
}
