/* CSS: rem 기반 비율 조정 및 반응형 */
html { font-size: 16px; transition: font-size 0.3s, all 0.3s ease; }
body { font-family: 'Malgun Gothic', sans-serif; background: #f4f7f6; color: #222; margin: 0; padding: 0.6rem; }
.wrap { max-width: 45rem; margin: 2.5rem auto; background: #fff; padding: 2rem; border-radius: 1rem; box-shadow: 0 0.3rem 1.2rem rgba(0,0,0,0.1); box-sizing: border-box; }
h2 { text-align: center; font-size: 1.8rem; margin-bottom: 0.6rem; }
.subtitle { text-align: center; color: #d32f2f; font-weight: bold; margin-bottom: 1.5rem; font-size: 1.1rem; word-break: keep-all; }

.accessibility-controls { display: flex; justify-content: flex-end; gap: 0.6rem; margin-bottom: 1rem; align-items: center; }
.accessibility-controls button { background: #333; color: #fff; border: none; padding: 0.5rem 1rem; border-radius: 0.3rem; font-weight: bold; cursor: pointer; font-size: 1rem; }

.tabs { display: flex; border-bottom: 0.2rem solid #eef2f5; margin-bottom: 2rem; }
.tabs a { flex: 1; text-align: center; padding: 1rem; text-decoration: none; color: #555; font-weight: bold; font-size: 1.2rem; transition: 0.2s; }
.tabs a.active { color: #0056b3; border-bottom: 0.2rem solid #0056b3; }

/* 달력 - PC 기본 */
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; padding: 0 0.2rem; }
.calendar-header h3 { margin: 0; font-size: 1.35rem; color: #222; letter-spacing: -0.02em; }
.calendar-header button { padding: 0.5rem 1rem; background: #fff; color: #0056b3; border: 0.1rem solid #cfd8e3; border-radius: 0.6rem; cursor: pointer; font-size: 1rem; font-weight: bold; transition: 0.15s; }
.calendar-header button:hover { background: #0056b3; color: #fff; border-color: #0056b3; }

.days, .dates { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4rem; text-align: center; }
.days { font-size: 0.95rem; margin-bottom: 0.3rem; }
.days div { font-weight: 600; padding: 0.5rem 0; color: #6b7684; letter-spacing: 0.02em; }

.date-box {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 0.35rem;
    border: 0.1rem solid #e6eaef; padding: 0.7rem 0.3rem 0.6rem;
    min-height: 5.5rem;
    cursor: pointer; border-radius: 0.7rem;
    background: #fff; box-sizing: border-box;
    font-size: 1.05rem; font-weight: 600; color: #2b3440;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.date-box:hover:not(.disabled) { border-color: #0056b3; box-shadow: 0 0.2rem 0.6rem rgba(0, 86, 179, 0.12); transform: translateY(-0.1rem); }
.date-box:focus { background: #eef5ff; border-color: #0056b3; }
.date-box.disabled { background: #f7f8fa; color: #b0b8c1; cursor: not-allowed; border-color: #eef0f3; }

.days div:nth-child(7n+1), .dates div:nth-child(7n+1):not(.disabled) { color: #d32f2f; }
.days div:nth-child(7n), .dates div:nth-child(7n):not(.disabled) { color: #0056b3; }

/* 상태 배지 */
.booked-badge {
    display: inline-block; min-width: 3.6rem;
    background: #28a745; color: #fff;
    font-size: 0.78rem; font-weight: 700;
    padding: 0.22rem 0.55rem;
    border-radius: 1rem;
    word-break: keep-all; letter-spacing: -0.01em;
    line-height: 1.3;
}
.booked-badge.full { background: #dc3545; }
.booked-badge.closed { background: #b88a1a; }
.booked-badge.not-open { background: #8a94a0; }

/* 날짜 박스 상태별 배경 */
.date-box.is-closed { background: #fff8e4; color: #8a6914; border-color: #f1dfa6; }
.date-box.is-not-open { background: #fafbfc; color: #6b7684; }

.count-text { font-size: 0.82rem; font-weight: 700; color: #0056b3; letter-spacing: -0.02em; }
.count-text.full { color: #dc3545; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); justify-content: center; align-items: center; z-index: 999; }
.modal-content { background: white; padding: 2rem; border-radius: 1rem; width: 35rem; max-width: 95%; max-height: 90vh; overflow-y: auto; box-sizing: border-box; position: relative; }

.step-container { display: none; } .step-container.active { display: block; }
.info-btn-group { display: flex; gap: 0.3rem; margin-bottom: 0.6rem; }
.details-btn { background: #eef2f5; border: 0.1rem solid #ccc; padding: 0.4rem 0.6rem; border-radius: 0.3rem; font-size: 0.95rem; cursor: pointer; color: #555; }
.details-content { display: none; background: #fff; padding: 1rem; border: 0.1rem solid #ddd; margin-top: 0.3rem; font-size: 0.95rem; border-radius: 0.3rem; color: #444; }
.terms-agree { margin-bottom: 1.2rem; font-weight: bold; font-size: 1.1rem; color: #d32f2f; display: flex; align-items: center; gap: 0.6rem; }

.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 1.1rem; margin-bottom: 0.5rem; font-weight: bold; }
.form-group input, .form-group select { width: 100%; padding: 0.8rem; box-sizing: border-box; border: 0.1rem solid #ccc; border-radius: 0.5rem; font-size: 1.1rem; }

.btn-group { display: flex; justify-content: space-between; margin-top: 2rem; }
.btn-group button { padding: 1rem; width: 48%; border: none; color: white; border-radius: 0.5rem; font-weight: bold; font-size: 1.2rem; cursor: pointer; }
.btn-submit { background: #0056b3; }
.btn-close { background: #6c757d; }

.result-item { border: 0.1rem solid #eef2f5; border-radius: 0.6rem; padding: 1.2rem; margin-bottom: 1rem; background: #fff; }
.result-item h4 { margin: 0 0 1rem 0; color: #0056b3; font-size: 1.3rem; border-bottom: 0.1rem solid #f0f0f0; padding-bottom: 0.6rem; }
.btn-cancel-res { width: 100%; padding: 0.8rem; background: #dc3545; color: white; border: none; border-radius: 0.5rem; font-weight: bold; font-size: 1.1rem; cursor: pointer; margin-top: 1rem; }

.privacy-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; font-size: 0.9rem; text-align: center; }
.privacy-table th, .privacy-table td { border: 0.1rem solid #ccc; padding: 0.6rem; word-break: keep-all; }
.privacy-table th { background: #eef2f5; font-weight: bold; }

.slot-card { flex: 1; border: 0.1rem solid #ddd; border-radius: 0.5rem; padding: 1rem; text-align: center; cursor: pointer; transition: 0.2s; background: #fff; box-sizing: border-box; }
.slot-card.open { border-color: #28a745; }
.slot-card.open:hover { background: #e8f5e9; transform: translateY(-0.2rem); box-shadow: 0 0.2rem 0.5rem rgba(0,0,0,0.1); }
.slot-card.open .status { color: #28a745; font-weight: bold; margin-top: 0.5rem; }
.slot-card.full { background: #f8d7da; cursor: not-allowed; border-color: #f5c6cb; }
.slot-card.full .status { color: #721c24; font-weight: bold; margin-top: 0.5rem; }
.slot-card.closed { background: #eef2f5; cursor: not-allowed; color: #777; }
.slot-card.closed .status { color: #777; margin-top: 0.5rem; }

*:focus { outline: 0.2rem solid #ffc107 !important; outline-offset: 0.1rem; }

@media (max-width: 768px) {
    .wrap { margin: 0.6rem auto; padding: 1.2rem; }
    .tabs a { font-size: 1.1rem; padding: 0.8rem 0.3rem; }
    .days, .dates { gap: 0.25rem; }
    .days { font-size: 0.85rem; }
    .date-box { padding: 0.45rem 0.2rem 0.4rem; min-height: 4.2rem; font-size: 0.95rem; gap: 0.25rem; border-radius: 0.55rem; }
    .booked-badge { font-size: 0.68rem; min-width: 0; padding: 0.15rem 0.4rem; border-radius: 0.8rem; }
    .count-text { font-size: 0.72rem; }
    .btn-group { flex-direction: column; gap: 0.6rem; }
    .btn-group button { width: 100%; padding: 0.9rem; font-size: 1.1rem; }
    .info-btn-group { flex-direction: column; }
    .details-btn { padding: 0.6rem; font-size: 1rem; width: 100%; text-align: center; margin-bottom: 0.3rem; }
}

/* 480px 이하 모바일 */
@media (max-width: 480px) {
    body { padding: 0; background: #fff; }
    .wrap { margin: 0; border-radius: 0; box-shadow: none; padding: 0.5rem; border-top: 0.1rem solid #eef2f5; }
    h2 { font-size: 1.3rem; margin-bottom: 0.3rem; }
    .subtitle { font-size: 0.9rem; margin-bottom: 1rem; }
    .calendar-header { margin-bottom: 0.8rem; }
    .calendar-header h3 { font-size: 1.2rem !important; }
    .calendar-header button { padding: 0.4rem 0.6rem; font-size: 0.9rem; }

    /* 달력 넘침 방지 */
    .days, .dates { gap: 0.2rem; }
    .days { font-size: 0.75rem; }
    .days div { padding: 0.3rem 0; }
    .date-box { padding: 0.35rem 0.1rem 0.3rem; min-height: 3.6rem; font-size: 0.85rem; gap: 0.2rem; border-radius: 0.45rem; }

    /* 배지 및 텍스트 억제 */
    .booked-badge {
        font-size: 0.6rem;
        padding: 0.12rem 0.3rem;
        letter-spacing: -0.03em;
        border-radius: 0.7rem;
        min-width: 0;
    }
    .count-text { font-size: 0.62rem; letter-spacing: -0.03em; }

    /* 모달창 크기 및 여백 압축 */
    .modal-content { padding: 1.2rem 0.8rem; margin: 0.5rem; width: 100%; border-radius: 0.5rem; }
    h3#modalDateTitle { font-size: 1.2rem !important; }
    .privacy-table th, .privacy-table td { padding: 0.3rem 0.2rem; font-size: 0.8rem; letter-spacing: -0.5px; }
    .details-content { font-size: 0.85rem; padding: 0.6rem; }
    .terms-agree { font-size: 0.95rem; }
    .form-group { margin-bottom: 0.8rem; }
    .form-group label { font-size: 1rem; margin-bottom: 0.3rem; }
    .form-group input, .form-group select { padding: 0.5rem; font-size: 0.95rem; }

    /* 모달 내 카드 선택 버튼 텍스트 조절 */
    .slot-card { padding: 0.6rem 0.2rem; }
    .slot-card div { font-size: 0.85rem; letter-spacing: -0.5px; }
    .slot-card .status { font-size: 0.75rem; margin-top: 0.3rem; }
}
