* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f1419;
    color: #e0e0e0;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== HEADER ===== */
header {
    background: #16213e;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #1a3a5c;
}

h1 {
    color: #e94560;
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: 600;
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.compact-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid #1a3a5c;
    border-radius: 6px;
    background: #0f3460;
    color: #e0e0e0;
    font-size: 14px;
    cursor: pointer;
    min-width: 130px;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.compact-select:hover {
    background-color: #1a4a7a;
    border-color: #2a5a8c;
}

.compact-select:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.compact-select option {
    background: #0f3460;
    color: #e0e0e0;
    padding: 8px;
}

/* Year select - поменьше */
#year-select {
    min-width: 90px;
}

/* EXT Site - зелёный как на скриншоте */
.extsite-select {
    min-width: 140px;
    font-weight: bold;
    color: #4ecdc4;
    background-color: #1a4a3a;
    border-color: #2a6a4a;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234ecdc4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.extsite-select:hover {
    background-color: #2a5a4a;
    border-color: #3a8a6a;
}

.extsite-select option {
    background: #0f3460;
    color: #e0e0e0;
}

/* Language button */
.lang-button {
    padding: 8px 14px;
    border: 1px solid #1a3a5c;
    border-radius: 6px;
    background: #0f3460;
    color: #e94560;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.lang-button:hover {
    background: #1a4a7a;
    border-color: #e94560;
}

/* Admin buttons */
.admin-btn {
    background: #8b2020;
    border: 1px solid #a03030;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn:hover {
    background: #a03030;
    border-color: #c04040;
}

#login-btn {
    background: #0f3460;
    border: 1px solid #1a3a5c;
    color: #e0e0e0;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

#login-btn:hover {
    background: #1a4a7a;
    border-color: #2a5a8c;
}

/* ===== INFO PANEL ===== */
.info-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #16213e;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #1a3a5c;
}

.info-item {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 15px;
}

.info-item span:first-child {
    color: #a0a0a0;
}

.info-item span:last-child {
    color: #e94560;
    font-weight: bold;
    font-size: 16px;
}

/* ===== CALENDAR ===== */
#calendar-container {
    background: #16213e;
    padding: 20px;
    border-radius: 8px;
    min-height: 500px;
    border: 1px solid #1a3a5c;
}

#no-data-message {
    text-align: center;
    padding: 60px 20px;
    font-size: 20px;
    color: #e94560;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.month-row {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(26, 58, 92, 0.3);
}

.month-row:last-child {
    border-bottom: none;
}

.month-label {
    width: 50px;
    font-weight: bold;
    color: #a0a0a0;
    font-size: 14px;
    letter-spacing: 1px;
    flex-shrink: 0;
}

.days-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
}

.day {
    width: 34px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
    user-select: none;
}

/* Недоступная дата (нет файла) */
.day.unavailable {
    background: transparent;
    color: #4a4a5a;
    cursor: pointer;
}

.day.unavailable:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #8a8a9a;
}

/* Доступная дата (есть файл) */
.day.available {
    background: #0f3460;
    color: #6ab0ff;
    border: 1px solid #1a4a7a;
}

.day.available:hover {
    background: #1a4a7a;
    color: #fff;
    border-color: #2a5a8c;
}

/* Рабочая дата */
.day.work-date {
    background: #f0a500;
    color: #000;
    font-weight: bold;
    border: 1px solid #ffc040;
    box-shadow: 0 0 8px rgba(240, 165, 0, 0.4);
}

.day.work-date:hover {
    background: #ffc040;
    box-shadow: 0 0 12px rgba(240, 165, 0, 0.6);
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: #16213e;
    padding: 30px;
    border-radius: 8px;
    min-width: 320px;
    border: 1px solid #1a3a5c;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-content h2,
.modal-content h3 {
    margin-bottom: 20px;
    color: #e94560;
    font-size: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #a0a0a0;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #1a3a5c;
    border-radius: 6px;
    background: #0f3460;
    color: #e0e0e0;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #e94560;
}

.modal-content button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 10px;
}

.modal-content button[type="submit"] {
    background: #e94560;
    color: white;
}

.modal-content button[type="submit"]:hover {
    background: #ff6b6b;
}

.modal-content button[type="button"] {
    background: #0f3460;
    color: #e0e0e0;
    border: 1px solid #1a3a5c;
}

.modal-content button[type="button"]:hover {
    background: #1a4a7a;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #0f3460;
    border-radius: 10px;
    overflow: hidden;
    margin: 15px 0;
    border: 1px solid #1a3a5c;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    width: 0%;
    transition: width 0.3s;
}

