:root {
    --primary-color: #007AFF;
    --occupied-color: #FF3B30;
    --vacant-color: #34C759;
    --background-color: #F2F2F7;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: #000;
    line-height: 1.5;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

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

h1 {
    font-size: 24px;
    font-weight: 600;
}

#main-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #4CAF50; /* Default green background */
}

#main-screen.occupied {
    background-color: #f44336; /* Red background when occupied */
}

#scanner-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 20px;
    background-color: #000;
}

#reader {
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1;
}

#status-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #ddd;
    z-index: 2;
}

#status-display {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #ddd;
}

#current-student {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
}

#timer {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

#status-message {
    font-size: 18px;
    text-align: center;
    color: #666;
}

#records {
    flex: 2;
    padding: 20px;
    overflow-y: auto;
    max-height: 200px;
}

#records h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

#records-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.record {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    min-width: 200px;
}

.record-header {
    font-weight: bold;
    margin-bottom: 5px;
}

.record-details {
    font-size: 14px;
    color: #666;
}

.student-records {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.student-records h2 {
    font-size: 18px;
    margin-bottom: 15px;
}

.restroom-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.restroom {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.restroom h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.status {
    padding: 10px;
    border-radius: 5px;
    color: white;
    text-align: center;
    margin-bottom: 10px;
}

.status.occupied {
    background-color: var(--occupied-color);
}

.status.vacant {
    background-color: var(--vacant-color);
}

.add-button {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
}

.add-button:active {
    opacity: 0.8;
}

.admin-controls {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
}

.student-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.student-edit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
    margin-bottom: 10px;
}

.student-id {
    min-width: 100px;
    font-weight: bold;
}

.student-name-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.update-name-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.update-name-btn:hover {
    background: #45a049;
}

.export-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.export-section h3 {
    margin-bottom: 15px;
}

.export-section input[type="email"] {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.export-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.export-btn:hover {
    background: #1976D2;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-top: 0;
    color: #333;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.modal-buttons button:first-child {
    background-color: #dc3545;
    color: white;
}

.modal-buttons button:last-child {
    background-color: #6c757d;
    color: white;
}

.modal-buttons button:hover {
    opacity: 0.9;
}

.setup-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
}

.setup-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 500px;
    width: 100%;
}

.setup-content p {
    margin-bottom: 20px;
    font-size: 1.2em;
    color: #333;
}

#setup-scanner {
    width: 100%;
    height: 300px;
    margin: 20px 0;
    background-color: #000;
    border-radius: 10px;
    overflow: hidden;
}

#setup-message {
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    background: #f8f9fa;
    color: #333;
}

.interactive {
    position: relative;
    width: 100%;
    height: 100%;
}

#reader, #setup-scanner {
    width: 100%;
    height: 300px;
    position: relative;
    overflow: hidden;
}

#reader video, #setup-scanner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#reader canvas, #setup-scanner canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.drawingBuffer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

h3 {
    color: #333;
    margin: 0 0 15px 0;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.close-admin-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-admin-btn:hover {
    background: #f0f0f0;
    color: #333;
}

#admin-controls {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
}

/* Add overlay background when admin mode is active */
#admin-controls[style*="display: block"] ~ .overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
} 