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

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
    min-height: 100vh;
}

.header {
    background: #1a3a5c;
    color: #fff;
    padding: 14px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.toolbar {
    max-width: 1400px;
    margin: 16px auto 0;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.week-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.week-label {
    font-size: 15px;
    font-weight: 600;
    color: #1a3a5c;
    min-width: 220px;
    text-align: center;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.2s;
}

.week-label:hover {
    background: #e8edf2;
}

.btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    color: #1a3a5c;
}

.btn-icon:hover {
    background: #e8edf2;
    border-color: #1a3a5c;
}

.btn-secondary {
    background: #fff;
    border: 1px solid #ccc;
    color: #1a3a5c;
}

.btn-secondary:hover {
    background: #e8edf2;
    border-color: #1a3a5c;
}

.btn-primary {
    background: #1a73b5;
    color: #fff;
    padding: 9px 20px;
}

.btn-primary:hover {
    background: #155d93;
}

.timetable-wrapper {
    max-width: 1400px;
    margin: 16px auto;
    padding: 0 20px;
    position: relative;
}

.timetable {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    table-layout: fixed;
}

.timetable th,
.timetable td {
    border: 1px solid #dde1e6;
    padding: 8px 10px;
    vertical-align: top;
    font-size: 13px;
}

.timetable thead th {
    background: #2c5f8a;
    color: #fff;
    font-weight: 600;
    text-align: center;
    padding: 10px 8px;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.timetable thead th.day-column-header {
    width: 120px;
    min-width: 100px;
    background: #1a3a5c;
}

.timetable thead th .col-header-title {
    display: block;
    margin-bottom: 2px;
}

.timetable thead th .col-header-sub {
    display: block;
    font-weight: 400;
    font-size: 11px;
    opacity: 0.85;
}

.timetable thead th .btn-remove-col {
    display: inline-block;
    margin-top: 4px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 8px;
}

.timetable thead th .btn-remove-col:hover {
    background: rgba(255, 255, 255, 0.4);
}

.timetable tbody td {
    min-height: 50px;
}

.timetable tbody td.day-cell {
    background: #f7f9fb;
    font-weight: 600;
    color: #1a3a5c;
    text-align: center;
    vertical-align: middle;
    width: 120px;
    min-width: 100px;
    font-size: 13px;
}

.timetable tbody td.event-cell {
    padding: 4px 6px;
    vertical-align: top;
    min-width: 150px;
}

.timetable tbody td.event-cell:empty {
    min-height: 40px;
}

.timetable tbody tr.day-start td.day-cell {
    background: #f7f9fb;
    border-top: 2px solid #1a3a5c;
}

.timetable tbody tr.day-start:nth-child(even) td.day-cell {
    background: #eef2f6;
}

.event-item {
    background: #f0f7ff;
    border-left: 3px solid #1a73b5;
    border-radius: 3px;
    padding: 6px 8px;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.4;
}

.event-item:last-child {
    margin-bottom: 0;
}

.event-item.cancelled {
    opacity: 0.5;
    border-left-color: #c0392b;
    text-decoration: line-through;
}

.event-item.simultaneous {
    border-left-color: #e74c3c;
    background: #fef0f0;
}

.event-subject {
    font-weight: 600;
    color: #1a3a5c;
    margin-bottom: 2px;
}

.event-time {
    color: #555;
    font-size: 11px;
    margin-bottom: 2px;
}

.event-details {
    color: #666;
    font-size: 11px;
}

.event-details span {
    display: block;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 8px;
    width: 500px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a3a5c;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.btn-close:hover {
    color: #333;
}

.modal-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    padding: 0 20px;
}

.tab {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s, border-color 0.2s;
}

.tab:hover {
    color: #1a3a5c;
}

.tab.active {
    color: #1a73b5;
    border-bottom-color: #1a73b5;
    font-weight: 600;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
    font-size: 13px;
    align-items: center;
}

.breadcrumbs:empty {
    display: none;
}

.breadcrumb-item {
    color: #1a73b5;
    cursor: pointer;
    text-decoration: none;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

.breadcrumb-item.current {
    color: #333;
    cursor: default;
    font-weight: 600;
}

.breadcrumb-item.current:hover {
    text-decoration: none;
}

.breadcrumb-separator {
    color: #999;
    margin: 0 2px;
}

.mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: #1a73b5;
    background: #f0f7ff;
}

.mode-btn.active {
    background: #1a73b5;
    color: #fff;
    border-color: #1a73b5;
}

.search-box {
    position: relative;
    margin-bottom: 12px;
}

.search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #1a73b5;
    box-shadow: 0 0 0 2px rgba(26, 115, 181, 0.15);
}

.search-spinner {
    display: none;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-top-color: #1a73b5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.search-spinner.active {
    display: block;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

.search-results {
    max-height: 350px;
    overflow-y: auto;
}

.search-result-item {
    padding: 10px 12px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.search-result-item:hover {
    background: #f0f7ff;
    border-color: #1a73b5;
}

.search-result-item .result-name {
    font-weight: 600;
    color: #1a3a5c;
    font-size: 13px;
}

.search-result-item .result-sub {
    color: #888;
    font-size: 12px;
    margin-top: 2px;
}

.search-result-item .result-employment {
    color: #666;
    font-size: 11px;
    margin-top: 2px;
}

.search-hint {
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

.search-loading {
    color: #666;
    font-size: 13px;
    text-align: center;
    padding: 20px 0;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 15px;
}

.empty-state.hidden {
    display: none;
}

@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .week-selector {
        justify-content: center;
    }

    .btn-primary {
        width: 100%;
    }

    .timetable-wrapper {
        overflow-x: auto;
    }

    .timetable {
        min-width: 600px;
    }
}

.week-picker-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.week-picker-overlay.active {
    display: flex;
}

.week-picker {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 16px;
    width: 320px;
}

.week-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.week-picker-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a3a5c;
}

.week-picker-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.week-picker-calendar .day-header {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    padding: 8px 0;
}

.week-picker-calendar .day-cell {
    text-align: center;
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.week-picker-calendar .day-cell:hover {
    background: #e8edf2;
}

.week-picker-calendar .day-cell.other-month {
    color: #aaa;
}

.week-picker-calendar .day-cell.current-week {
    background: #1a3a5c;
    color: #fff;
    font-weight: 600;
}

.week-picker-calendar .day-cell.monday {
    font-weight: 600;
}
