/* ======================================================
   ОБЩЕЕ
====================================================== */

* {
    box-sizing: border-box;
}

.ok { color: #1d7f1d; }
.err { color: #c62828; }

/* ======================================================
   FRONT — ФОРМА БРОНИРОВАНИЯ
====================================================== */

.phsv3-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    font-family: system-ui, sans-serif;
}

.phsv3-wrap h3 {
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
}

/* ---------- LABELS ---------- */

.phsv3-wrap label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

/* ---------- INPUTS ---------- */

.phsv3-wrap input[type="text"],
.phsv3-wrap input[type="email"],
.phsv3-wrap input[type="date"],
.phsv3-wrap select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    background: #fff;
}

.phsv3-wrap input:focus,
.phsv3-wrap select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* ======================================================
   FRONT — СЛОТЫ ВРЕМЕНИ
====================================================== */

#phsv3-time-box {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.phsv3-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    background: #f6f7f7;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    transition: 0.15s;
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}
.phsv3-slot,
.phsv3-slot * {
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
}


.phsv3-slot input {
    display: none;
}

.phsv3-slot.start {
    background: #2271b1;
    color: #fff;
    font-weight: 700;
}

.phsv3-slot.selected {
    background: #3b82f6;
    color: #fff;
}

.phsv3-slot.extended {
    background: #93c5fd;
    color: #003;
}

.phsv3-slot input:checked + span,
.phsv3-slot.checked {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.phsv3-slot.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ======================================================
   FRONT — ДОП. УСЛУГИ (В ОДНУ СТРОКУ)
====================================================== */

.phsv3-services {
    margin-top: 10px;
}

.phsv3-services label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    background: #f6f7f7;
    cursor: pointer;
    font-size: 14px;
}

.phsv3-services input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

/* ======================================================
   FRONT — ЦЕНА + КНОПКА
====================================================== */

.phsv3-price {
    margin-top: 16px;
    font-size: 18px;
    font-weight: 700;
    text-align: right;
}

.phsv3-wrap button {
    margin-top: 18px;
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.15s;
}

.phsv3-wrap button:hover {
    background: #135e96;
}

.phsv3-wrap button:disabled {
    background: #a7aaad;
    cursor: not-allowed;
}

/* ======================================================
   FRONT — СООБЩЕНИЕ
====================================================== */

#phsv3-result {
    margin-top: 14px;
    text-align: center;
    font-weight: 600;
}

/* ======================================================
   ADMIN — КАЛЕНДАРЬ
====================================================== */

.calendar td {
    vertical-align: top;
    min-height: 90px;
    padding: 6px;
    position: relative;
}

.cal-day {
    cursor: pointer;
    position: relative;
    transition: background 0.15s, box-shadow 0.15s;
}

.cal-day:hover {
    background: #f0f6ff;
}

.cal-day::after {
    content: "+";
    position: absolute;
    top: 6px;
    right: 6px;
    font-weight: bold;
    color: #2271b1;
    opacity: 0;
}

.cal-day:hover::after {
    opacity: 1;
}

/* ======================================================
   ADMIN — ПЛИТКИ БРОНИ
====================================================== */

.booking-tile {
    margin-top: 4px;
    padding: 4px 6px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
}

.booking-tile.white-hall { background: #5ba4ff; }
.booking-tile.grey-hall  { background: #777; }

/* ======================================================
   ADMIN — МОДАЛКА
====================================================== */

#booking-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 9999;
}

#booking-modal .modal-box {
    background: #fff;
    width: 380px;
    margin: 60px auto;
    padding: 16px;
    border-radius: 10px;
}

/* ======================================================
   ADMIN — СЛОТЫ
====================================================== */

.admin-slot-box {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 10px 0;
}

.admin-slot {
    padding: 8px 4px;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    background: #f6f7f7;
    cursor: pointer;
    transition: 0.15s;
}

.admin-slot:hover {
    background: #eef3f8;
}

.admin-slot.selected {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.admin-slot.disabled {
    opacity: .4;
    pointer-events: none;
}

.admin-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

/* ======================================================
   MOBILE
====================================================== */

@media (max-width: 480px) {
    #phsv3-time-box,
    .admin-slot-box {
        grid-template-columns: repeat(3, 1fr);
    }
}
/* ===== ПОДСВЕТКА СЛОТОВ ВРЕМЕНИ ===== */

.phsv3-slot.start {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

.phsv3-slot.selected {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.phsv3-slot.extended {
    background: #4f83cc;
    color: #fff;
    border-color: #4f83cc;
}

/* hover ТОЛЬКО для НЕ выбранных */
.phsv3-slot:not(.start):not(.selected):not(.extended):not(.disabled):hover {
    background: #eef3f8;
}

/* ===== ЗАНЯТЫЕ СЛОТЫ ===== */

.phsv3-slot.taken {
    background: #fee2e2;          /* светло-красный */
    border-color: #f87171;
    color: #7f1d1d;
    cursor: not-allowed;
}

.phsv3-slot.taken::after {
    content: "Занято";
    position: absolute;
    font-size: 10px;
    bottom: 2px;
    right: 4px;
    opacity: 0.7;
}

/* чтобы hover НЕ перебивал красный */
.phsv3-slot.taken:hover {
    background: #fee2e2;
}

.phsv3-success {
    margin-top: 12px;
    padding: 10px 14px;
    background: #e6f8ec;
    border: 1px solid #7bcf9c;
    color: #1e7a43;
    font-weight: 500;
    border-radius: 6px;
}

.phsv3-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fdecea;
    border: 1px solid #f5a3a3;
    color: #b42318;
    font-weight: 500;
    border-radius: 6px;
}

.phsv3-slot.last-start {
    border: 2px dashed #999;
    background: #f9f9f9;
    font-weight: 600;
    cursor: not-allowed;
}

.phsv3-slot.last-start span::after {
    content: ' последний старт';
    display: block;
    font-size: 11px;
    color: #777;
}

.admin-slot {
    padding: 6px 5px;
    margin: 1px;
    border: 1px solid #ccc;
    cursor: pointer;
    display: inline-block;
    border-radius: 4px;
    user-select: none;
}

.admin-slot.selected {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.phsv3-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.phsv3-loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    animation: phsv3-spin 0.8s linear infinite;
}

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