/* =========================
   NAPTÁR MODAL / DAY POPUP
========================= */

.calendar-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 10, 6, 0.55);
    backdrop-filter: blur(4px);
}

.calendar-modal.is-open {
    display: flex;
}

.calendar-modal-dialog {
    width: min(1240px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px;
    background: #f8f4ee;
    border: 1px solid rgba(125, 96, 61, 0.18);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
    position: relative;
}

.calendar-modal-content {
    padding: 0;
}

.calendar-popup-inner {
    display: flex;
    flex-direction: column;
}

.calendar-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 28px 32px 20px;
    border-bottom: 1px solid rgba(125, 96, 61, 0.12);
}

.calendar-popup-header h2 {
    margin: 0 0 6px;
    font-size: 1.8rem;
    line-height: 1.15;
    color: #4d3727;
}

.calendar-popup-header p {
    margin: 0;
    color: #7a6757;
    font-size: 0.96rem;
}

.calendar-close-btn {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(125, 96, 61, 0.18);
    background: #fffaf4;
    color: #6c4e32;
    border-radius: 12px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s ease;
}

.calendar-close-btn:hover {
    background: #f2e7d9;
    transform: translateY(-1px);
}

.calendar-popup-top-note {
    margin: 20px 32px 0;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.45;
    border: 1px solid transparent;
}

.availability-top-note {
    background: #f6efe5;
    border-color: #e2d3bf;
    color: #5f4933;
}

.pending-day-warning {
    background: #fff2df;
    border-color: #f0c98c;
    color: #7a531e;
}

.closed-day-warning {
    background: #fde8e2;
    border-color: #ebb0a3;
    color: #8c3f31;
}

.calendar-day-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding: 20px 32px 0;
}

.calendar-day-kpi {
    background: #fffaf4;
    border: 1px solid rgba(125, 96, 61, 0.12);
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(90, 60, 30, 0.05);
}

.calendar-day-kpi span {
    display: block;
    font-size: 0.82rem;
    color: #8b7766;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.calendar-day-kpi strong {
    display: block;
    color: #4c3626;
    font-size: 1.08rem;
    line-height: 1.3;
}

.calendar-modal-body {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
    gap: 22px;
    padding: 24px 32px 32px;
}

.calendar-modal-column {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.subtle-box,
.calendar-detail-box,
.calendar-form-shell,
.booking-summary-panel {
    background: #fffaf4;
    border: 1px solid rgba(125, 96, 61, 0.12);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(90, 60, 30, 0.05);
}

.subtle-box,
.calendar-detail-box,
.calendar-form-shell {
    padding: 18px;
}

.calendar-detail-box h3,
.calendar-form-title h3 {
    margin: 0 0 10px;
    color: #4d3727;
    font-size: 1.08rem;
}

.calendar-form-title p,
.field-help,
.muted-text {
    color: #86715f;
    font-size: 0.93rem;
    line-height: 1.45;
}

.calendar-detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-detail-item {
    padding: 14px;
    border-radius: 16px;
    background: #f9f3eb;
    border: 1px solid rgba(125, 96, 61, 0.1);
}

.calendar-detail-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.calendar-detail-top strong {
    color: #4d3727;
    line-height: 1.4;
}

.calendar-inline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
}

.badge-approved {
    background: #e7f5ea;
    color: #2f6c3f;
    border: 1px solid #bfe1c7;
}

.badge-pending {
    background: #fff1db;
    color: #86551f;
    border: 1px solid #f0d09c;
}

.booking-summary-panel {
    padding: 18px;
}

.booking-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.booking-summary-item {
    background: #f8f2e8;
    border: 1px solid rgba(125, 96, 61, 0.1);
    border-radius: 16px;
    padding: 14px;
}

.booking-summary-item span {
    display: block;
    font-size: 0.8rem;
    color: #8e7b69;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.booking-summary-item strong {
    color: #4d3727;
    line-height: 1.35;
}

.booking-compact-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #4d3727;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(125, 96, 61, 0.1);
}

.booking-row-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field-block {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field-label {
    color: #5d4533;
    font-size: 0.92rem;
    font-weight: 700;
}

.input,
.booking-compact-form input[type="text"],
.booking-compact-form input[type="email"],
.booking-compact-form input[type="date"],
.booking-compact-form input[type="number"],
.booking-compact-form select,
.booking-compact-form textarea {
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(125, 96, 61, 0.18);
    background: #fff;
    color: #3f2d20;
    padding: 12px 14px;
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.booking-compact-form textarea {
    min-height: 100px;
    resize: vertical;
}

.input:focus,
.booking-compact-form input:focus,
.booking-compact-form select:focus,
.booking-compact-form textarea:focus {
    border-color: #b88b57;
    box-shadow: 0 0 0 3px rgba(184, 139, 87, 0.14);
}

.input.is-invalid,
.booking-compact-form input.is-invalid,
.booking-compact-form select.is-invalid,
.booking-compact-form textarea.is-invalid,
#ajaxRoomChoices.is-invalid {
    border-color: #c94b37 !important;
    box-shadow: 0 0 0 3px rgba(201, 75, 55, 0.14) !important;
    background: #fff8f6;
}

.field-error {
    color: #a63e2d;
    font-size: 0.84rem;
    line-height: 1.35;
    margin-top: 4px;
}

.section-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    background: #f1e7d8;
    color: #6c543d;
    border: 1px solid rgba(125, 96, 61, 0.12);
}

