/* Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--surface-color);
    color: var(--surface-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background-color: var(--secondary-color);
    color: white;
}

.nav-btn.primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.nav-btn.primary:hover {
    background-color: var(--primary-hover);
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 2rem;
}

.container {
    width: 100%;
    max-width: 600px;
}

/* Clock Section */
.clock-container {
    text-align: center;
    margin-bottom: 2rem;
}

.time {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -2px;
    font-variant-numeric: tabular-nums;
}

.date {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-top: -0.5rem;
}

/* Check-in Card */
.card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: transform 0.3s ease;
}

.card h2 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

input[type="text"] {
    width: 100%;
    padding: 1rem;
    font-size: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color 0.2s;
    text-align: center;
    letter-spacing: 1px;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
}

.btn-large {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-large:hover {
    background-color: var(--primary-hover);
}

.btn-large:active {
    transform: scale(0.98);
}

/* Status Messages */
.status-msg {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 500;
    display: none;
}

.status-msg.success {
    background-color: #d1fae5;
    color: #065f46;
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.status-msg.error {
    background-color: #fee2e2;
    color: #991b1b;
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* Admin Dashboard */
.dashboard-view {
    display: none;
    width: 100%;
    max-width: 1000px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.table-container {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #fff7ed;
    color: #c2410c;
}

.badge.check-in {
    background-color: #dcfce7;
    color: #166534;
}

.badge.late {
    background-color: #fee2e2;
    color: #991b1b;
}

.late-reason {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-style: italic;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.modal-content input {
    margin-bottom: 1.5rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-weight: 600;
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--secondary-color);
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #f1f5f9;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#dateFilter {
    cursor: text;
    font-family: inherit;
    color: var(--secondary-color);
    outline: none;
}

#dateFilter:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.search-container {
    margin-left: auto;
    /* Push to right */
}

.search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    outline: none;
    font-size: 0.875rem;
    width: 200px;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .time {
        font-size: 3rem;
    }

    .card {
        padding: 1.5rem;
    }

    header {
        padding: 1rem;
    }

    .table-container {
        border-radius: 0;
        box-shadow: none;
    }

    th,
    td {
        padding: 0.75rem 1rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-small {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-small.danger {
    background-color: #fee2e2;
    color: #ef4444;
}

.btn-small.danger:hover {
    background-color: #fca5a5;
    color: #b91c1c;
}