/* ============================================================
   CSR Calendar — Modern UI
   ============================================================ */

/* ── Amelia display-name 가로 넘침 방지 ─────────────────── */
#amelia-container span.display-name,
.amelia-v2-booking span.display-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

/* ── 페이지 래퍼 ────────────────────────────────────────── */
.csr-page-wrap {
    background: #f6f8fb;
    min-height: 100vh;
    padding: 48px 24px;
}

.csr-page-inner {
    max-width: 1040px;
    margin: 0 auto;
}

.csr-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 28px;
    letter-spacing: -.3px;
}

/* ── 공간 선택 탭 ───────────────────────────────────────── */
.csr-room-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

@media (max-width: 800px) {
    .csr-room-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .csr-room-tabs::-webkit-scrollbar {
        display: none;
    }
    .csr-room-tab {
        flex-shrink: 0;
    }
}

.csr-room-tab {
    padding: 9px 20px;
    border-radius: 10px;
    border: 1.5px solid #E2E8F0;
    background: #F8FAFC;
    color: #64748B;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all .18s ease;
}

.csr-room-tab:hover {
    border-color: #78b5e3;
    color: #78b5e3;
    background: #eaf5ff;
}

.csr-room-tab.is-active {
    background: #78b5e3;
    border-color: #78b5e3;
    color: #fff;
    font-weight: 600;
}

/* ── 전체 레이아웃 ──────────────────────────────────────── */
.csr-calendar-wrap {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
    font-family: 'Pretendard', 'Noto Sans KR', -apple-system, sans-serif;
}

/* readonly: 오른쪽 패널 없음 → 전체 너비 */
.csr-calendar-wrap[data-readonly="1"] {
    grid-template-columns: 1fr;
}

/* ── 공통 카드 ──────────────────────────────────────────── */
.csr-calendar-left,
.csr-calendar-right {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    box-shadow: none;
    border: 1px solid #E2E8F0;
}

/* ── 왼쪽: 달력 패널 ────────────────────────────────────── */

/* 월 헤더 */
.csr-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.csr-calendar-month {
    font-size: 19px;
    font-weight: 700;
    color: #1E293B;
    letter-spacing: .5px;
}

.csr-cal-prev,
.csr-cal-next {
    width: 34px;
    height: 34px;
    border: none;
    background: #F1F5F9;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #64748B;
    transition: background .18s, color .18s, transform .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.csr-cal-prev:hover,
.csr-cal-next:hover {
    background: #78b5e3;
    color: #fff;
    transform: scale(1.08);
}

/* 요일 행 */
.csr-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 6px;
    border-bottom: 1px solid #F1F5F9;
    padding-bottom: 10px;
}

.csr-calendar-weekdays div {
    font-size: 11px;
    font-weight: 700;
    color: #94A3B8;
    letter-spacing: .8px;
    text-transform: uppercase;
}

/* 날짜 그리드 */
.csr-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(68px, auto);
    gap: 5px;
}

/* 빈 셀 (월 시작 전 여백) */
.csr-cal-empty {
    min-height: 68px;
}

/* 날짜 셀 */
.csr-cal-day {
    border-radius: 12px;
    padding: 8px 2px 7px;
    text-align: center;
    cursor: pointer;
    min-height: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    border: 2px solid transparent;
    background: #F8FAFC;
    transition: all .18s ease;
    position: relative;
}

/* 오늘 날짜 */
.csr-cal-day.is-today {
    border-color: #78b5e3;
}

.csr-cal-day.is-today > span {
    color: #78b5e3;
    font-weight: 700;
}

/* 지난 날짜 */
.csr-cal-day.is-past {
    background: #F8F8F8;
    cursor: not-allowed;
    opacity: 0.45;
}

.csr-cal-day.is-past:hover {
    background: #F8F8F8;
    border-color: transparent;
    transform: none;
    box-shadow: none;
}

.csr-cal-status.csr-status-past {
    background: #F1F5F9;
    color: #CBD5E1;
}

.csr-cal-day:hover {
    background: #eaf5ff;
    border-color: #9cc9e8;
    transform: translateY(-2px);
    box-shadow: none;
}

.csr-cal-day.is-selected {
    background: #eaf5ff;
    border-color: #9cc9e8;
    transform: translateY(-2px);
    box-shadow: none;
}

.csr-cal-day span {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    line-height: 1;
}

/* 상태 뱃지 */
.csr-cal-status {
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: .2px;
    background: #E2E8F0;
    color: #94A3B8;
    white-space: nowrap;
    transition: color .18s, background .18s;
}

.csr-cal-status.csr-status-able {
    background: #DCFCE7;
    color: #15803D;
}

.csr-cal-status.csr-status-full {
    background: #FEE2E2;
    color: #B91C1C;
}

.csr-cal-status.csr-status-blocked {
    background: #F1F5F9;
    color: #CBD5E1;
}

