/**
 * 마이페이지 결제 관리 스타일
 *
 * @package Terra_TossPay
 */

/* === 결제 관리 래퍼 === */
.billing-management-wrapper {
    max-width: 100%;
}

/* === 섹션 카드 === */
.billing-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.billing-section h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    color: #191f28;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.section-header h2 {
    margin: 0;
    padding: 0;
    border: none;
}

/* === 결제 카드 === */
.payment-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.payment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    min-width: 280px;
    flex: 1;
}

.payment-card.is-default {
    border: 2px solid #0064FF;
    background: #f0f7ff;
}

.card-icon {
    width: 48px;
    height: 32px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-brand {
    color: #fff;
    font-size: 9px;
    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: 8px;
}

.card-name {
    font-weight: 500;
    font-size: 14px;
}

.default-badge {
    background: #0064FF;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
}

.card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.set-default-card {
    color: #0064FF;
    font-size: 13px;
    text-decoration: none;
}

.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: collapse;
}

.billing-table th,
.billing-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.billing-table th {
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.billing-table td {
    font-size: 14px;
    color: #333;
}

.billing-table tbody tr:hover {
    background: #f9f9f9;
}

.billing-cycle {
    color: #888;
    font-size: 11px;
}

/* === 상태 배지 === */
.status-badge,
.order-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-trial { background: #fff3cd; color: #856404; }
.status-active,
.status-processing,
.status-completed { background: #d4edda; color: #155724; }
.status-pending_cancel { background: #ffe5d0; color: #c45c00; }
.status-cancelled,
.status-failed,
.status-refunded { background: #f8d7da; color: #721c24; }
.status-expired { background: #e9ecef; color: #495057; }
.status-pending,
.status-on-hold { background: #cce5ff; color: #004085; }

.end-date {
    color: #c45c00;
    font-weight: 500;
    font-size: 13px;
}

.end-label {
    display: block;
    font-size: 10px;
    color: #888;
}

/* === 버튼 === */
.button-small {
    padding: 6px 12px !important;
    font-size: 12px !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;
}

/* === 빈 상태 === */
.billing-section .empty-message {
    color: #888;
    text-align: center;
    padding: 24px;
    font-size: 14px;
}

/* === 반응형: 모바일 === */
@media (max-width: 600px) {
    /* 섹션 카드 - 꽉 차게 */
    .billing-section {
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 10px;
        margin-left: -12px;
        margin-right: -12px;
        border-radius: 0;
    }

    .billing-section h2 {
        font-size: 17px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .section-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .section-header .button {
        padding: 10px 16px !important;
        font-size: 13px !important;
        width: auto;
    }

    /* 결제 카드 - 가로로 크게 */
    .payment-cards {
        flex-direction: column;
        gap: 10px;
    }

    .payment-card {
        min-width: 100%;
        flex-direction: row;
        align-items: center;
        gap: 14px;
        padding: 18px 16px;
        border-radius: 12px;
    }

    .card-icon {
        width: 52px;
        height: 36px;
        flex-shrink: 0;
    }

    .card-info {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        flex: 1;
    }

    .card-name {
        font-size: 16px;
        font-weight: 600;
    }

    .default-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .card-actions {
        flex-shrink: 0;
        padding-top: 0;
        border-top: none;
    }

    .set-default-card,
    .delete-card {
        font-size: 13px !important;
        padding: 6px 0;
    }

    /* 주문 테이블 - 가로 리스트 (스크롤) */
    .billing-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .billing-table thead {
        display: table-header-group;
    }

    .billing-table tbody {
        display: table-row-group;
    }

    .billing-table tr {
        display: table-row;
        margin-bottom: 0;
        border: none;
        border-radius: 0;
        padding: 0;
        background: transparent;
    }

    .billing-table th,
    .billing-table td {
        display: table-cell;
        white-space: nowrap;
        padding: 14px 12px;
        font-size: 14px;
        border-bottom: 1px solid #eee;
    }

    .billing-table th {
        font-size: 13px;
        background: #f8f9fa;
    }

    .billing-table td::before {
        display: none;
    }

    .billing-table td.actions {
        border-top: none;
        padding-top: 14px;
        margin-top: 0;
    }

    /* 상태 배지 */
    .status-badge,
    .order-status {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* 버튼 */
    .button-small {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }

    .button-cancel {
        padding: 10px 14px !important;
    }

    /* 빈 상태 */
    .billing-section .empty-message {
        padding: 24px;
        font-size: 14px;
    }
}
