/* ════════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
    background: #eef0f4;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    color: #1e2330;
}

.navbar { box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.navbar-brand { font-weight: 700; letter-spacing: .3px; }
.container { max-width: 1300px; }

/* ════════════════════════════════════════════════════════
   NAVIGATION BAR
════════════════════════════════════════════════════════ */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #dde1e9;
    border-radius: 10px;
    padding: 10px 14px;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.cal-nav-center {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.cal-week-label {
    font-size: 15px;
    font-weight: 600;
    color: #1e2330;
    text-align: center;
    min-width: 220px;
}

.nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    color: #374151;
    background: #fff;
    font-size: 11px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.nav-arrow:hover { background: #f3f4f6; border-color: #9ca3af; color: #111; }

/* ════════════════════════════════════════════════════════
   TABLE WRAPPER  (горизонтальный скролл на малых экранах)
════════════════════════════════════════════════════════ */
.cal-wrap {
    background: #fff;
    border: 1px solid #dde1e9;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ════════════════════════════════════════════════════════
   CALENDAR TABLE
════════════════════════════════════════════════════════ */
.cal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 640px;   /* ниже этого — горизонтальный скролл */
}

/* ── Column widths ── */
.col-time  { width: 62px; }
.col-day   { }              /* равные доли оставшегося места */
.col-today { }

/* ════════════════════════════════════════════════════════
   HEADER ROW
════════════════════════════════════════════════════════ */
.th-time {
    border-right: 2px solid #d1d5db;
    background: #f9fafb;
}

.th-day {
    padding: 10px 8px 8px;
    background: #f9fafb;
    border-left: 1px solid #e5e7eb;
    border-bottom: 2px solid #d1d5db;
    text-align: center;
}

.th-today { background: #eff6ff; }
.th-past  { opacity: .55; }

.day-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.day-dow {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #6b7280;
}

.day-date {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.day-date-today {
    color: #2563eb;
}

/* ════════════════════════════════════════════════════════
   TIME COLUMN
════════════════════════════════════════════════════════ */
.td-time {
    height: 56px;
    padding: 0 10px 0 6px;
    text-align: right;
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    vertical-align: top;
    padding-top: 7px;
    border-right: 2px solid #d1d5db;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
    background: #f9fafb;
    font-variant-numeric: tabular-nums;
}

/* ════════════════════════════════════════════════════════
   DATA CELLS
════════════════════════════════════════════════════════ */
.td-cell {
    height: 56px;
    border-left: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    padding: 3px;
    transition: background .1s;
}

/* Серый — нет слота, кликабельный для быстрого добавления */
.td-empty {
    background: #f3f4f6;
    cursor: pointer;
    position: relative;
}
.td-empty:hover { background: #e9eaec; }

.td-empty-plus {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 300;
    color: #9ca3af;
    pointer-events: none;
}
.td-empty:hover .td-empty-plus { display: flex; }

/* Ячейка со слотом */
.td-slot {
    background: #fff;
    padding: 3px;
}

/* ════════════════════════════════════════════════════════
   SLOT BLOCKS
════════════════════════════════════════════════════════ */
.slot-block {
    height: 100%;
    border-radius: 6px;
    padding: 5px 7px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
    cursor: default;
    position: relative;
}

/* ── Базовые статусы (без локации / неизвестный корт) ── */
.slot-свободно {
    background: #dcfce7;
    border-left: 3px solid #16a34a;
    color: #14532d;
}
.slot-свободно:hover { background: #bbf7d0; }

.slot-занято {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    color: #1e3a8a;
}
.slot-занято:hover { background: #dbeafe; }

.slot-ожидание {
    background: #fefce8;
    border-left: 3px solid #eab308;
    color: #713f12;
}
.slot-ожидание:hover { background: #fef9c3; }

/* ── Акчегерме — зелёная палитра ── */
.slot-akch.slot-свободно  { background: #dcfce7; border-left-color: #16a34a; color: #14532d; }
.slot-akch.slot-свободно:hover  { background: #bbf7d0; }
.slot-akch.slot-занято    { background: #bbf7d0; border-left-color: #15803d; color: #14532d; }
.slot-akch.slot-занято:hover    { background: #86efac; }
.slot-akch.slot-ожидание  { background: #fef9c3; border-left-color: #a16207; color: #713f12; }
.slot-akch.slot-ожидание:hover  { background: #fef08a; }

/* ── Новая марина — синяя/голубая палитра ── */
.slot-marina.slot-свободно { background: #dbeafe; border-left-color: #3b82f6; color: #1e3a8a; }
.slot-marina.slot-свободно:hover { background: #bfdbfe; }
.slot-marina.slot-занято   { background: #bfdbfe; border-left-color: #1d4ed8; color: #1e3a8a; }
.slot-marina.slot-занято:hover   { background: #93c5fd; }
.slot-marina.slot-ожидание { background: #fef9c3; border-left-color: #a16207; color: #713f12; }
.slot-marina.slot-ожидание:hover { background: #fef08a; }

/* ── Верхняя строка в блоке: время + крестик ── */
.slot-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2px;
}

.slot-time {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.slot-court {
    font-size: 10px;
    margin-top: 1px;
    font-weight: 600;
    opacity: .65;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: .2px;
}

.slot-name {
    font-size: 11px;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .85;
}

/* ── Кнопка отмены ── */
.slot-x {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0;
    color: inherit;
    opacity: 0;
    transition: opacity .15s;
    flex-shrink: 0;
    margin-top: -1px;
}

.slot-block:hover .slot-x { opacity: .5; }
.slot-x:hover { opacity: 1 !important; }

/* ════════════════════════════════════════════════════════
   LEGEND
════════════════════════════════════════════════════════ */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-size: 12px;
    color: #6b7280;
    padding-left: 4px;
}

.leg-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.leg-group-label {
    font-weight: 600;
    color: #4b5563;
    font-size: 11px;
}

.leg-sep {
    width: 1px;
    height: 14px;
    background: #d1d5db;
}

.leg {
    display: flex;
    align-items: center;
    gap: 5px;
}

.leg::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.leg-akch-free::before   { background: #dcfce7; border-left: 3px solid #16a34a; }
.leg-akch-booked::before { background: #bbf7d0; border-left: 3px solid #15803d; }
.leg-marina-free::before   { background: #dbeafe; border-left: 3px solid #3b82f6; }
.leg-marina-booked::before { background: #bfdbfe; border-left: 3px solid #1d4ed8; }
.leg-pending::before { background: #fef9c3; border-left: 3px solid #a16207; }
.leg-empty::before   { background: #f3f4f6; border: 1px solid #e5e7eb; }

/* ════════════════════════════════════════════════════════
   ADD FORM
════════════════════════════════════════════════════════ */
.add-loc-card {
    border-radius: 10px;
    padding: 16px;
    border: 2px solid transparent;
    height: 100%;
}

.add-loc-akch {
    background: #f0fdf4;
    border-color: #86efac;
}

.add-loc-marina {
    background: #eff6ff;
    border-color: #93c5fd;
}

.add-loc-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: #1e2330;
}

.font-monospace { font-size: 13px !important; }

.add-textarea {
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
    color: #1e2330;
}

.add-textarea::placeholder {
    color: #b0b7c3;
    font-style: italic;
}

.add-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
    outline: none;
}

/* ── Format hint card ── */
.format-card {
    background: #f8f9fb;
    border: 1px solid #e2e5ea;
    border-radius: 10px;
    padding: 18px 20px;
    font-size: 13px;
}

.format-title {
    font-weight: 700;
    font-size: 13px;
    color: #374151;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.format-section {
    margin-bottom: 16px;
}

.format-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #9ca3af;
    margin-bottom: 6px;
}

.format-example {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.7;
    color: #374151;
    margin: 0;
    white-space: pre;
}

.format-times {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.format-times code {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 12px;
    color: #4f46e5;
}

.format-note {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

/* ════════════════════════════════════════════════════════
   STUDENTS TABLE
════════════════════════════════════════════════════════ */
.tg-link {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
}
.tg-link:hover { text-decoration: underline; }

.notes-input {
    width: 100%;
    min-width: 160px;
    font-size: 12px;
    line-height: 1.5;
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: transparent;
    resize: vertical;
    color: #374151;
    transition: border-color .2s;
    font-family: inherit;
}
.notes-input:focus {
    outline: none;
    border-color: #6366f1;
    background: #fff;
}
.notes-input::placeholder { color: #d1d5db; }

/* ════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════ */

/* Планшет: уменьшаем отступы и шрифты */
@media (max-width: 900px) {
    .cal-week-label { min-width: 160px; font-size: 13px; }
    .td-time, .th-time { width: 48px; font-size: 10px; }
    .td-cell { height: 48px; }
    .slot-time { font-size: 10px; }
    .slot-name { font-size: 10px; }
    .day-date  { font-size: 12px; }
}

/* Мобильный: компактная шапка, скролл таблицы */
@media (max-width: 600px) {
    .cal-nav { padding: 8px 10px; }
    .cal-week-label { font-size: 12px; min-width: 0; }
    .nav-arrow { width: 28px; height: 28px; }
    .cal-table { min-width: 560px; }
    .td-cell { height: 44px; padding: 2px; }
    .slot-block { padding: 3px 5px; border-radius: 4px; }
    .day-dow { display: none; }   /* скрываем день недели, оставляем дату */
    .cal-legend { flex-wrap: wrap; gap: 10px; }
}
