/* plans.css */

:root {
    --purple: #6A34FF;
    --light-purple: #DBC9FF;
    --bg-grey: #ECEFF5;
    --text-dark: #000000;
    --text-grey: #4E4E4E;
    --text-light: #A4A4A4;
    --card-shadow: 0px 4px 40px 10px rgba(0, 0, 0, 0.05);
}

.plans-container {
    min-height: 100vh;
    font-family: 'Montserrat', sans-serif;
}

/* Header */
.plans-header .nav-bar {
    background: #fff;
    border-bottom: 2px solid #CDCDCD;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 70px;
    /* Scaled from 149px design for usable web height */
}

.nav-back-btn {
    background: none;
    border: none;
    cursor: pointer;
}

.nav-back-btn img {
    width: 24px;
    height: auto;
}

.nav-actions {
    display: flex;
    gap: 15px;
}

.nav-icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #000;
    cursor: pointer;
}

/* Content */
.plans-container {
    background: #FFFFFF;
    /* 상단 영역 포함 기본 배경은 흰색 */
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
}

.plans-content {
    padding: 30px 0 0;
    /* 하단 패딩 제거 */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.section-title-area,
.payment-toggle-area,
.carrier-tabs-area,
.load-more-area {
    padding-left: 20px;
    padding-right: 20px;
}

/* Category Tabs (Swiper) */
.category-tabs {
    width: 100%;
    margin-bottom: 5.333cqw;
    padding: 0 20px;
    overflow: hidden;
    /* Swiper가 제어하므로 hidden */
}

.category-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari 스크롤바 숨기기 */
}

.category-item {
    width: 27.2cqw !important;
    /* 고정 너비 강제 */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.category-box {
    width: 27.2cqw;
    /* 204px */
    height: 30.4cqw;
    /* 228px */
    background: var(--purple);
    border-radius: 2.666cqw;
    /* 20px */
    display: flex;
    flex-direction: column;
    /* 세로 배치 */
    align-items: center;
    justify-content: space-between;
    /* 상단과 하단 끝에 배치 */
    padding: 5.466cqw 0 4.533cqw;
    /* 상단 41px, 하단 34px 패딩 */
    transition: all 0.3s;
}

.category-box.grey {
    background: #ECEFF5;
}

.category-box img {
    width: 12.933cqw;
    /* 97px */
    height: 12.933cqw;
    /* 97px */
    object-fit: contain;
}

.category-item.active span {
    color: #FFFFFF;
    /* 활성화 시 흰색 */
    font-weight: 600;
}

.category-item:not(.active) span {
    color: #4E4E4E;
}

/* Section Title & Filter Button */
.section-title-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title-area h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0;
}

.btn-filter-sort {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 20px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Implementation */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    justify-content: center;
    align-items: center;
    /* Centered alignment */
}

.modal-content.centered {
    width: 90%;
    max-width: 500px;
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay.active .modal-content.centered {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}

.modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 5px;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.filter-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.range-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--purple);
}

/* Dual Range Slider Styles */
.range-slider-container {
    position: relative;
    width: 100%;
    height: 60px;
    /* Increased height to accommodate labels */
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    z-index: 1;
}

/* The actual inputs */
.range-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    z-index: 2;
    margin: 0;
}

/* Slider Labels */
.slider-labels {
    position: absolute;
    top: 45px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    /* Match thumb radius roughly */
    box-sizing: border-box;
}

.slider-labels span {
    font-size: 11px;
    color: #999;
    flex: 1;
    text-align: center;
    position: relative;
}

.slider-labels span:first-child {
    text-align: left;
    margin-left: -5px;
}

.slider-labels span:last-child {
    text-align: right;
    margin-right: -5px;
}

/* Chrome/Safari Thumbs */
.range-input::-webkit-slider-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--purple);
    cursor: pointer;
    pointer-events: auto;
    -webkit-appearance: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    margin-top: 0;
    /* Align with track center */
}

/* Firefox Thumbs */
.range-input::-moz-range-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--purple);
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    padding: 8px 16px;
    background: #f5f5f5;
    border: 1px solid #f5f5f5;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip.active {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
    font-weight: 600;
}

.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.btn-reset {
    flex: 1;
    height: 52px;
    background: #f5f5f5;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
}

.btn-apply-filter {
    flex: 2;
    height: 52px;
    background: var(--purple);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
}

/* 결제 방식 토글 */
.payment-toggle-area {
    margin-bottom: 5.333cqw;
}

.payment-toggle {
    display: flex;
    gap: 1.733cqw;
    /* 약 13px */
}

