/**
 * 컨텐츠 구매 모달 스타일
 * - 결제 확인 모달
 * - 결제 수단 선택
 */

/* 모달 오버레이 */
.purchase-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.purchase-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 모달 컨테이너 */
.purchase-modal {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.purchase-modal-overlay.active .purchase-modal {
    transform: translateY(0);
}

/* 모달 헤더 */
.purchase-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.purchase-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.purchase-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.purchase-modal-close:hover {
    background: #f5f5f5;
}

.purchase-modal-close svg {
    width: 20px;
    height: 20px;
    stroke: #666;
}

/* 모달 바디 */
.purchase-modal-body {
    padding: 16px 20px;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

/* 컨텐츠 정보 - 가로 배치 */
.purchase-content-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 16px;
}

.purchase-content-thumbnail {
    width: 140px;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
}

.purchase-content-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    font-size: 13px;
    pointer-events: none;
}

.purchase-content-details {
    flex: 1;
    min-width: 0;
}

.purchase-content-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px;
    word-break: break-word;
}

.purchase-content-owner {
    font-size: 12px;
    color: #666;
    margin: 0;
}

/* 가격 정보 */
.purchase-price-section {
    padding: 12px 16px;
    background: #ff6c0f;
    border-radius: 12px;
    margin-bottom: 12px;
    color: #fff;
    text-align: center;
}

.purchase-price-label {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.purchase-price-value {
    font-size: 24px;
    font-weight: 700;
}

.purchase-price-value.free {
    color: #4ade80;
}

/* 결제 방식 선택 탭 */
.payment-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.payment-type-tab {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.payment-type-tab:hover {
    background: #eee;
}

.payment-type-tab.active {
    background: #fff5ef;
    border-color: #ff6c0f;
    color: #ff6c0f;
}

.payment-type-tab svg {
    flex-shrink: 0;
}

/* 결제 섹션 */
.payment-section {
    margin-bottom: 16px;
}

.payment-section-desc {
    font-size: 13px;
    color: #666;
    text-align: center;
    padding: 20px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 0;
    line-height: 1.5;
}

/* 결제 수단 섹션 */
.purchase-payment-section {
    margin-bottom: 20px;
}

.purchase-payment-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px;
}

/* 결제 수단 카드 */
.payment-method-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.payment-method-card:hover {
    background: #f0f0f0;
}

.payment-method-card.selected {
    background: #f0f4ff;
    border-color: #667eea;
}

.payment-method-icon {
    width: 40px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
}

.payment-method-info {
    flex: 1;
}

.payment-method-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
}

.payment-method-number {
    font-size: 12px;
    color: #666;
}

.payment-method-check {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.payment-method-card.selected .payment-method-check {
    background: #667eea;
    border-color: #667eea;
}

.payment-method-card.selected .payment-method-check svg {
    stroke: #fff;
}

/* 결제 수단 없음 */
.no-payment-method {
    text-align: center;
    padding: 24px 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.no-payment-method p {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px;
}

.btn-register-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #777;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-register-card:hover {
    background: #555;
}

/* 모달 푸터 */
.purchase-modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
}

.btn-purchase-cancel {
    flex: 1;
    padding: 14px;
    background: #f5f5f5;
    color: #666;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-purchase-cancel:hover {
    background: #e8e8e8;
}

.btn-purchase-confirm {
    flex: 2;
    padding: 14px;
    background: #ff6c0f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-purchase-confirm:hover {
    opacity: 0.9;
}

.btn-purchase-confirm:active {
    transform: scale(0.98);
}

.btn-purchase-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-purchase-confirm.loading {
    pointer-events: none;
}

/* 로딩 스피너 */
.purchase-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.purchase-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 이미 구매한 경우 */
.already-purchased {
    text-align: center;
    padding: 32px 20px;
}

.already-purchased-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: #e8f5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.already-purchased-icon svg {
    width: 32px;
    height: 32px;
    stroke: #4caf50;
}

.already-purchased h4 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px;
}

.already-purchased p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* 포인트 결제 섹션 */
.point-payment-info {
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.point-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.point-balance-row+.point-balance-row {
    border-top: 1px solid #eee;
}

.point-balance-label {
    font-size: 14px;
    color: #666;
}

.point-balance-value {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.point-use-value {
    font-size: 16px;
    font-weight: 600;
    color: #ff6c0f;
}

.point-after-row {
    border-top: 2px solid #ddd !important;
    margin-top: 4px;
    padding-top: 12px !important;
}

.point-after-value {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}

.point-after-value.insufficient {
    color: #ef4444;
}

.point-insufficient-msg {
    margin: 12px 0 0;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    color: #ef4444;
    text-align: center;
}

/* 시청 유효기간 */
.purchase-validity-section {
    padding: 10px 16px;
    background: #f0f4ff;
    border-radius: 10px;
    margin-bottom: 12px;
    text-align: center;
}

.purchase-validity-value {
    font-size: 14px;
    color: #1a1a1a;
}

/* 반응형 */
@media (max-width: 480px) {
    .purchase-modal {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .purchase-content-thumbnail {
        width: 110px;
        border-radius: 6px;
    }

    .purchase-content-title {
        font-size: 14px;
    }
}
