/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: #000;
    min-height: 100vh;
    color: #fff;
    overflow: hidden;
    position: relative;
}

/* Password Overlay */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.password-container {
    background: #111;
    padding: 40px;
    border-radius: 10px;
    border: 2px solid #333;
    text-align: center;
    max-width: 300px;
    width: 90%;
}

.password-container h2 {
    margin: 0 0 20px 0;
    color: #fff;
    font-size: 24px;
}

#password-input {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    background: #222;
    border: 1px solid #555;
    border-radius: 5px;
    color: #fff;
    margin-bottom: 15px;
    text-align: center;
}

#password-input:focus {
    outline: none;
    border-color: #fff;
}

#password-submit {
    background: #fff;
    color: #000;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

#password-submit:hover {
    background: #f0f0f0;
}

.password-error {
    color: #ff4444;
    margin-top: 15px;
    font-size: 14px;
}

/* Camera container */
.camera-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Camera overlay for stopped state */
.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 50;
}


/* Scan button */
.scan-button {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 124px;
    background: #fff;
    border: none;
    border-top: 2px solid #000;
    color: #000;
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.scan-button:hover {
    background: #f0f0f0;
}

.scan-button:active {
    background: #e0e0e0;
}

/* Disabled button state */
.scan-button.disabled,
.scan-button:disabled {
    background: #cccccc;
    color: #888888;
    cursor: not-allowed;
    opacity: 0.7;
}

.scan-button.disabled:hover,
.scan-button:disabled:hover {
    background: #cccccc;
    transform: none;
}

#button-text {
    display: block;
    text-align: center;
    line-height: 124px;
}

/* Scan Result Display */
.scan-result {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - 124px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.scan-result.valid {
    background: #00aa00;
}

.scan-result.invalid {
    background: #aa0000;
}

.result-content {
    text-align: center;
    color: #fff;
}

.person-id-display {
    font-size: 48px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    margin-bottom: 20px;
}

.person-name-display {
    font-size: 20px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    opacity: 0.9;
}

/* Attendance Counter */
.attendance-counter {
    position: fixed;
    bottom: 124px; /* Above the scan button */
    left: 0;
    right: 0;
    width: 100vw;
    background: #000;
    text-align: center;
    z-index: 15; /* Higher than scan button */
    padding: 10px 0;
}

.attendance-number {
    font-size: 48px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: #fff;
}

/* Scanning state */
body.scanning .camera-container {
    z-index: 5;
}

body.scanning .scan-button {
    background: #ff6b6b;
    border-top-color: #ff4444;
    color: #fff;
}

body.scanning .scan-button:hover {
    background: #ff5252;
}

/* Scanning animation for better visual feedback */
@keyframes scanningPulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

body.scanning #camera-status {
    animation: scanningPulse 1.5s infinite ease-in-out;
    background: rgba(255, 107, 107, 0.8) !important;
    font-weight: bold;
}

/* Add scan focus area to help users position QR codes */
body.scanning::after {
    content: '';
    position: fixed;
    top: calc(50% - 62px); /* Adjust for half of scan button height (124px/2) */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70vw;
    height: 70vw;
    max-width: 300px;
    max-height: 300px;
    border: 2px dashed rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    z-index: 6;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

