/**
 * 마이페이지 결제 관리 스타일 (토스 디자인 시스템)
 *
 * @package Terra_TossPay
 */

/* =============================================================================
   결제 관리 래퍼
   ============================================================================= */
.billing-management-wrapper {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 빈 <p> 태그 숨김 (wpautop 자동 생성분) */
.billing-management-wrapper p:empty {
    display: none;
}

/* =============================================================================
   섹션 카드 (토스 스타일)
   ============================================================================= */
.billing-section {
    background: #fff;
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 0;
    border: 1px solid #E5E8EB;
    box-shadow: none;
    align-self: start;
}

.billing-section h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F2F4F6;
    color: #191F28;
    letter-spacing: -0.02em;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #F2F4F6;
}

.section-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

.section-header .button {
    background: #F2F4F6 !important;
    color: #191F28 !important;
    border: none !important;
    font-weight: 600 !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    box-shadow: none !important;
    transition: all 0.15s ease;
}

.section-header .button:hover {
    background: #E5E8EB !important;
    transform: none;
}

/* =============================================================================
   결제 카드 (토스 스타일)
   ============================================================================= */
.payment-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: #FAFBFC;
    border-radius: 12px;
    border: 1px solid #E5E8EB;
    transition: all 0.15s ease;
}

.payment-card:hover {
    background: #F2F4F6;
}

.payment-card.is-default {
    border: 2px solid #0064FF;
    background: #F0F7FF;
}

.card-icon {
    width: 52px;
    height: 36px;
    background: linear-gradient(135deg, #191F28 0%, #333D4B 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-brand {
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.card-brand.visa::after { content: 'VISA'; }
.card-brand.mastercard::after { content: 'MC'; color: #ff5f00; }
.card-brand.amex::after { content: 'AMEX'; }
.card-brand.jcb::after { content: 'JCB'; }

.card-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-name {
    font-weight: 600;
    font-size: 15px;
    color: #191F28;
}

.default-badge {
    background: #0064FF;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.card-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.set-default-card {
    color: #0064FF;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
}

.set-default-card:hover {
    text-decoration: underline;
}

/* === 삭제 버튼 숨김 (빌링키는 토스에서 유지됨) === */
.delete-card,
.woocommerce-PaymentMethods .button.delete,
.woocommerce-MyAccount-paymentMethods .delete {
    display: none !important;
}

/* === 구독 취소 버튼 숨김 === */
.button-cancel,
.cancel-subscription,
.subscription-cancel {
    display: none !important;
}

/* =============================================================================
   테이블 스타일 (토스 스타일)
   ============================================================================= */
.billing-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.billing-table th,
.billing-table td {
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid #F2F4F6;
}

.billing-table th {
    font-weight: 600;
    color: #6B7684;
    font-size: 13px;
    background: #FAFBFC;
    letter-spacing: -0.01em;
}

.billing-table th:first-child {
    border-radius: 8px 0 0 8px;
}

.billing-table th:last-child {
    border-radius: 0 8px 8px 0;
}

.billing-table td {
    font-size: 14px;
    color: #333D4B;
    vertical-align: middle;
}

.billing-table tbody tr {
    transition: background 0.15s ease;
}

.billing-table tbody tr:hover {
    background: #FAFBFC;
}

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

.billing-cycle {
    color: #8B95A1;
    font-size: 12px;
    font-weight: 500;
}

/* =============================================================================
   상태 배지 (토스 스타일)
   ============================================================================= */
.status-badge,
.order-status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.status-trial {
    background: #FFF8E1;
    color: #F59F00;
}
.status-active,
.status-processing,
.status-completed {
    background: #E8F5E9;
    color: #2E7D32;
}
.status-pending_cancel {
    background: #FFF3E0;
    color: #E65100;
}
.status-cancelled,
.status-failed,
.status-refunded {
    background: #FFEBEE;
    color: #C62828;
}
.status-expired {
    background: #F5F5F5;
    color: #616161;
}
.status-pending,
.status-on-hold {
    background: #E3F2FD;
    color: #1565C0;
}

.end-date {
    color: #E65100;
    font-weight: 600;
    font-size: 14px;
}

.end-label {
    display: block;
    font-size: 11px;
    color: #8B95A1;
    margin-top: 2px;
}

/* =============================================================================
   버튼 스타일
   ============================================================================= */
.button-small {
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
}

.button-cancel {
    background: #fff !important;
    color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
}

.button-cancel:hover {
    background: #dc3545 !important;
    color: #fff !important;
}

.button-primary {
    background: #0064FF !important;
    color: #fff !important;
    border: none !important;
}

.actions {
    text-align: right;
}

.actions .button {
    background: #F2F4F6 !important;
    color: #333D4B !important;
    box-shadow: none !important;
}

.actions .button:hover {
    background: #E5E8EB !important;
}

/* =============================================================================
   빈 상태
   ============================================================================= */
.billing-section .empty-message {
    color: #8B95A1;
    text-align: center;
    padding: 48px 24px;
    font-size: 15px;
    background: #FAFBFC;
    border-radius: 12px;
    border: 1px dashed #E5E8EB;
}

/* =============================================================================
   반응형: 모바일
   ============================================================================= */
@media (max-width: 600px) {
    /* 모바일에서는 1열 세로 배치 */
    .billing-management-wrapper {
        grid-template-columns: 1fr;
    }

    .billing-management-wrapper .billing-section:nth-child(3) {
        grid-column: auto;
    }

    /* 섹션 카드 - 꽉 차게 */
    .billing-section {
        padding: 20px;
        margin-bottom: 16px;
        border-radius: 0;
        margin-left: -16px;
        margin-right: -16px;
        border-left: none;
        border-right: none;
    }

    .billing-section h2 {
        font-size: 17px;
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .section-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .section-header .button {
        padding: 12px 18px !important;
        font-size: 14px !important;
    }

    /* 결제 카드 */
    .payment-cards {
        gap: 12px;
    }

    .payment-card {
        padding: 18px 16px;
        border-radius: 12px;
        gap: 14px;
    }

    .card-icon {
        width: 48px;
        height: 32px;
    }

    .card-name {
        font-size: 15px;
    }

    .default-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    .set-default-card {
        font-size: 14px;
    }

    /* 테이블 - 가로 스크롤 */
    .billing-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -20px;
        margin-right: -20px;
        padding-left: 20px;
        padding-right: 20px;
    }

    .billing-table th,
    .billing-table td {
        white-space: nowrap;
        padding: 14px 12px;
        font-size: 14px;
    }

    .billing-table th {
        font-size: 13px;
        background: #F8F9FA;
    }

    /* 상태 배지 */
    .status-badge,
    .order-status {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* 버튼 */
    .button-small {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }

    /* 빈 상태 */
    .billing-section .empty-message {
        padding: 32px 20px;
        font-size: 14px;
    }
}
