@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

:root {
    --primary: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #06b6d4;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-light: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #cbd5e1;

    --shift-d-bg: #fef08a;
    --shift-d-text: #854d0e;
    --shift-e-bg: #bbf7d0;
    --shift-e-text: #166534;
    --shift-n-bg: #fecaca;
    --shift-n-text: #991b1b;
    --shift-m-bg: #fed7aa;
    --shift-m-text: #9a3412;
    --shift-of-bg: #f1f5f9;
    --shift-of-text: #475569;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

body {
    background-color: #f1f5f9;
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 50px;
}

/* Header Navbar */
.navbar {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.navbar .brand {
    font-size: 1.35rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.navbar .brand i {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    gap: 12px;
}

.nav-btn {
    padding: 8px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255,255,255,0.12);
}

.nav-btn:hover, .nav-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Container */
.main-container {
    max-width: 1700px;
    margin: 24px auto;
    padding: 0 20px;
}

/* Card Section */
.card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Toolbar Controls */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: #64748b; color: #fff; }
.btn-secondary:hover { background: #475569; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: #334155; }
.btn-outline:hover { background: #f1f5f9; }

/* Filter Tabs */
.tab-group {
    display: flex;
    background: #e2e8f0;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 7px;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.88rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #ffffff;
    color: var(--primary-dark);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Grid Table */
.grid-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #fff;
    max-height: 750px;
    position: relative;
}

.duty-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    text-align: center;
}

.duty-table th, .duty-table td {
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 4px;
    min-width: 38px;
    height: 38px;
    vertical-align: middle;
}

.duty-table thead th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
}

.duty-table thead th.sat { color: #2563eb; background: #eff6ff; }
.duty-table thead th.sun { color: #dc2626; background: #fef2f2; }

/* Sticky Left Column */
.duty-table .sticky-col {
    position: sticky;
    left: 0;
    background: #ffffff;
    z-index: 15;
    font-weight: 700;
    text-align: left;
    padding-left: 12px;
    min-width: 140px;
    border-right: 2px solid #cbd5e1;
}

.duty-table thead th.sticky-col {
    z-index: 25;
    background: #f8fafc;
}

/* Shift Cell Badges */
.shift-cell {
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
}

.shift-cell:hover {
    transform: scale(1.1);
    z-index: 5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.shift-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 800;
}

.badge-D, .badge-M { background: var(--shift-d-bg); color: var(--shift-d-text); }
.badge-E { background: var(--shift-e-bg); color: var(--shift-e-text); }
.badge-N { background: var(--shift-n-bg); color: var(--shift-n-text); }
.badge-MD { background: var(--shift-m-bg); color: var(--shift-m-text); }
.badge-OF, .badge-OFF { background: var(--shift-of-bg); color: var(--shift-of-text); }
.badge-req {
    border: 2px solid #a855f7;
    font-style: italic;
    box-shadow: 0 0 0 1px #a855f7;
}

/* Rule Violation Highlight */
.violation-cell {
    outline: 2px solid #ef4444;
    outline-offset: -2px;
    background-color: #ffe4e6 !important;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Violation Summary Panel */
.violation-panel {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

.violation-title {
    font-weight: 700;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.violation-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.88rem;
    color: #7f1d1d;
}

.violation-item {
    background: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 4px solid #ef4444;
}

/* Nurse Portal Calendar */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 16px;
}

.cal-day-head {
    text-align: center;
    font-weight: 700;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #475569;
}

.cal-day-head.sun { color: #dc2626; }
.cal-day-head.sat { color: #2563eb; }

.cal-day-cell {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    min-height: 80px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cal-day-cell:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.cal-day-cell.selected {
    border-color: #a855f7;
    background: #faf5ff;
}

.cal-num {
    font-weight: 700;
    font-size: 1rem;
}

.cal-badge {
    margin-top: 6px;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-align: center;
}

/* Responsive Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 550px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #334155;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 0.95rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Print Styles */
@media print {
    .navbar, .toolbar-group, .violation-panel, .btn { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; padding: 0; }
    .grid-wrapper { max-height: none; overflow: visible; border: none; }
    .duty-table th, .duty-table td { border: 1px solid #000; font-size: 0.75rem; padding: 2px; }
}