/* ===== DEBUG PANEL ===== */
.debug-panel {
    background: #16213e;
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #1a3a5c;
}

.debug-panel h3 {
    color: #e94560;
    margin-bottom: 10px;
    font-size: 16px;
}

#debug-log {
    background: #0a0f14;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    color: #4ecdc4;
    border: 1px solid #1a3a5c;
    line-height: 1.5;
}

#clear-log-btn {
    margin-top: 10px;
    padding: 8px 16px;
    background: #0f3460;
    color: #e0e0e0;
    border: 1px solid #1a3a5c;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

#clear-log-btn:hover {
    background: #1a4a7a;
    border-color: #2a5a8c;
}

/* ===== DEBUG URL ===== */
.debug-url-item {
    flex: 1;
    margin: 0 15px;
    min-width: 0;
}

#debug-url {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: #4ecdc4;
    word-break: break-all;
    line-height: 1.4;
    max-width: 100%;
    overflow-wrap: break-word;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f1419;
}

::-webkit-scrollbar-thumb {
    background: #1a3a5c;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a5a8c;
}

/* ===== SELECTION ===== */
::selection {
    background: #e94560;
    color: white;
}
/* --- Кэш: подсветка годов, для которых есть данные --- */
#year-select option.cached-year { background: #d9f5d9; color: #005a00; font-weight: 600; }

/* --- Панель прогресса сборки кэша --- */
#cache-progress { color: #b06a00; font-weight: 500; }
#cache-progress.hidden { display: none; }

/* --- Панель лога кэширования --- */
.cache-log-panel {
    margin-top: 8px;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 4px;
    width: 100%;
    max-width: 720px;
    font-family: ui-monospace, "Courier New", monospace;
}
.cache-log-panel.hidden { display: none; }
.cache-log-panel__head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 8px; background: #eee; font-weight: 600; font-size: 12px;
}
.cache-log-panel__head button {
    font-size: 11px; padding: 2px 8px; cursor: pointer;
}
#cache-log-body {
    margin: 0; padding: 6px 8px; height: 180px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-word; font-size: 12px;
    background: #111; color: #ddd;
}

/* --- Этап 2: пользователи --- */
.user-badge { font-weight: 600; color: #2a6; margin-right: 6px; }
.form-error { color: #c00; font-size: 13px; margin: 6px 0; }
.form-error.hidden { display: none; }
.collections-list { max-height: 320px; overflow-y: auto; margin: 8px 0; text-align: left; }
.coll-check { display: block; padding: 4px 2px; cursor: pointer; }
.coll-check input { margin-right: 8px; }
.coll-author { color: #888; font-size: 12px; margin-left: 4px; }

/* --- Этап 3: управление коллекциями --- */
.modal-wide .modal-content, .modal-content.modal-wide { max-width: 760px; width: 92%; }
.manage-row { padding: 6px 4px; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.manage-row button { font-size: 12px; padding: 2px 8px; cursor: pointer; }
.help-link { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center;
    background: #79c; color: #fff; border-radius: 50%; text-decoration: none; font-size: 14px; margin-left: 8px; }
/* Широкая форма редактора коллекций (длинные URL без прокрутки) */
#colledit-modal .modal-content { max-width: 760px; width: 92%; }
/* Метка слева, поле справа — компактно по вертикали */
#colledit-form .form-group {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}
#colledit-form label { font-size: 12px; color: #444; text-align: right; }
#colledit-form input[type=text], #colledit-form select {
    width: 100%; box-sizing: border-box; padding: 4px 8px; font-size: 13px;
}
/* чекбокс default_show — без grid, в одну строку */
#colledit-form .form-group.checkbox-row { display: block; }
#colledit-form .form-group.checkbox-row label { text-align: left; }
.coll-toolbar { margin-bottom: 8px; display: flex; gap: 8px; }
.coll-toolbar button { font-size: 12px; padding: 3px 10px; cursor: pointer; }

/* --- Help-модалка с iframe --- */
.modal-help { max-width: 90%; width: 900px; height: 80vh; display: flex; flex-direction: column; }
.help-close { align-self: flex-start; margin-bottom: 8px; padding: 4px 12px; cursor: pointer; }
#help-frame { flex: 1; width: 100%; border: 1px solid #ccc; border-radius: 4px; }
/* help-link как кнопка */
button.help-link { border: none; cursor: pointer; }
