/* ===========================
   약관 페이지 스타일
   =========================== */

/* 메인 컨테이너 */
.terms-main {
    min-height: calc(100vh - 60px);
    background: var(--bg-primary);
    padding: 40px 0 100px;
}

.terms-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 페이지 헤더 */
.terms-page-header {
    text-align: center;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.terms-page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.terms-page-title svg {
    color: var(--color-brand);
}

.terms-page-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* 약관 섹션 */
.terms-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.terms-section:hover {
    border-color: var(--color-brand);
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.1);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.section-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(240, 185, 11, 0.1);
    border-radius: 8px;
    font-size: 20px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 약관 내용 */
.section-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.section-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.section-content h3:first-child {
    margin-top: 0;
}

.section-content p {
    font-size: 14px;
    margin-bottom: 16px;
}

.section-content ul,
.section-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.section-content li {
    font-size: 14px;
    margin-bottom: 8px;
    line-height: 1.6;
}

/* 강조 박스 */
.highlight-box {
    background: rgba(240, 185, 11, 0.1);
    border: 1px solid rgba(240, 185, 11, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.highlight-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-brand);
    margin-bottom: 8px;
}

.highlight-box-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* 경고 박스 */
.warning-box {
    background: rgba(246, 70, 93, 0.1);
    border: 1px solid rgba(246, 70, 93, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.warning-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-sell);
    margin-bottom: 8px;
}

.warning-box-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* 정보 박스 */
.info-box {
    background: rgba(14, 203, 129, 0.1);
    border: 1px solid rgba(14, 203, 129, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.info-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-buy);
    margin-bottom: 8px;
}

.info-box-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

/* 테이블 스타일 */
.terms-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.terms-table thead {
    background: var(--bg-tertiary);
}

.terms-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.terms-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.terms-table tbody tr:last-child td {
    border-bottom: none;
}

.terms-table tbody tr:hover {
    background: var(--bg-hover);
}

/* 동의 체크박스 섹션 */
.agreement-section {
    background: var(--bg-tertiary);
    border: 2px solid var(--color-brand);
    border-radius: 12px;
    padding: 24px;
    margin-top: 40px;
}

.agreement-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
}

.agreement-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.agreement-item:hover {
    background: var(--bg-hover);
}

.agreement-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--color-brand);
}

.agreement-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    cursor: pointer;
}

.agreement-required {
    color: var(--color-sell);
    font-weight: 600;
    margin-left: 4px;
}

/* 버튼 그룹 */
.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.btn-primary {
    padding: 12px 32px;
    background: var(--color-brand);
    color: var(--bg-primary);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(240, 185, 11, 0.3);
}

.btn-primary:disabled {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    padding: 12px 32px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
}

/* 최종 업데이트 날짜 */
.terms-update-date {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

/* 네비게이션 탭 (여러 약관이 있을 경우) */
.terms-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    padding: 4px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.terms-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.terms-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.terms-tab.active {
    background: var(--color-brand);
    color: var(--bg-primary);
}

/* 아코디언 스타일 (FAQ 등) */
.accordion-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.accordion-header:hover {
    background: var(--bg-hover);
}

.accordion-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.accordion-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
}

.accordion-body {
    padding: 0 20px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===========================
   모바일 최적화
   =========================== */
@media (max-width: 768px) {
    .terms-main {
        padding: 20px 0 80px; /* 바텀 네비게이션 공간 */
    }
    
    .terms-container {
        padding: 0 16px;
    }
    
    /* 페이지 헤더 모바일 */
    .terms-page-header {
        margin-bottom: 30px;
        padding-bottom: 20px;
    }
    
    .terms-page-title {
        font-size: 24px;
    }
    
    .terms-page-desc {
        font-size: 14px;
    }
    
    /* 약관 섹션 모바일 */
    .terms-section {
        padding: 20px 16px;
        margin-bottom: 16px;
        border-radius: 8px;
    }
    
    .section-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .section-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    /* 모바일 텍스트 가독성 향상 */
    .section-content {
        font-size: 14px;
        line-height: 1.8;
    }
    
    .section-content h3 {
        font-size: 15px;
        margin: 20px 0 10px;
    }
    
    .section-content p {
        font-size: 14px;
        margin-bottom: 14px;
        text-align: justify; /* 양쪽 정렬로 가독성 향상 */
    }
    
    .section-content ul,
    .section-content ol {
        padding-left: 20px;
    }
    
    .section-content li {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    /* 박스 모바일 최적화 */
    .highlight-box,
    .warning-box,
    .info-box {
        padding: 14px;
        margin: 16px 0;
    }
    
    .highlight-box-title,
    .warning-box-title,
    .info-box-title {
        font-size: 13px;
    }
    
    .highlight-box-content,
    .warning-box-content,
    .info-box-content {
        font-size: 12px;
    }
    
    /* 테이블 모바일 최적화 - 가로 스크롤 */
    .terms-table-wrapper {
        overflow-x: auto;
        margin: 16px -16px;
        padding: 0 16px;
    }
    
    .terms-table {
        min-width: 500px;
        font-size: 12px;
    }
    
    .terms-table th,
    .terms-table td {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    /* 탭 모바일 */
    .terms-tabs {
        gap: 4px;
        margin-bottom: 20px;
        padding: 3px;
    }
    
    .terms-tab {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* 동의 섹션 모바일 */
    .agreement-section {
        padding: 20px 16px;
        margin-top: 30px;
    }
    
    .agreement-title {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    .agreement-item {
        padding: 10px;
    }
    
    .agreement-checkbox {
        width: 18px;
        height: 18px;
    }
    
    .agreement-label {
        font-size: 13px;
    }
    
    /* 버튼 모바일 */
    .button-group {
        flex-direction: column;
        margin-top: 20px;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }
    
    /* 아코디언 모바일 */
    .accordion-header {
        padding: 14px 16px;
    }
    
    .accordion-title {
        font-size: 14px;
    }
    
    .accordion-body {
        padding: 0 16px 16px;
        font-size: 13px;
    }
    
    /* 최종 업데이트 날짜 */
    .terms-update-date {
        margin-top: 30px;
        padding-top: 16px;
        font-size: 12px;
    }
}

/* 작은 모바일 기기 (iPhone SE 등) */
@media (max-width: 375px) {
    .terms-page-title {
        font-size: 20px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .section-content {
        font-size: 13px;
    }
    
    .section-content p {
        font-size: 13px;
    }
    
    .section-content li {
        font-size: 13px;
    }
}

/* 다크모드 대응 */
@media (prefers-color-scheme: dark) {
    .terms-section {
        background: var(--bg-secondary);
    }
    
    .section-content {
        color: var(--text-secondary);
    }
}

/* 프린트 스타일 */
@media print {
    .terms-main {
        padding: 20px;
    }
    
    .terms-section {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .button-group,
    .agreement-section {
        display: none;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.terms-section {
    animation: fadeIn 0.3s ease-out;
}

/* 스크롤바 커스터마이징 */
.terms-container::-webkit-scrollbar {
    width: 8px;
}

.terms-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.terms-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.terms-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}