/* ---- Theme Variables ---- */  
:root {  
    --bg-primary: #f8f9fb;  
    --bg-secondary: #ffffff;  
    --bg-card: #ffffff;  
    --text-primary: #1a1d23;  
    --text-secondary: #5a6170;  
    --border: #e2e5eb;  
    --accent: #0066cc;  
    --accent-hover: #0052a3;  
    --accent-light: #e6f0fa;  
    --success: #1a8754;  
    --success-light: #e8f5ef;  
    --danger: #cc3340;  
    --danger-light: #fce8ea;  
    --warning: #cc7a00;  
    --warning-light: #fff3e0;  
    --tag-floors: #0066cc;  
    --tag-elective: #7c3aed;  
    --tag-nights: #475569;  
    --tag-call: #b45309;  
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);  
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);  
    --radius: 8px;  
}

@media (prefers-color-scheme: dark) {  
    :root {  
        --bg-primary: #0f1117;  
        --bg-secondary: #1a1d27;  
        --bg-card: #1e2130;  
        --text-primary: #e4e6ec;  
        --text-secondary: #9498a5;  
        --border: #2e3240;  
        --accent: #4d9ef7;  
        --accent-hover: #6db3ff;  
        --accent-light: #1a2a42;  
        --success: #34d399;  
        --success-light: #132e24;  
        --danger: #f87171;  
        --danger-light: #3b1c1c;  
        --warning: #fbbf24;  
        --warning-light: #3b2e10;  
        --tag-floors: #4d9ef7;  
        --tag-elective: #a78bfa;  
        --tag-nights: #94a3b8;  
        --tag-call: #fbbf24;  
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);  
        --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);  
    }  
}

/* ---- Reset & Base ---- */  
* {  
    margin: 0;  
    padding: 0;  
    box-sizing: border-box;  
}

body {  
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;  
    background: var(--bg-primary);  
    color: var(--text-primary);  
    line-height: 1.6;  
}

/* ---- Navigation ---- */  
nav {  
    background: var(--bg-secondary);  
    border-bottom: 1px solid var(--border);  
    padding: 0 2rem;  
    display: flex;  
    align-items: center;  
    justify-content: space-between;  
    height: 56px;  
    position: sticky;  
    top: 0;  
    z-index: 100;  
}

.nav-brand {  
    font-weight: 700;  
    font-size: 1.1rem;  
    color: var(--accent);  
    text-decoration: none;  
}

.nav-links {  
    display: flex;  
    gap: 0.25rem;  
}

.nav-links a {  
    color: var(--text-secondary);  
    text-decoration: none;  
    padding: 0.5rem 1rem;  
    border-radius: var(--radius);  
    font-size: 0.9rem;  
    transition: all 0.15s;  
}

.nav-links a:hover,  
.nav-links a.active {  
    color: var(--accent);  
    background: var(--accent-light);  
}

/* ---- Layout ---- */  
.container {  
    max-width: 1100px;  
    margin: 2rem auto;  
    padding: 0 1.5rem;  
}

.page-title {  
    font-size: 1.5rem;  
    font-weight: 700;  
    margin-bottom: 1.5rem;  
}

/* ---- Cards ---- */  
.card {  
    background: var(--bg-card);  
    border: 1px solid var(--border);  
    border-radius: var(--radius);  
    padding: 1.5rem;  
    margin-bottom: 1.5rem;  
    box-shadow: var(--shadow);  
}

.card-title {  
    font-size: 1.1rem;  
    font-weight: 600;  
    margin-bottom: 1rem;  
    color: var(--text-primary);  
}

/* ---- Filter Bar ---- */  
.filters {  
    display: flex;  
    gap: 0.75rem;  
    flex-wrap: wrap;  
    margin-bottom: 1.5rem;  
    align-items: end;  
}

.filter-group {  
    display: flex;  
    flex-direction: column;  
    gap: 0.25rem;  
}

.filter-group label {  
    font-size: 0.75rem;  
    font-weight: 600;  
    color: var(--text-secondary);  
    text-transform: uppercase;  
    letter-spacing: 0.05em;  
}

