/* --- Global & Typography -- */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f5f5f7; /* Apple's light gray background */
    color: #1d1d1f; /* Apple's primary text color (dark gray) */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    background: #ffffff;
    padding: 32px;
    border-radius: 18px; /* Softer, more pronounced corners */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    width: 100%;
    max-width: 850px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
    color: #1d1d1f;
}

p {
    margin-top: 0;
    margin-bottom: 24px;
    color: #6e6e73; /* Apple's secondary text color */
    font-size: 1.1rem;
}

.nav-link {
    display: inline-block;
    margin-top: 24px;
    color: #007aff; /* Apple's signature blue */
    text-decoration: none;
    font-weight: 500;
    margin-right: 20px;
    transition: opacity 0.2s ease;
}
.nav-link:hover {
    text-decoration: none;
    opacity: 0.7;
}
.nav-link:last-of-type {
    margin-right: 0;
}

/* --- Forms & Buttons --- */
input[type="text"] {
    width: calc(100% - 24px);
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #d2d2d7; /* Apple's light border color */
    border-radius: 12px;
    font-size: 1rem;
    background-color: #f5f5f7;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

button {
    background-color: #007aff;
    color: white;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.2s ease;
    margin-bottom: 10px;
}
button:hover {
    background-color: #0a84ff;
}
button:active {
    transform: scale(0.97);
}

#clear-log-btn {
    background-color: #ff3b30; /* Apple's destructive red */
}
#clear-log-btn:hover {
    background-color: #ff453a;
}

/* --- Main Layout (Scanner Page) --- */
.main-content { display: flex; flex-direction: column; gap: 32px; }
@media (min-width: 768px) {
    .main-content { flex-direction: row; align-items: flex-start; text-align: left; }
    .scanner-container { flex: 1.2; }
    .recent-scans-container { flex: 1; }
}

#qr-reader {
    width: 100%;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 16px;
}
#scan-result { font-size: 1rem; font-weight: 500; padding: 10px; min-height: 40px; border-radius: 12px; }

/* --- Recent Activity List --- */
.recent-scans-container {
    border: none;
    border-radius: 18px;
    padding: 16px;
    background-color: #f5f5f7;
}
.recent-scans-container h2 { margin-top: 0; text-align: center; padding-bottom: 8px; }

#daily-stats {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 12px;
    margin-bottom: 16px;
    background-color: #e9e9ed;
    border-radius: 12px;
}

#recent-scans-list {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}
#recent-scans-list li {
    padding: 12px 12px 12px 24px; /* Space for the dot */
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}
#recent-scans-list li:last-child { border-bottom: none; }
#recent-scans-list li small { color: #6e6e73; }

/* Colored dots instead of borders */
#recent-scans-list li::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
#recent-scans-list li.login::before { background-color: #34c759; } /* Apple Green */
#recent-scans-list li.logout::before { background-color: #ff9500; } /* Apple Orange */

/* --- Log Page Table --- */
#log-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 24px 0;
}
#log-table th, #log-table td { border-bottom: 1px solid #e5e5e5; padding: 16px; text-align: left; }
#log-table th { background-color: transparent; font-weight: 600; color: #6e6e73; }
#log-table .date-header td {
    background-color: #e9e9ed;
    color: #1d1d1f;
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
}
#log-table tr:last-child td {
    border-bottom: none;
}

/* --- Admin & Register Pages --- */
.admin-container, .register-container { max-width: 600px; }
.admin-section {
    border: none;
    border-radius: 18px;
    padding: 24px;
    margin-top: 32px;
    background-color: #f5f5f7;
}
.admin-section h2 { margin-top: 0; padding-bottom: 8px; margin-bottom: 24px; }

#search-results {
    list-style: none;
    padding: 0;
    margin: -16px 0 16px 0;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    overflow: hidden;
    display: none;
}
#search-results li { padding: 12px; cursor: pointer; border-bottom: 1px solid #e5e5e5; text-align: left; }
#search-results li:hover { background-color: #e9e9ed; }
#search-results li:last-child { border-bottom: none; }

#user-action-panel {
    border: none;
    border-radius: 12px;
    padding: 16px;
    background-color: #e9e9ed;
}

.action-btn { display: block; width: 100%; }
#show-qr-btn { background-color: #8e8e93; } /* Apple Medium Gray */
#show-qr-btn:hover { background-color: #a1a1a6; }

#confirmation-box {
    border: 1px solid #34c759;
    background-color: rgba(52, 199, 89, 0.1);
    padding: 24px;
    border-radius: 12px;
    text-align: left;
}
#confirmation-box h2 { margin-top: 0; color: #34c759; text-align: center; }
#register-again-btn { background-color: #34c759; }
#register-again-btn:hover { background-color: #30d158; }

.error-message {
    color: #ff3b30;
    font-weight: 500;
}