.room-choice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.room-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(125, 96, 61, 0.14);
    background: #fff;
    cursor: pointer;
    transition: 0.2s ease;
}

.room-choice:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(90, 60, 30, 0.08);
}

.room-choice span {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.room-choice strong {
    color: #4d3727;
    font-size: 0.98rem;
    line-height: 1.2;
    margin-bottom: 2px;
}

.room-choice small {
    color: #7c6757;
    line-height: 1.3;
    font-size: 0.86rem;
    margin: 0;
}

.room-price-note,
.room-availability-note {
    font-size: 0.83rem;
}

.room-choice input[type="radio"] {
    margin-top: 3px;
    accent-color: #9a6b35;
    transform: scale(0.95);
}

.room-choice.is-free {
    border-color: #c9dfc9;
    background: #fcfffc;
}

.room-choice.is-busy {
    opacity: 0.88;
    background: #fcf7f2;
}

.room-choice input[disabled] + span {
    opacity: 0.7;
}

.inline-choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 4px;
}

.inline-choice-row label,
.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5f4936;
    font-size: 0.94rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 6px;
}

.button-primary {
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #a1733f, #7d5630);
    color: #fff;
    padding: 13px 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 26px rgba(125, 86, 48, 0.2);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.button-primary:hover {
    transform: translateY(-1px);
}

.button-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.button-secondary {
    border: 1px solid rgba(125, 96, 61, 0.18);
    border-radius: 14px;
    background: #fff;
    color: #5e4734;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s ease;
}

.button-secondary:hover {
    background: #f4ece1;
}

.notice,
.errors-inline,
.calendar-loading {
    margin: 0 0 12px;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 0.94rem;
    line-height: 1.45;
}

.notice {
    background: #eaf6ec;
    color: #2f6c3f;
    border: 1px solid #c9e3cf;
}

.errors-inline {
    background: #fde9e5;
    color: #8b3d2d;
    border: 1px solid #efb7ab;
}

.calendar-loading {
    background: #f7efe4;
    color: #6b5541;
    border: 1px solid #e3d3bf;
}

body.modal-open {
    overflow: hidden;
}

/* =========================
   TERMS MODAL
========================= */

.terms-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 10, 6, 0.45);
    backdrop-filter: blur(3px);
}

.terms-modal.is-open {
    display: flex;
}

.terms-modal-dialog {
    width: min(760px, 100%);
    max-height: 88vh;
    overflow: hidden;
    background: #fffaf4;
    border: 1px solid rgba(125, 96, 61, 0.16);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
}

.terms-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 20px 22px 14px;
    border-bottom: 1px solid rgba(125, 96, 61, 0.1);
}

.terms-modal-header h3 {
    margin: 0;
    color: #4d3727;
    font-size: 1.15rem;
}

.terms-modal-body {
    padding: 18px 22px;
    overflow-y: auto;
}

.terms-rules-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f2e8;
    border: 1px solid rgba(125, 96, 61, 0.1);
    border-radius: 16px;
    padding: 16px;
}

.terms-rules-box p {
    margin: 0;
    color: #5f4936;
    line-height: 1.5;
    font-size: 0.94rem;
}

.terms-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px 20px;
    border-top: 1px solid rgba(125, 96, 61, 0.1);
}

/* =========================
   RESZPONZÍV
========================= */

@media (max-width: 1100px) {
    .calendar-modal-body {
        grid-template-columns: 1fr;
    }

    .calendar-day-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .calendar-modal {
        padding: 12px;
    }

    .calendar-modal-dialog {
        width: 100%;
        max-height: 94vh;
        border-radius: 18px;
    }

    .calendar-popup-header,
    .calendar-day-kpis,
    .calendar-modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .calendar-popup-header {
        padding-top: 18px;
        padding-bottom: 14px;
    }

    .calendar-day-kpis {
        grid-template-columns: 1fr;
        padding-top: 14px;
    }

    .calendar-modal-body {
        padding-top: 16px;
        padding-bottom: 18px;
        gap: 16px;
    }

    .booking-row-2,
    .booking-summary-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        justify-content: stretch;
    }

    .button-primary {
        width: 100%;
    }

    .terms-modal {
        padding: 12px;
    }

    .terms-modal-dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 18px;
    }

    .terms-modal-header,
    .terms-modal-body,
    .terms-modal-actions {
        padding-left: 16px;
        padding-right: 16px;
    }

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

    .button-secondary,
    .terms-modal-actions .button-primary {
        width: 100%;
    }
}