.toggle-btn {
    flex: 1;
    height: 8.933cqw;
    /* 67px / 750px */
    border: 2px solid #CDCDCD;
    background: #fff;
    border-radius: 6.666cqw;
    /* 50px */
    font-size: 4cqw;
    /* 30px / 750px */
    font-weight: 400;
    color: var(--text-grey);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
}

.toggle-btn.active {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
    font-weight: 600;
}

/* 통신사 탭 */
.carrier-tabs-area {
    position: relative;
    margin-bottom: 0;
    /* 하단 마진 제거 */
    padding: 0 6.133cqw;
    /* 디자인 기준 패딩 */
}

.carrier-tabs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4.933cqw;
    /* 37px / 750px */
    margin-bottom: 16px;
    /* 탭과 인디케이터 사이 간격 */
}

.carrier-tab {
    background: none;
    border: none;
    font-size: 4cqw;
    /* 30px / 750px */
    width: 25%;
    /* 너비 25% 고정 */
    font-weight: 400;
    color: var(--text-grey);
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Montserrat', sans-serif;
    text-align: center;
}

.carrier-tab.disabled {
    opacity: 0.2;
    cursor: default;
    pointer-events: none;
}

.carrier-tab.active {
    color: var(--text-dark);
    font-weight: 600;
}

.carrier-indicator {
    position: absolute;
    bottom: 0px;
    /* 16px 정렬 */
    height: 1.066cqw;
    /* 8px 디자인 반영 */
    background: var(--purple);
    transition: all 0.3s;
    /* width 설정은 JS에서 동적으로 처리하거나 패딩 내에서 계산 */
}

/* 요금제 리스트 */
.plans-list {
    background: #ECEFF5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7.333cqw;
    /* 55px 디자인상 카드 간격 추정 */
    padding: 40px 0;
    flex: 1;
    /* 남은 공간을 모두 채움 */
    width: 100%;
}

.plan-card {
    width: 90.933cqw;
    /* 682px / 750px */
    background: #FFFFFF;
    box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.05);
    border-radius: 5.333cqw;
    /* 40px */
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.plan-body {
    flex: 1;
    padding: 4.266cqw 4.533cqw;
    /* 32px 34px 추정 */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-end;
    /* 우측 정렬 */
}

/* 뱃지 영역 */
.plan-badge-area {
    position: absolute;
    top: 4.266cqw;
    /* 32px */
    left: 4.133cqw;
    /* 31px */
    display: flex;
    flex-direction: column;
    gap: 1.333cqw;
    /* 10px */
}

.plan-badge-box {
    width: 13.2cqw;
    /* 99px */
    height: 6.266cqw;
    /* 47px */
    border-radius: 1.333cqw;
    /* 10px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.plan-badge-box.tele {
    background: #DBC9FF;
}

.plan-badge-box.network.three-g {
    background: #FFF4E0;
    /* 3G 연주황 */
}

.plan-badge-box.network.lte {
    background: #E8F5E9;
    /* LTE 연초록 */
}

.plan-badge-box.network.five-g {
    background: #E0F2FE;
    /* 5G 연파랑 */
}

.plan-badge-text {
    font-family: 'Montserrat';
    font-weight: 700;
    font-size: 2.933cqw;
    /* 22px */
    color: #6A34FF;
}

.plan-badge-box.network.three-g .plan-badge-text {
    color: #FF9800;
}

.plan-badge-box.network.lte .plan-badge-text {
    color: #43A047;
}

.plan-badge-box.network.five-g .plan-badge-text {
    color: #0284C7;
}

.plan-name {
    font-family: 'Montserrat';
    font-weight: 700;
    font-size: 4.666cqw;
    line-height: 1.2;
    color: #000000;
    margin-bottom: 2.666cqw;
    /* 20px */
    text-align: right;
    width: 100%;
    padding-left: 15cqw;
    /* 배지 너비(13.2cqw) + 여백 고려 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-details {
    font-family: 'Montserrat';
    font-weight: 500;
    font-size: 3.466cqw;
    /* 26px */
    color: #A4A4A4;
    margin-bottom: 2.666cqw;
    text-align: right;
}

.plan-details .label {
    color: #A4A4A4;
}

.plan-details .value {
    color: #000000;
}

.plan-price-area {
    text-align: right;
}

.plan-price {
    font-family: 'Montserrat';
    font-weight: 700;
    font-size: 5.333cqw;
    /* 55px / 750px */
    color: #6A34FF;
    line-height: 1.2;
}

.plan-price-label {
    font-size: 13px;
    color: var(--text-grey);
    margin-bottom: 5px;
    display: inline-block;
}

.plan-contract-info {
    font-size: 14px;
    color: var(--text-grey);
}

