:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

select, input[type="text"], input[type="number"], input[type="password"] {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Attendance Grid Styles */
.attendance-grid-container {
    overflow: auto;
    max-height: calc(100vh - 300px); /* Creates the "panel" effect */
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    position: relative; /* Anchor for sticky children */
    background-color: white;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    min-width: 40px;
}

th {
    background-color: var(--bg-color);
    color: var(--text-secondary);
    font-weight: 600;
}

/* Sticky Columns and Headers */
.sticky-col {
    position: sticky;
    background-color: var(--card-bg) !important;
}

th.sticky-col {
    background-color: #f8fafc !important; /* Slightly different from td for contrast */
}

/* Horizontal Sticky Offsets */
th.sticky-col:nth-child(1), td.sticky-col:nth-child(1) { left: 0; min-width: 50px; z-index: 25; }
th.sticky-col:nth-child(2), td.sticky-col:nth-child(2) { left: 50px; min-width: 70px; z-index: 25; }
th.sticky-col:nth-child(3), td.sticky-col:nth-child(3) { left: 120px; min-width: 200px; z-index: 25; }
th.sticky-col:nth-child(4), td.sticky-col:nth-child(4) { left: 320px; min-width: 80px; z-index: 25; }
th.sticky-col:nth-child(5), td.sticky-col:nth-child(5) { left: 400px; min-width: 120px; z-index: 25; }

/* Vertical Sticky Headers (Relative to the Panel) */
thead tr:nth-child(1) th {
    position: sticky;
    top: 0; /* Locked to the top of the div panel */
    z-index: 50;
    background-color: #f8fafc;
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);
}

thead tr:nth-child(1) th.sticky-col {
    z-index: 60;
}

thead tr:nth-child(2) th {
    position: sticky;
    top: 40px; /* Below the first header row within the panel */
    z-index: 45;
    background-color: #f8fafc;
    box-shadow: 0 2px 2px -1px rgba(0,0,0,0.1);
}

/* Total Column and Header also usually need to be sticky or at least have correct z-index */
#totalHeader, .row-total {
    background-color: #f1f5f9;
}

/* Quick Shift Select Styling */
.quick-shift-select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background-color: #f9fafb;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.quick-shift-select:hover {
    border-color: var(--primary);
    background-color: white;
}

.quick-shift-select:focus {
    outline: none;
    ring: 2px solid var(--primary);
    border-color: var(--primary);
}

.nav-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.shift-cell {
    padding: 0;
    cursor: pointer;
}

.shift-cell:hover,
.shift-cell:focus-within {
    background-color: #dbeafe !important; /* Light blue highlight */
}

.summary-card {
    padding: 1rem 1.5rem;
    border-radius: 1rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 180px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.summary-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.summary-count {
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-icon {
    font-size: 2rem;
    opacity: 0.5;
}

/* Dropdown Container */
.dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    font-size: 0.75rem;
}

.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: var(--shadow);
    max-height: 250px;
    overflow-y: auto;
    z-index: 2000;
    display: none;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--bg-color);
}

.dropdown-item.active {
    background-color: var(--primary);
    color: white;
}

.dropdown-item mark {
    background-color: #fef08a; /* Yellow highlight */
    color: #854d0e;
    border-radius: 2px;
}

.toast-visible {
    display: block !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(1rem); }
    to { opacity: 1; transform: translateY(0); }
}