/* ---- Forms ---- */  
input, select {  
    padding: 0.5rem 0.75rem;  
    border: 1px solid var(--border);  
    border-radius: var(--radius);  
    background: var(--bg-secondary);  
    color: var(--text-primary);  
    font-size: 0.9rem;  
    outline: none;  
    transition: border 0.15s;  
}

input:focus, select:focus {  
    border-color: var(--accent);  
}

/* ---- Buttons ---- */  
.btn {  
    padding: 0.5rem 1rem;  
    border: none;  
    border-radius: var(--radius);  
    font-size: 0.85rem;  
    font-weight: 600;  
    cursor: pointer;  
    transition: all 0.15s;  
    display: inline-flex;  
    align-items: center;  
    gap: 0.4rem;  
}

.btn-primary {  
    background: var(--accent);  
    color: white;  
}

.btn-primary:hover {  
    background: var(--accent-hover);  
}

.btn-success {  
    background: var(--success);  
    color: white;  
}

.btn-danger {  
    background: var(--danger);  
    color: white;  
}

.btn-outline {  
    background: transparent;  
    border: 1px solid var(--border);  
    color: var(--text-primary);  
}

.btn-outline:hover {  
    border-color: var(--accent);  
    color: var(--accent);  
}

.btn-sm {  
    padding: 0.3rem 0.6rem;  
    font-size: 0.8rem;  
}

/* ---- Tables ---- */  
table {  
    width: 100%;  
    border-collapse: collapse;  
}

th {  
    text-align: left;  
    padding: 0.6rem 0.75rem;  
    font-size: 0.75rem;  
    font-weight: 600;  
    color: var(--text-secondary);  
    text-transform: uppercase;  
    letter-spacing: 0.05em;  
    border-bottom: 2px solid var(--border);  
}

td {  
    padding: 0.75rem;  
    border-bottom: 1px solid var(--border);  
    font-size: 0.9rem;  
}

tr:hover {  
    background: var(--accent-light);  
}

/* ---- Tags ---- */  
.tag {  
    display: inline-block;  
    padding: 0.15rem 0.5rem;  
    border-radius: 99px;  
    font-size: 0.75rem;  
    font-weight: 600;  
}