/* 예약된 시간 목록 */
.csr-cal-reserved {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    margin-top: 2px;
}

.csr-cal-reserved-chip {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: #B45309;
    background: #FEF3C7;
    border-radius: 4px;
    padding: 1px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* ── 오른쪽: 시간 선택 패널 ─────────────────────────────── */
.csr-calendar-right {
    position: sticky;
    top: 24px;
}

/* 선택된 날짜 타이틀 */
.csr-selected-date {
    font-size: 15px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #F1F5F9;
}

/* 시간 슬롯 목록 */
.csr-time-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

/* 빈 상태 */
.csr-time-slots .loading {
    color: #94A3B8;
    font-size: 13px;
    text-align: center;
    padding: 24px 0;
}

/* 슬롯 버튼 */
.csr-slot-btn {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #E2E8F0;
    border-radius: 11px;
    background: #F8FAFC;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all .18s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.csr-slot-btn::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    flex-shrink: 0;
    transition: background .18s;
}

.csr-slot-btn:hover:not(.disabled) {
    border-color: #78b5e3;
    background: #eaf5ff;
    color: #5fa4d6;
    transform: translateX(2px);
}

.csr-slot-btn.active {
    background: #78b5e3;
    border-color: #78b5e3;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(120,181,227,.35);
}

.csr-slot-btn.active::before {
    background: rgba(255,255,255,.7);
}

.csr-slot-btn.disabled {
    background: #F8FAFC;
    color: #CBD5E1;
    cursor: not-allowed;
    border-color: #F1F5F9;
    text-decoration: line-through;
}

.csr-slot-btn.disabled::before {
    background: #E2E8F0;
}

/* 선택 요약 */
.csr-selected-summary {
    margin-top: 16px;
    padding: 11px 14px;
    background: #eaf5ff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #5fa4d6;
    border-left: 3px solid #78b5e3;
    min-height: 40px;
    display: flex;
    align-items: center;
}

/* 예약 신청 버튼 */
.csr-submit-reservation {
    width: 100%;
    margin-top: 14px;
    padding: 14px;
    background: #78b5e3;
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s ease;
    letter-spacing: .3px;
    box-shadow: 0 4px 14px rgba(120,181,227,.35);
}

.csr-submit-reservation:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120,181,227,.45);
    background: #5fa4d6;
}

.csr-submit-reservation:active {
    transform: translateY(0);
}

/* 내 예약 칩 */
.csr-cal-reserved-chip.is-mine {
    color: #1D4ED8;
    background: #DBEAFE;
}

/* 내 예약 슬롯 버튼 */
.csr-slot-btn.is-mine {
    background: #EFF6FF;
    border-color: #93C5FD;
    color: #1D4ED8;
    cursor: not-allowed;
}

.csr-slot-btn.is-mine::before {
    background: #3B82F6;
}

/* ── Step 2: 추가 정보 폼 ───────────────────────────────── */
.csr-step2-title {
    font-size: 15px;
    font-weight: 700;
    color: #1E293B;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #F1F5F9;
}

.csr-step2-summary {
    background: #eaf5ff;
    border-left: 3px solid #78b5e3;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #5fa4d6;
    margin-bottom: 18px;
}

.csr-form-field {
    margin-bottom: 14px;
}

.csr-form-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    letter-spacing: .2px;
}

.csr-required {
    color: #EF4444;
    font-size: 13px;
    margin-left: 2px;
}

.csr-form-field input[type="text"],
.csr-form-field input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    font-size: 13px;
    color: #334155;
    background: #F8FAFC;
    box-sizing: border-box;
    transition: border-color .18s;
    outline: none;
}

.csr-form-field input[type="text"]:focus {
    border-color: #78b5e3;
    background: #fff;
}

.csr-form-field input[type="file"] {
    padding: 8px 12px;
    cursor: pointer;
}

.csr-file-hint {
    margin: 5px 0 0;
    font-size: 11px;
    color: #94A3B8;
}

.csr-step2-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

#csr-btn-back {
    flex: 1;
    padding: 11px;
    border: 1.5px solid #E2E8F0;
    border-radius: 11px;
    background: #F8FAFC;
    color: #64748B;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .18s;
}

#csr-btn-back:hover {
    border-color: #78b5e3;
    color: #78b5e3;
}

#csr-btn-final-submit {
    flex: 2;
    padding: 11px;
    background: #78b5e3;
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
}

#csr-btn-final-submit:hover {
    background: #5fa4d6;
}

#csr-btn-final-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── readonly 모드 대관예약하기 버튼 ─────────────────────── */
.csr-reserve-link-btn {
    display: block;
    margin-top: 20px;
    padding: 14px;
    background: #78b5e3;
    color: #fff;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    letter-spacing: .3px;
    box-shadow: 0 4px 14px rgba(120,181,227,.35);
    transition: all .2s ease;
}

