/* ==================== СБРОС И БАЗОВЫЕ НАСТРОЙКИ ==================== */

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

body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==================== ШАПКА ==================== */

.site-header {
    background: #1976d2;
    color: white;
    padding: 20px;
    text-align: center;
}

.site-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.site-header p {
    font-size: 14px;
    opacity: 0.9;
}

.back-link {
    color: white;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
    margin-bottom: 8px;
}

.back-link:hover {
    text-decoration: underline;
}


/* Плашка авторизации */
.auth-bar {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 10px 20px;
    font-size: 14px;
    color: #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-bar a {
    color: #1976d2;
    text-decoration: none;
    font-weight: bold;
}

.auth-bar a:hover {
    text-decoration: underline;
}
/* ==================== ОСНОВНОЙ КОНТЕЙНЕР ==================== */

.main-layout {
    display: flex;
    max-width: 1200px;
    width: 100%;
    margin: 20px auto;
    padding: 0 15px;
    gap: 20px;
    flex: 1;
    align-items: stretch;
    min-height: 70vh;
}

.content {
    flex: 1;
    min-width: 0;
}

/* ==================== ПРАВАЯ КОЛОНКА (РЕКЛАМА) ==================== */

.sidebar {
    width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ad-block {
    width: 250px;
    height: 190px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ad-block h3 {
    margin: 0;
    color: #888;
    font-size: 14px;
}

.ad-block p {
    color: #aaa;
    font-size: 12px;
    margin: 5px 0 0 0;
}

/* ==================== КАРТОЧКА КВАРТИРЫ (КАТАЛОГ) ==================== */

.apartment-card-id {
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
}

.apartment-detail-id {
    font-size: 13px;
    color: #999;
    margin-bottom: 6px;
}

.apartment-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    display: flex;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.apartment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.apartment-card-photo {
    width: 250px;
    height: 180px;
    flex-shrink: 0;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.apartment-card-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apartment-card-photo .no-photo {
    color: #aaa;
    font-size: 14px;
}

.apartment-card-info {
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
}

/* Колонка с ценами */
.apartment-card-price {
    background: #f9f9f9;
    padding: 12px 15px;
    border-left: 1px solid #eee;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
    flex-shrink: 0;
}

.price-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    gap: 10px;
}

.price-row span {
    color: #888;
}

.price-row strong {
    color: #333;
    white-space: nowrap;
}

.apartment-card-address {
    font-size: 14px;
    color: #666;
    margin-bottom: 2px;
}

.apartment-card-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.apartment-card-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Город в карточке */
.apartment-card-city {
    font-size: 13px;
    color: #1976d2;
    font-weight: bold;
    margin-bottom: 3px;
}

/* Детали (гости, площадь) */
.apartment-card-details {
    display: flex;
    gap: 15px;
    margin: 2px 0;
    font-size: 13px;
    color: #666;
}

/* ==================== ПАГИНАЦИЯ ==================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.pagination button {
    padding: 10px 16px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination button:hover {
    background: #e3f2fd;
}

.pagination button.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== ФОТОГАЛЕРЕЯ ==================== */

.photo-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.main-photo {
    width: 100%;
    max-height: 400px;
    border-radius: 10px;
    object-fit: cover;
    background: #e0e0e0;
}

.thumbnails {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.thumbnails img {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.thumbnails img:hover {
    border-color: #1976d2;
}

.thumbnails img.active {
    border-color: #1976d2;
}

/* ==================== ОПИСАНИЕ КВАРТИРЫ (СТРАНИЦА КВАРТИРЫ) ==================== */

.apartment-description {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.apartment-detail-city {
    font-size: 16px;
    color: #1976d2;
    font-weight: bold;
    margin-bottom: 8px;
}

.apartment-detail-address {
    font-size: 16px;
    color: #1976d2;
    font-weight: bold;
    margin-bottom: 12px;
}

.apartment-detail-info {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.apartment-detail-label {
    font-weight: bold;
    color: #555;
    font-size: 15px;
    margin-bottom: 8px;
}

.apartment-description .desc-text {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

/* ==================== БЛОК ЦЕН (СТРАНИЦА КВАРТИРЫ) ==================== */

.apartment-price-block {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.apartment-price-block .price-row {
    text-align: center;
    font-size: 14px;
}

.apartment-price-block .price-row span {
    display: block;
    color: #888;
    margin-bottom: 4px;
}

.apartment-price-block .price-row strong {
    font-size: 18px;
    color: #333;
}

/* ==================== СЕКЦИЯ БРОНИРОВАНИЯ ==================== */

.booking-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.booking-section h2 {
    margin-bottom: 15px;
    color: #333;
}

/* ==================== ВЫБОР КВАРТИРЫ ==================== */

.form-group {
    width: 100%;
    max-width: 800px;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
    font-size: 14px;
}

.form-group select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
    -webkit-appearance: menulist;
    appearance: menulist;
    cursor: pointer;
    height: auto;
}

/* ==================== КАЛЕНДАРИ ==================== */

.calendar-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    margin-bottom: 15px;
}

.calendar {
    border: 1px solid #ccc;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex: 1;
    box-sizing: border-box;
    padding: 2%;
}

/* Шапка календаря */
.header {
    margin-bottom: 10px;
}

.header-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.header-side {
    width: 30px;
    text-align: center;
    vertical-align: middle;
    padding: 0;
}

.header-center {
    text-align: center;
    vertical-align: middle;
    padding: 5px 2px;
}

.header-year {
    text-align: center;
    padding: 2px;
}

.header button {
    margin: 0;
    font-size: 15px;
    border: none;
    border-radius: 3px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    padding: 4px 10px;
}

.header button:hover {
    background-color: #0056b3;
}

.header h2,
.header h3 {
    margin: 0;
    font-size: 15px;
}

/* Дни недели */
.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-top: 5%;
}

.day {
    font-weight: bold;
    text-align: center;
    font-size: 12px;
}

/* Сетка дат */
.dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-top: 5%;
}

/* Ячейка даты */
.date {
    text-align: center;
    cursor: pointer;
    padding: 12% 5%;
    border-radius: 8px;
    margin: 5%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-size: 12px;
    user-select: none;
    transition: all 0.15s;
}

.date.free {
    background-color: green;
    color: white;
}

.date.free:hover {
    background-color: #2e7d32;
}

.date.booked {
    background-color: red;
    color: white;
    cursor: not-allowed;
}

.date.disabled {
    background-color: #D5B29D;
    color: grey;
    cursor: not-allowed;
    opacity: 0.5;
}

.date.selected {
    background-color: lightblue !important;
    color: #333;
}

/* Легенда */
.legend {
    margin: 10px 0;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-size: 13px;
    flex-wrap: wrap;
}

/* ==================== ФОРМА ГОСТЯ ==================== */

.guest-form {
    width: 100%;
    max-width: 400px;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
}

.guest-form h3 {
    margin-bottom: 10px;
    font-size: 16px;
}

.guest-form input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.guest-form-buttons {
    display: flex;
    gap: 10px;
}

.btn-book {
    flex: 1;
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-book:hover {
    background: #43A047;
}

.btn-cancel {
    flex: 1;
    padding: 10px;
    background: #eee;
    color: #555;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-cancel:hover {
    background: #ddd;
}

/* ==================== КНОПКА ЗАБРОНИРОВАТЬ ==================== */

button#bookBtn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button#bookBtn:hover {
    background-color: #0056b3;
}

/* ==================== УВЕДОМЛЕНИЯ ==================== */

.notification {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
}

/* ==================== ПОДВАЛ ==================== */

.site-footer {
    background: #333;
    color: #aaa;
    text-align: center;
    padding: 15px;
    font-size: 14px;
    margin-top: auto;
}

/* ==================== АДАПТИВ ДЛЯ МОБИЛЬНЫХ ==================== */

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

    .sidebar {
        width: 100%;
        flex-direction: row;
        gap: 10px;
        position: static;
    }

    .ad-block {
        flex: 1;
        width: auto;
        height: 120px;
    }

    .apartment-card {
        flex-direction: column;
    }

    .apartment-card-photo {
        width: 100%;
        height: 200px;
    }

    .apartment-card-price {
        border-left: none;
        border-top: 1px solid #eee;
        flex-direction: row;
        justify-content: space-around;
        padding: 10px;
        min-width: auto;
    }

    .price-row {
        flex-direction: column;
        text-align: center;
        gap: 2px;
    }

    .apartment-price-block {
        flex-direction: row;
        justify-content: space-around;
    }

    .calendar-container {
        flex-direction: column;
    }

    .legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .guest-form {
        max-width: 100%;
    }
}