/* Стили для агрегатора шиномонтажек */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
}

body.service-modal-open {
    overflow: hidden;
}

/* Обёртка агрегатора */
.aggregator-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Боковая панель */
.info-sidebar {
    width: 50%;
    background: #ffffff;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    color: #fff;
    position: relative;
    text-align: center;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
}

/* ─── Предстоящие записи ───────────────────────────────────── */
.upcoming-bookings-block {
    background: #f0faf4;
    border: 1.5px solid #b7e4c7;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.upcoming-bookings-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #27ae60;
    margin: 0 0 10px 0;
}

.upcoming-booking-item {
    border-top: 1px solid #d5f0df;
    padding: 8px 0 4px;
}

.upcoming-booking-item:first-of-type {
    border-top: none;
    padding-top: 0;
}

.upcoming-booking-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.upcoming-booking-info strong {
    font-size: 0.92rem;
    color: #1a202c;
}

.upcoming-booking-info span {
    font-size: 0.85rem;
    color: #4a5568;
}

.upcoming-booking-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.upcoming-cancel-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid #fc8181;
    color: #e53e3e;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.upcoming-cancel-btn:hover {
    background: #e53e3e;
    color: #fff;
}

.upcoming-cancel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.welcome-text {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
}

.sidebar-details {
    min-height: 100%;
}

.service-modal {
    position: absolute;
    inset: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

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

.service-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 52, 54, 0.35);
    backdrop-filter: blur(4px);
    border-radius: 24px;
}

.service-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 100%;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18);
    padding: 28px;
    z-index: 1;
}

.service-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(45, 52, 54, 0.08);
    color: #2d3436;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.service-modal-close:hover {
    background: rgba(45, 52, 54, 0.14);
    transform: scale(1.05);
}

.service-modal-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.service-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(39, 174, 96, 0.12);
    color: #1f8b4c;
    font-weight: 700;
    font-size: 0.9rem;
}

.service-modal-title {
    font-size: 2rem;
    line-height: 1.1;
    color: #2d3436;
    margin: 0;
}

.service-modal-subtitle {
    color: #636e72;
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.service-modal-info-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.service-modal-info-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: 16px;
    background: #f8f9fb;
    border: 1px solid rgba(45, 52, 54, 0.08);
}

.service-modal-info-item strong {
    display: block;
    margin-bottom: 6px;
    color: #2d3436;
}

.service-modal-info-item p {
    margin: 0;
    color: #555;
    line-height: 1.5;
}

.service-modal-info-item a {
    color: #2d3436;
    font-weight: 600;
    text-decoration: none;
}

.service-modal-info-item a:hover {
    text-decoration: underline;
}

.service-modal-icon {
    font-size: 1.3rem;
    line-height: 1;
    margin-top: 2px;
}

.service-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.service-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-modal-btn:hover {
    transform: translateY(-1px);
}