.csr-reserve-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(120,181,227,.45);
    background: #5fa4d6;
    color: #fff;
}

/* Amelia catalogbooking 기존 버튼 숨김 */
.am-fcis__header-action {
    display: none !important;
}

/* ── 범례 ────────────────────────────────────────────────── */
.csr-legend {
    display: flex;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #F1F5F9;
    flex-wrap: wrap;
}

.csr-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #64748B;
    font-weight: 500;
}

.csr-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* ── 예약 완료 모달 ─────────────────────────────────────── */
.csr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.csr-modal-box {
    position: relative;
    width: 100%;
    max-width: 460px;
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    font-family: 'Pretendard', 'Noto Sans KR', -apple-system, sans-serif;
}

.csr-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,.3);
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background .15s;
}

.csr-modal-close:hover {
    background: rgba(255,255,255,.5);
}

/* 상단 헤더 */
.csr-modal-header {
    background: linear-gradient(160deg, #78b5e3 0%, #5fa4d6 100%);
    padding: 36px 28px 28px;
    text-align: center;
    color: #fff;
}

.csr-modal-emoji {
    font-size: 40px;
    margin-bottom: 12px;
    line-height: 1;
}

.csr-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 8px;
    color: #fff;
}

.csr-modal-booking-no {
    font-size: 13px;
    color: rgba(255,255,255,.75);
    margin: 0;
}

/* 캘린더 추가 섹션 */
.csr-modal-cal-section {
    background: linear-gradient(160deg, #78b5e3 0%, #5fa4d6 100%);
    padding: 0 28px 24px;
    text-align: center;
}

.csr-modal-cal-label {
    font-size: 13px;
    color: rgba(255,255,255,.85);
    margin: 0 0 12px;
}

.csr-modal-cal-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.csr-cal-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.csr-cal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,.18);
    color: #334155;
    text-decoration: none;
}

.csr-cal-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #4285F4, #34A853);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csr-cal-icon--outlook {
    background: linear-gradient(135deg, #0078D4, #00BCF2);
}

.csr-cal-icon--yahoo {
    background: linear-gradient(135deg, #6001D2, #9C27B0);
    font-size: 11px;
}

.csr-cal-icon--apple {
    background: linear-gradient(135deg, #555, #222);
    font-size: 16px;
}

/* 예약 상세 정보 카드 */
.csr-modal-details {
    background: #fff;
    padding: 20px 28px;
    border-top: 1px solid #F1F5F9;
}

.csr-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid #F8FAFC;
    font-size: 13px;
}

.csr-modal-row:last-child {
    border-bottom: none;
}

.csr-modal-label {
    color: #64748B;
    font-weight: 500;
}

.csr-modal-value {
    color: #1E293B;
    font-weight: 600;
    text-align: right;
}

/* 하단 버튼 */
.csr-modal-actions {
    display: flex;
    gap: 10px;
    padding: 16px 28px 24px;
    background: #fff;
}

.csr-modal-btn-secondary {
    flex: 1;
    padding: 12px;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    background: #F8FAFC;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all .18s;
}

.csr-modal-btn-secondary:hover {
    border-color: #78b5e3;
    color: #78b5e3;
    text-decoration: none;
}

.csr-modal-btn-primary {
    flex: 2;
    padding: 12px;
    background: #78b5e3;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .18s;
}

.csr-modal-btn-primary:hover {
    background: #5fa4d6;
}

/* ── 반응형 ─────────────────────────────────────────────── */
@media (max-width: 800px) {
    .csr-calendar-wrap {
        grid-template-columns: 1fr;
    }

    .csr-calendar-right {
        position: static;
    }

    .csr-page-wrap {
        padding: 24px 14px;
    }

    .csr-calendar-left,
    .csr-calendar-right {
        padding: 20px;
    }

    .csr-cal-day {
        min-height: 52px;
        padding: 6px 2px 5px;
    }
}

@media (max-width: 480px) {
    .csr-calendar-left {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px 12px;
    }

    .csr-calendar-grid {
        grid-auto-rows: minmax(48px, auto);
    }

    .csr-calendar-header,
    .csr-calendar-weekdays,
    .csr-calendar-grid,
    .csr-legend {
        min-width: 280px;
    }

    .csr-calendar-weekdays div {
        font-size: 10px;
    }

    .csr-cal-empty {
        min-height: 48px;
    }

    .csr-cal-day {
        min-height: 48px;
        padding: 5px 1px 4px;
    }

    .csr-cal-day span {
        font-size: 11px;
    }

    .csr-cal-status {
        font-size: 7px;
        padding: 1px 3px;
    }

    .csr-cal-reserved-chip {
        font-size: 7px;
        padding: 1px 2px;
    }

    .csr-reserve-link-btn {
        font-size: 14px;
        padding: 12px;
    }
}
