  /* --- Base Styles --- */
  body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    padding: 15px;
    box-sizing: border-box;
}

.checkin-container {
    width: 100%;
    max-width: 600px;
    margin: 30px auto;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
}

.logo {
    width: 80px;
    height: 80px;
    display: block;
    margin: 0 auto 15px;
    background: #f0f0f0;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid #ccc;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Profile Upload */
#profileUploadContainer {
    text-align: center;
    margin-bottom: 15px;
}

#profileUploadContainer label {
    cursor: pointer;
    color: #ff6200;
    text-decoration: underline;
    font-size: 0.9em;
}

#profileUploadInput {
    display: none;
}

h1 {
    text-align: center;
    color: #333;
    margin-top: 0;
    margin-bottom: 15px;
    font-family: Arial, sans-serif;
    font-size: 1.8rem;
}

h2 {
    text-align: center;
    color: #444;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.3rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.login-links {
    text-align: center;
    margin-bottom: 20px;
    color: #555;
    font-size: 0.9rem;
}

.login-links a {
    color: #ff6200;
    text-decoration: none;
    margin: 0 10px;
}

.login-links a:hover {
    text-decoration: underline;
}

.user-info {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.5;
}

#userName {
    font-weight: bold;
    font-size: 1.1rem;
}

#currentTime {
    font-size: 1rem;
    color: #666;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-logout {
    display: block; /* Stack buttons vertically */
    width: 100%;
    max-width: 300px; /* Control max width */
    margin: 10px auto; /* Center buttons */
    padding: 12px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease, opacity 0.2s ease;
    box-sizing: border-box;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-logout:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #ccc !important;
    color: #666 !important;
}

.btn-primary {
    background: #ff6200;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #e55a00;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-logout {
    background: #dc3545;
    color: white;
    margin-top: 30px;
}

.btn-logout:hover:not(:disabled) {
    background: #c82333;
}

.status-container {
    text-align: center;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* QR Section */
.qr-section {
    margin: 30px 0;
    text-align: center;
}

.qr-section h2 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.qr-section p {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 15px;
}

#qrScanner { /* Scanner video container */
    margin-top: 15px;
    position: relative;
}

#qrVideo {
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%;
    max-width: 350px;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
    background-color: #eee; /* Placeholder background */
}

#stopScanBtn {
    margin-top: 5px;
}

/* Status Messages */
.status-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    font-size: 0.95rem;
    text-align: center;
    word-wrap: break-word;
    border: 1px solid transparent;
    min-height: 1.5em; /* Ensure it doesn't collapse */
}
/* Specific status colors */
.status-info { background: #e0f7fa; color: #006064; border-color: #b3e5fc; }
.status-processing { background: #fff9c4; color: #f57f17; border-color: #fff176; }
.status-verified { background: #c8e6c9; color: #1b5e20; border-color: #a5d6a7; }
.status-success { background: #e8f5e9; color: #1b5e20; border-color: #c8e6c9; }
.status-checked_out { background: #e3f2fd; color: #0d47a1; border-color: #bbdefb; }
.status-error { background: #ffebee; color: #b71c1c; border-color: #ffcdd2; }
.status-warning { background: #fff3e0; color: #e65100; border-color: #ffe0b2; }
.status-late { background: #ffccbc; color: #d84315; border-color: #ffab91; }

/* History Table Status Text Colors */
.status-ontime-text { color: #1b5e20; font-weight: bold; }
.status-late-text { color: #d84315; font-weight: bold; }

/* Attendance History Table */
.attendance-history { margin-top: 30px; }
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 450px;
    background-color: #fff;
}
th, td {
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 0.9rem;
    white-space: nowrap;
    vertical-align: middle;
}
th {
    background: #f8f9fa;
    font-weight: bold;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 1;
}
tbody tr:nth-child(even) { background-color: #fdfdfd; }
tbody tr:last-child td { border-bottom: none; }

/* Helper class */
.hidden { display: none !important; }

/* Media Queries */
@media (min-width: 577px) {
     /* Styles for larger screens, if any specific needed */
    .btn-logout { max-width: 200px; }
    th, td { white-space: normal; }
} /* Corrected closing brace */

@media (max-width: 576px) {
    body { padding: 10px; }
    .checkin-container { margin: 15px auto; padding: 15px; }
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.2rem; }
    .logo { width: 70px; height: 70px; }
    .btn-primary, .btn-secondary, .btn-logout {
         padding: 10px 15px;
         font-size: 0.95rem;
         display: block; /* Ensure stacking */
         width: 100%;
         max-width: 300px;
         margin: 10px auto;
    }
    th, td { padding: 8px 10px; font-size: 0.85rem; white-space: nowrap; }
    table { min-width: 400px; }
    #qrVideo { max-width: 100%; }
}

/* Focus Styles & Scrollbar */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid #005fcc; outline-offset: 2px;
}
.table-container::-webkit-scrollbar { height: 8px; background-color: #f5f5f5; }
.table-container::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 4px; }
.table-container::-webkit-scrollbar-thumb:hover { background-color: #bbb; }
/* Ensure these styles are present */
.hidden {
    display: none !important;
}

#qrScanner {
    text-align: center;
    margin: 20px 0;
    border: 1px solid #ccc; /* Optional: Add border to visualize */
    position: relative; /* Needed for potential overlays */
}

#qrVideo {
    display: block; /* Prevent extra space below video */
    width: 100%;
    max-width: 400px;
    margin: 0 auto; /* Center video */
    background: #eee; /* Placeholder background */
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
}
 .btn-secondary:hover {
    background: #5a6268;
 }

.status-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    text-align: center;
}

/* Added text-align */
.status-info {
    background: #e7f3fe;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Added borders */
.status-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-processing {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.status-verified {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.status-checked_out {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-late {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Added warning style */

/* Added styles for check-in/out buttons */
#checkInBtn,
#checkOutBtn {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    margin: 10px 5px;
    cursor: pointer;
    min-width: 180px;
    /* Give buttons a minimum width */
    transition: background-color 0.2s ease;
}
 #checkInBtn:hover,
#checkOutBtn:hover {
     background-color: #0056b3;
}

#checkInBtn:disabled,
#checkOutBtn:disabled {
    background: #6c757d;
    /* Grey out disabled buttons */
    cursor: not-allowed;
}

/* Status text colors for table */
.status-ontime-text {
    color: #28a745;
    font-weight: bold;
}

.status-late-text {
    color: #dc3545;
    font-weight: bold;
}

/* Profile Upload Link Style */
#profileUploadContainer label {
    display: inline-block;
    /* Or block */
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    margin-bottom: 5px;
}
 #profileUploadContainer label:hover {
     color: #0056b3;
 }

#profileUploadInput {
    display: none;
    /* Hide the actual file input */
}

#uploadStatus {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
}