/* Plan grid format (SKT style in design) */
.plan-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--bg-grey);
}

.grid-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.grid-row .label {
    color: var(--text-grey);
}

.grid-row .value {
    font-weight: 500;
    text-align: right;
}

/* Card Actions */
.plan-actions {
    display: flex;
    height: 14.4cqw;
    /* 108px */
    width: 100%;
}

.btn-detail {
    width: 31.524%;
    /* 215px / 682px */
    background: #D4D4D4;
    border: none;
    color: #555555;
    font-family: 'Montserrat';
    font-weight: 500;
    font-size: 3.8cqw;
    /* 36px */
    cursor: pointer;
    border-radius: 0 0 0 5.333cqw;
    /* 왼쪽 하단 40px */
}

.btn-apply {
    width: 68.476%;
    /* 467px / 682px */
    background: var(--purple);
    border: none;
    color: #FFFFFF;
    font-family: 'Montserrat';
    font-weight: 700;
    font-size: 4.8cqw;
    /* 36px */
    cursor: pointer;
    border-radius: 0 0 5.333cqw 0;
    /* 오른쪽 하단 40px */
}

/* Full Apply button for recommendation */
.btn-apply-full {
    width: 100%;
    background: var(--purple);
    border: none;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding: 18px 0;
    cursor: pointer;
}

.detail-link-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
    gap: 8px;
    cursor: pointer;
    color: var(--text-grey);
}

.detail-link-area span {
    font-size: 16px;
}

.detail-link-area i {
    font-size: 14px;
}

/* More Button */
.load-more-area {
    display: flex;
    justify-content: center;
    padding: 0 20px 80px;
    background: #ECEFF5;
}

.btn-more {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-family: 'Montserrat';
    padding: 10px;
    box-shadow: none;
    gap: 1.333cqw;
    /* 10px / 750px */
}

.btn-more span {
    font-weight: 400;
    font-size: 4cqw;
    /* 30px / 750px */
    color: #4E4E4E;
    line-height: 1.2;
}

.btn-more .icon-arrow {
    width: 3.2cqw;
    /* 약 24px */
    height: 3.2cqw;
    object-fit: contain;
    transform: rotate(180deg);
    /* 디자인 스펙 반영 */
    opacity: 0.5;
    /* #CDCDCD 느낌을 위해 불투명도 조절 또는 필터 사용 */
}

.loading-state {
    text-align: center;
    padding: 50px 0;
    color: var(--text-grey);
}

/* ===== Plan Card Clickable ===== */
.plan-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.08);
}

.plan-card:focus-visible {
    outline: 2px solid var(--purple);
    outline-offset: 2px;
}

/* ===== Plan Detail Modal ===== */
.plan-detail-modal {
    max-width: 520px;
}

.plan-detail-modal .modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pd-badges .plan-badge-box {
    width: auto;
    height: auto;
    padding: 6px 14px;
    border-radius: 8px;
}

.pd-badges .plan-badge-text {
    font-size: 13px;
}

.pd-price-area {
    margin-bottom: 18px;
    padding: 18px 16px;
    background: #F8F6FF;
    border-radius: 14px;
    text-align: right;
}

.pd-price-original {
    font-size: 13px;
    color: #999;
    margin-bottom: 4px;
}

.pd-price {
    font-size: 26px;
    font-weight: 700;
    color: var(--purple);
}

.pd-price-unit {
    font-size: 15px;
    color: #555;
    font-weight: 500;
    margin-left: 2px;
}

.pd-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    padding: 12px 14px;
    background: #FAFAFA;
    border-radius: 10px;
    margin-bottom: 18px;
    white-space: pre-wrap;
    word-break: break-word;
}

.pd-section {
    margin-bottom: 20px;
}

.pd-section:last-child {
    margin-bottom: 0;
}

.pd-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #EEE;
}

.pd-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.pd-label {
    color: #777;
}

.pd-value {
    color: #111;
    font-weight: 600;
}

.pd-gift-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pd-gift-list li {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #FFF7E6;
    border-radius: 10px;
    border-left: 3px solid #FFB84D;
}

.pd-gift-list li:last-child {
    margin-bottom: 0;
}

.pd-gift-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
}

.pd-gift-content {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.pd-notice {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    padding: 12px 14px;
    background: #FFF5F5;
    border-radius: 10px;
    border-left: 3px solid #FF6B6B;
    white-space: pre-wrap;
    word-break: break-word;
}

.plan-detail-modal .modal-footer {
    border-top: 1px solid #f0f0f0;
}

.plan-detail-modal #btnActivatePlan {
    width: 100%;
    flex: 1 1 100%;
}