.tag-floors { background: var(--accent-light); color: var(--tag-floors); }  
.tag-elective { background: #f3f0ff; color: var(--tag-elective); }  
.tag-nights { background: #f1f5f9; color: var(--tag-nights); }  
.tag-call { background: var(--warning-light); color: var(--tag-call); }  
.tag-default { background: var(--accent-light); color: var(--accent); }

@media (prefers-color-scheme: dark) {  
    .tag-elective { background: #2a2040; }  
    .tag-nights { background: #1e2530; }  
}

.tag-year {  
    background: var(--accent-light);  
    color: var(--accent);  
}

/* ---- Alerts ---- */  
.alert {  
    padding: 0.75rem 1rem;  
    border-radius: var(--radius);  
    font-size: 0.9rem;  
    margin-bottom: 1rem;  
}

.alert-success { background: var(--success-light); color: var(--success); }  
.alert-danger { background: var(--danger-light); color: var(--danger); }  
.alert-warning { background: var(--warning-light); color: var(--warning); }

/* ---- Calendar Links ---- */  
.calendar-link-box {  
    background: var(--bg-secondary);  
    border: 1px solid var(--border);  
    border-radius: var(--radius);  
    padding: 1rem;  
    margin-top: 0.75rem;  
    word-break: break-all;  
    font-family: monospace;  
    font-size: 0.85rem;  
    color: var(--text-secondary);  
}

/* ---- Empty State ---- */  
.empty-state {  
    text-align: center;  
    padding: 3rem 1rem;  
    color: var(--text-secondary);  
}

/* ---- Swap Planner ---- */  
.shift-selected {  
    background: var(--accent-light) !important;  
    outline: 2px solid var(--accent);  
}

.pick-btn {  
    opacity: 0.6;  
    transition: opacity 0.15s;  
}

tr:hover .pick-btn {  
    opacity: 1;  
}

/* ---- Modal ---- */  
.modal-backdrop {  
    display: none;  
    position: fixed;  
    top: 0; left: 0; right: 0; bottom: 0;  
    background: rgba(0, 0, 0, 0.5);  
    z-index: 200;  
    align-items: center;  
    justify-content: center;  
}

.modal-backdrop.active {  
    display: flex;  
}

.modal {  
    background: var(--bg-card);  
    border-radius: var(--radius);  
    padding: 1.5rem;  
    width: 90%;  
    max-width: 450px;  
    box-shadow: var(--shadow-lg);  
}

.modal-title {  
    font-size: 1.1rem;  
    font-weight: 600;  
    margin-bottom: 1rem;  
}

.modal-actions {  
    display: flex;  
    gap: 0.5rem;  
    justify-content: flex-end;  
    margin-top: 1.5rem;  
}

.form-group {  
    margin-bottom: 1rem;  
}

.form-group label {  
    display: block;  
    font-size: 0.85rem;  
    font-weight: 600;  
    margin-bottom: 0.25rem;  
    color: var(--text-secondary);  
}

.form-group input,  
.form-group select {  
    width: 100%;  
}

/* ---- Toast Notifications ---- */  
.toast-container {  
    position: fixed;  
    top: 1rem;  
    right: 1rem;  
    z-index: 300;  
    display: flex;  
    flex-direction: column;  
    gap: 0.5rem;  
}

.toast {  
    padding: 0.75rem 1rem;  
    border-radius: var(--radius);  
    font-size: 0.85rem;  
    box-shadow: var(--shadow-lg);  
    animation: toast-in 0.3s ease;  
    min-width: 250px;  
    max-width: 350px;  
}

.toast-success { background: var(--success-light); color: var(--success); border-left: 3px solid var(--success); }  
.toast-danger { background: var(--danger-light); color: var(--danger); border-left: 3px solid var(--danger); }  
.toast-warning { background: var(--warning-light); color: var(--warning); border-left: 3px solid var(--warning); }

@keyframes toast-in {  
    from { opacity: 0; transform: translateX(100%); }  
    to { opacity: 1; transform: translateX(0); }  
}

@keyframes toast-out {  
    from { opacity: 1; transform: translateX(0); }  
    to { opacity: 0; transform: translateX(100%); }  
}

.toast.removing {  
    animation: toast-out 0.3s ease forwards;  
}  

/* ---- Responsive ---- */  
@media (max-width: 768px) {  
    nav {  
        padding: 0 0.75rem;  
        height: auto;  
        flex-wrap: wrap;  
        padding-top: 0.5rem;  
        padding-bottom: 0.5rem;  
    }

    .nav-brand {  
        width: 100%;  
        text-align: center;  
        margin-bottom: 0.25rem;  
    }

    .nav-links {  
        width: 100%;  
        justify-content: center;  
    }

    .nav-links a {  
        padding: 0.4rem 0.6rem;  
        font-size: 0.8rem;  
    }

    .container {  
        padding: 0 0.75rem;  
        margin: 1rem auto;  
    }

    .page-title {  
        font-size: 1.2rem;  
    }

    .filters {  
        flex-direction: column;  
    }

    .filter-group {  
        width: 100%;  
    }

    .filter-group input,  
    .filter-group select {  
        width: 100%;  
    }

    .card {  
        padding: 1rem;  
    }

    /* Make tables scroll horizontally */  
    table {  
        display: block;  
        overflow-x: auto;  
        white-space: nowrap;  
    }

    th, td {  
        padding: 0.5rem;  
        font-size: 0.8rem;  
    }

    .btn {  
        font-size: 0.8rem;  
        padding: 0.4rem 0.8rem;  
    }

    .toast-container {  
        left: 0.75rem;  
        right: 0.75rem;  
    }

    .toast {  
        min-width: unset;  
        max-width: unset;  
    }

    .modal {  
        width: 95%;  
    }  
}  