.service-modal-btn-primary {
    background: linear-gradient(135deg, #27ae60 0%, #219150 100%);
    color: #fff;
    box-shadow: 0 10px 24px rgba(39, 174, 96, 0.24);
}

.service-modal-btn-secondary {
    background: rgba(45, 52, 54, 0.08);
    color: #2d3436;
}

.legend-icon {
    font-size: 1.2rem;
}

.legend-green {
    color: #27ae60;
}

.legend-gray {
    color: #95a5a6;
}

/* Информация о точке */
.point-info {
    padding: 20px;
}

.point-info h3 {
    color: #2d3436;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.point-info-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.point-info-item:last-child {
    border-bottom: none;
}

.point-info-icon {
    font-size: 1.2rem;
    min-width: 24px;
}

.point-info-text {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.5;
}

.point-info-label {
    font-weight: 600;
    color: #333;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    height: 54px;
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
}

.footer-link {
    color: #fff;
    font-size: 0.9rem;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-link:hover {
    opacity: 0.8;
}

.footer-divider {
    color: #ccc;
}

/* Основной контент */
.main-content {
    margin-right: 50%;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Верхняя панель */
.top-bar {
    background: #ffffff;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 50;
    height: 54px;
}

.filter-group {
    display: flex;
    gap: 15px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    color: #555;
    font-size: 0.95rem;
}

.filter-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.location-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.map-hint {
    color: #555;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    flex: 1;
}

/* Карта */
.aggregator-map {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Легенда под картой */
.map-legend {
    background: #ffffff;
    padding: 15px 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 50;
    height: 54px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 0.95rem;
}

.legend-icon {
    font-size: 1rem;
}

.legend-green {
    color: #27ae60;
}

.legend-gray {
    color: #95a5a6;
}

/* Сообщение для неподключенных точек */
.unregistered-message {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 15px 25px;
    color: #856404;
    font-size: 0.95rem;
    text-align: center;
    z-index: 50;
    max-width: 500px;
}

.register-link {
    display: inline-block;
    margin-top: 8px;
    color: #856404;
    font-weight: 600;
    text-decoration: underline;
}

.register-link:hover {
    text-decoration: none;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .info-sidebar {
        width: 350px;
        right: 0;
    }

    .main-content {
        margin-right: 350px;
    }
}

@media (max-width: 768px) {
    .aggregator-wrapper {
        flex-direction: column;
    }

    .info-sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        position: relative;
        box-shadow: none;
        border-bottom: 2px solid #e0e0e0;
    }

    .close-sidebar-btn {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        height: auto;
    }

    .top-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .filter-group {
        width: 100%;
        justify-content: center;
    }

    .map-hint {
        width: 100%;
        text-align: center;
        margin-top: 10px;
        font-size: 1.2rem;
    }

    .map-legend {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .aggregator-map {
        height: 50vh;
    }

    .unregistered-message {
        position: relative;
        bottom: 0;
        left: 0;
        transform: none;
        margin: 20px;
        max-width: none;
    }

    .sidebar-footer {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .service-modal {
        position: relative;
        inset: auto;
        margin-top: 20px;
    }

    .service-modal-backdrop {
        display: none;
    }

    .service-modal-dialog {
        padding: 22px 18px;
        border-radius: 20px;
    }

    .service-modal-title {
        font-size: 1.55rem;
    }

    .service-modal-actions {
        flex-direction: column;
    }

    .service-modal-btn {
        width: 100%;
    }

    .footer-link {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .sidebar-title {
        font-size: 1rem;
    }

    .footer-link {
        font-size: 0.8rem;
    }
}

/* ─── Форма бронирования в модальном окне агрегатора ─────────────────── */

.booking-form-section {
    border-top: 2px solid #f0f0f0;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.booking-form-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 8px;
}

/* Телефон шиномонтажки в модале записи */
.bk-shop-phone {
    font-size: 0.9rem;
    color: #636e72;
    margin-bottom: 14px;
    padding: 6px 10px;
    background: #f0f4f8;
    border-radius: 8px;
}
.bk-shop-phone a {
    color: #2980b9;
    text-decoration: none;
    font-weight: 600;
}
.bk-shop-phone a:hover { text-decoration: underline; }

/* Блок успешного бронирования */
.booking-success {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 16px;
    background: rgba(39, 174, 96, 0.08);
    border: 2px solid rgba(39, 174, 96, 0.3);
    border-radius: 16px;
    text-align: center;
}

.booking-success-icon {
    font-size: 2.8rem;
    line-height: 1;
}

.booking-success h4 {
    font-size: 1.2rem;
    color: #1f8b4c;
    margin: 0;
}

.booking-success p {
    color: #555;
    margin: 0;
    font-size: 0.95rem;
}

/* Форма */
.aggregator-booking-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.booking-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.booking-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.booking-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #636e72;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.booking-input {
    height: 42px;
    padding: 0 12px;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #2d3436;
    background: #fafafa;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
    font-family: inherit;
}

.booking-input:focus {
    border-color: #27ae60;
    background: #fff;
}

/* Временные слоты */
.bk-time-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8f9fb;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    min-height: 52px;
    align-items: flex-start;
    align-content: flex-start;
}

.bk-time-slot {
    padding: 6px 12px;
    border-radius: 8px;
    background: #fff;
    border: 2px solid #dfe3e8;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2d3436;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
}

.bk-time-slot:hover:not(.booked) {
    border-color: #27ae60;
    background: rgba(39, 174, 96, 0.08);
}

.bk-time-slot.selected {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

.bk-time-slot.booked {
    background: #f5f5f5;
    border-color: #e0e0e0;
    color: #bbb;
    cursor: not-allowed;
    text-decoration: line-through;
}

.booking-hint {
    font-size: 0.88rem;
    color: #999;
    padding: 4px 2px;
    margin: 0;
}

.booking-hint.no-slots {
    color: #e67e22;
}

/* Чекбокс перебортовки */
.booking-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.93rem;
    color: #555;
    user-select: none;
}

.booking-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #27ae60;
    cursor: pointer;
    flex-shrink: 0;
}

/* Строка цены */
.booking-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(39, 174, 96, 0.07);
    border: 2px solid rgba(39, 174, 96, 0.2);
    border-radius: 12px;
}

.booking-price-label {
    font-size: 0.9rem;
    color: #636e72;
    font-weight: 500;
}

.booking-price-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #27ae60;
}

/* Блок ошибки */
.booking-error {
    display: none;
    padding: 10px 14px;
    background: rgba(231, 76, 60, 0.08);
    border: 2px solid rgba(231, 76, 60, 0.3);
    border-radius: 10px;
    color: #c0392b;
    font-size: 0.9rem;
}

/* Кнопка записи */
.booking-submit-btn {
    width: 100%;
    height: 52px;
    font-size: 1.05rem;
    border-radius: 14px;
    margin-top: 4px;
}

.booking-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

@media (max-width: 480px) {
    .booking-field-row {
        grid-template-columns: 1fr;
    }
}
