/* =========================================================
 * bundle-reservation.css — 세트 예약 모달
 * ========================================================= */

.br-modal {
    position: fixed;
    inset: 0;
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
}
.br-modal.is-hidden { display: none; }

.br-modal-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.br-modal-panel {
    position: relative;
    width: 720px;
    max-width: calc(100vw - 32px);
    /* 폴백: 구형 브라우저(100vh) → 최신 브라우저는 아래 100dvh 로 덮어쓴다.
       dvh 는 실제 보이는 뷰포트를 반영해 모바일 주소창/툴바에 가리지 않는다. */
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── 헤더 ─────────────────────────────────── */
.br-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1.5px solid #E9EEF3;
    flex-shrink: 0;
    background: #fafcfd;
}
.br-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.br-modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1F2A37;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.br-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.br-type-badge.type-COMBO { background: #4aa4b8; }
.br-type-badge.type-BOGO  { background: #e68a3e; }

.br-modal-close {
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: #8794a4;
    cursor: pointer;
    border-radius: 6px;
}
.br-modal-close:hover { background: #eef2f6; color: #333; }

/* ── 본문 ─────────────────────────────────── */
.br-modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background: #f6f9fb;
}

/* ── 캘린더(웹/모바일 세트 모달 상단 날짜 선택기) ── */
.br-datepicker {
    background: #fff;
    border: 1px solid #E0E6EE;
    border-radius: 10px;
    padding: 6px 10px;
    margin-bottom: 14px;
}
.br-datepicker.is-open {
    border-color: #4aa4b8;
    box-shadow: 0 2px 8px rgba(74, 164, 184, 0.15);
}
.br-datepicker.is-locked {
    background: #F8FAFC;
    border-color: #E9EEF3;
}

.br-datepicker-toggle {
    width: 100%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 4px;
    font-size: 17px;
    font-weight: 600;
    color: #1F2A37;
}
.br-datepicker-toggle:disabled {
    cursor: default;
    color: #6b7280;
}
.br-datepicker-icon { font-size: 16px; line-height: 1; }
.br-datepicker-selected { flex: 1 1 auto; text-align: left; }
.br-datepicker-caret {
    font-size: 10px;
    color: #8794a4;
    transition: transform 0.18s ease;
}
.br-datepicker.is-open .br-datepicker-caret { transform: rotate(180deg); }
.br-datepicker.is-locked .br-datepicker-caret { display: none; }

.br-datepicker-body {
    border-top: 1px solid #E9EEF3;
    padding: 8px 4px 4px;
    margin-top: 4px;
}
.br-datepicker-body.is-hidden { display: none; }

.br-cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 6px 8px;
}
.br-cal-month {
    font-size: 18px;
    font-weight: 700;
    color: #262626;
    letter-spacing: 0.2px;
}
.br-cal-nav {
    width: 36px; height: 36px;
    background: transparent;
    border: 0;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #4a5568;
    border-radius: 6px;
    padding: 0;
}
.br-cal-nav:hover { background: #eef2f6; color: #262626; }

.br-cal-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    /* .br-cal-grid 와 gap 을 일치시켜 요일과 일자 컬럼이 세로로 정렬되게 함 */
    gap: 3px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    padding: 6px 0 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.br-cal-dow-sun { color: #DC3B3B; }
.br-cal-dow-sat { color: #3B6EDC; }

.br-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.br-cal-cell {
    /* box-sizing: border-box — 브라우저 기본 button 요소는 content-box 라 border 1.5px 가
       매 셀마다 폭에 더해져 컬럼이 우측으로 밀리는 원인이 됨. border-box 로 강제 정렬. */
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 44px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    color: #262626;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, border-color 0.12s;
    font-family: inherit;
}
.br-cal-cell.is-blank { visibility: hidden; }
.br-cal-cell.is-past  {
    color: #cbd5e0;
    cursor: not-allowed;
}
.br-cal-cell.is-sun:not(.is-past)  { color: #DC3B3B; }
.br-cal-cell.is-sat:not(.is-past)  { color: #3B6EDC; }
.br-cal-cell.is-today:not(.is-selected) {
    border-color: #4aa4b8;
    font-weight: 700;
}
.br-cal-cell:not(:disabled):not(.is-selected):hover {
    background: #F0FAFC;
    border-color: #B0D5DD;
}
.br-cal-cell.is-selected {
    background: #4aa4b8;
    color: #fff !important;
    border-color: #4aa4b8;
    font-weight: 700;
}

.br-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── 그룹 카드 ─────────────────────────── */
.br-group {
    background: #fff;
    border: 1px solid #E0E6EE;
    border-radius: 10px;
    padding: 14px 16px;
}

.br-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.br-group-title {
    font-size: 19px;
    font-weight: 700;
    color: #262626;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.br-group-title .br-group-fac {
    color: #4aa4b8;
}
.br-group-title .br-group-qty {
    background: #E6F5F8;
    color: #2c7a89;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}
.br-group-title .br-group-key {
    background: #FFF4E5;
    color: #b06e2b;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}

.br-group-price {
    font-size: 17px;
    font-weight: 600;
    color: #4A5568;
}

/* ── 그룹 내 라인 (권종) 요약 ───────────── */
.br-group-lines {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #F8FAFC;
    border-radius: 6px;
    font-size: 14px;
    color: #4A5568;
}
.br-group-lines .br-line-item {
    display: flex;
    justify-content: space-between;
}
.br-group-lines .br-line-item em {
    font-style: normal;
    font-weight: 600;
    color: #2D3748;
}

/* ── 슬롯 선택기 ─────────────────────── */
.br-picker-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.br-picker-row label {
    font-size: 16px;
    font-weight: 600;
    color: #4A5568;
    min-width: 50px;
}
.br-date-fixed {
    height: 44px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    background: #E6F5F8;
    color: #2c7a89;
    font-size: 17px;
    font-weight: 600;
}

.br-slot-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.br-slot-list.is-loading,
.br-slot-list.is-empty {
    color: #8794a4;
    font-size: 16px;
    padding: 14px 0;
    text-align: center;
    display: block;
}

.br-slot-btn {
    height: 52px;
    padding: 0 10px;
    border: 1.5px solid #D0D7E0;
    border-radius: 8px;
    background: #fff;
    color: #262626;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.br-slot-btn:hover:not(:disabled):not(.is-selected) {
    border-color: #4aa4b8;
    background: #F0FAFC;
}
.br-slot-btn.is-selected {
    border-color: #4aa4b8;
    background: #4aa4b8;
    color: #fff;
    font-weight: 700;
}
.br-slot-btn:disabled {
    background: #F8F8F8;
    color: #B0B7C0;
    border-color: #E0E6EE;
    cursor: not-allowed;
}
/* 지난 시간 슬롯: disabled 와 같은 톤이지만 "예약마감" 텍스트로 이유가 드러나도록 살짝 강조 */
.br-slot-btn.is-past {
    background: #F2F2F2;
    color: #9A9A9A;
    border-color: #E0E0E0;
    text-decoration: line-through;
}
.br-slot-btn.is-past .br-slot-remain {
    text-decoration: none;
    opacity: 0.9;
}
.br-slot-btn .br-slot-remain {
    display: block;
    font-size: 13px;
    color: inherit;
    opacity: 0.75;
    margin-top: 2px;
    font-weight: 400;
}

/* ── 푸터 ─────────────────────────────── */
.br-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-top: 1.5px solid #E9EEF3;
    background: #fafcfd;
    flex-shrink: 0;
}
.br-summary {
    font-size: 20px;
    font-weight: 700;
    color: #262626;
}
.br-summary #brTotalPrice {
    color: #4aa4b8;
    font-size: 26px;
    margin: 0 2px;
}
.br-actions {
    display: flex;
    gap: 10px;
}
.br-btn {
    padding: 14px 26px;
    border-radius: 8px;
    border: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.br-btn-cancel {
    background: #fff;
    color: #4A5568;
    border: 1.5px solid #D0D7E0;
}
.br-btn-cancel:hover { background: #f5f7fa; }
.br-btn-primary {
    background: #4aa4b8;
    color: #fff;
}
.br-btn-primary:hover:not(:disabled) { background: #3d8e9f; }
.br-btn-primary:disabled {
    background: #B0D5DD;
    cursor: not-allowed;
}

/* =========================================================
 * 모바일 최적화 (≤ 640px)
 *   - 브라우저 상하 크롬(주소창/툴바)에 가리지 않도록 여백 크게
 *   - 헤더/푸터/본문 패딩 축소로 스크롤 가용 공간 확보
 *   - 폰트 크기·버튼 높이도 살짝 축소
 * ========================================================= */
@media (max-width: 640px) {
    .br-modal-panel {
        max-width: calc(100vw - 20px);
        /* 상하 각각 40px씩 여유 → 총 80px 감산 */
        max-height: calc(100vh - 80px);
        max-height: calc(100dvh - 80px);
        border-radius: 12px;
    }

    .br-modal-head {
        padding: 12px 16px;
    }
    .br-modal-title {
        font-size: 16px;
    }
    .br-type-badge {
        padding: 2px 8px;
        font-size: 10px;
    }
    .br-modal-close {
        width: 28px;
        height: 28px;
        font-size: 22px;
    }

    .br-modal-body {
        padding: 12px 14px;
    }
    .br-groups {
        gap: 10px;
    }
    .br-group {
        padding: 12px 14px;
    }
    .br-group-title {
        font-size: 14px;
    }
    .br-group-title .br-group-qty {
        padding: 2px 8px;
        font-size: 12px;
    }
    .br-group-title .br-group-key {
        padding: 2px 8px;
        font-size: 11px;
    }
    .br-group-price {
        font-size: 13px;
    }
    .br-group-lines {
        padding: 6px 10px;
        font-size: 11px;
    }
    .br-picker-row label {
        font-size: 13px;
        min-width: 44px;
    }
    .br-date-fixed {
        height: 38px;
        padding: 0 12px;
        font-size: 14px;
    }
    .br-slot-list {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 5px;
    }
    .br-slot-btn {
        height: 36px;
        font-size: 12px;
    }
    .br-slot-btn .br-slot-remain {
        font-size: 10px;
    }

    .br-modal-foot {
        padding: 10px 14px;
        gap: 8px;
    }
    .br-summary {
        font-size: 13px;
    }
    .br-summary #brTotalPrice {
        font-size: 17px;
    }
    .br-actions {
        gap: 8px;
    }
    .br-btn {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* 모바일 캘린더: 셀 축소, 여백 감소 */
    .br-datepicker { padding: 4px 8px; margin-bottom: 10px; }
    .br-datepicker-toggle { padding: 6px 2px; font-size: 13px; }
    .br-cal-head { padding: 2px 4px 6px; }
    .br-cal-month { font-size: 14px; }
    .br-cal-nav { width: 26px; height: 26px; font-size: 18px; }
    .br-cal-cell { height: 32px; font-size: 12px; border-radius: 6px; }
    .br-cal-dow { font-size: 10px; padding: 4px 0 6px; }
}
