/**
 * Frontend styles for WC Installment Payments.
 */

/* Product page installment info */
.wcip-product-installment-info {
    margin: 20px 0;
    font-family: 'Inter', sans-serif; /* Assuming Inter or similar is available or falls back */
}

.wcip-installment-badge {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #ffffff;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wcip-installment-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.wcip-badge-icon {
    font-size: 28px;
    line-height: 1;
    color: #2271b1; /* Brand color */
}

.wcip-badge-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcip-badge-text strong {
    font-size: 16px;
    color: #1a1a2e;
    font-weight: 600;
}

.wcip-badge-text span {
    font-size: 14px;
    color: #4a5568;
}

.wcip-badge-text small {
    font-size: 12px;
    color: #718096;
}

/* Installment price on product listings */
.wcip-installment-price {
    display: block;
    font-size: 14px;
    color: #2271b1;
    font-weight: 500;
    margin-top: 6px;
}

/* Checkout card element */
#wcip-card-element {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

#wcip-card-errors {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wcip-installment-info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
    color: #1e3a8a;
    border-radius: 0 8px 8px 0;
}

/* My Account — Installment Dashboard */
.wcip-installments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.wcip-installment-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.wcip-installment-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.wcip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    border-bottom: 1px solid #edf2f7;
}

.wcip-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.4;
    padding-right: 12px; /* For status badge spacing in RTL/LTR */
}

/* Status Badges */
.wcip-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.wcip-status-active {
    background: #def7ec;
    color: #03543f;
    border: 1px solid #bcf0da;
}

.wcip-status-retry {
    background: #fefcbf;
    color: #744210;
    border: 1px solid #fce588;
}

.wcip-status-failed {
    background: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #fbd5d5;
}

.wcip-status-completed {
    background: #e3f2fd;
    color: #0c4a6e;
    border: 1px solid #bae6fd;
}

.wcip-status-cancelled {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.wcip-card-body {
    padding: 24px;
}

/* Progress Bar */
.wcip-progress-section {
    margin-bottom: 24px;
}

.wcip-progress-bar {
    width: 100%;
    height: 10px;
    background: #edf2f7;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.wcip-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.wcip-progress-text {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    display: flex;
    justify-content: space-between;
}

/* Card Details Grid */
.wcip-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding-top: 20px;
    border-top: 1px solid #edf2f7;
}

.wcip-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcip-detail-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.6px;
    font-weight: 600;
}

.wcip-detail-value {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}

.wcip-detail-value a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s;
}

.wcip-detail-value a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Notices */
.wcip-retry-notice,
.wcip-failed-notice {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    display: flex;
    gap: 10px;
}

.wcip-retry-notice {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.wcip-failed-notice {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.wcip-retry-notice p,
.wcip-failed-notice p {
    margin: 0;
}

/* Cancel Button */
.wcip-cancel-plan {
    margin-top: 24px;
    text-align: right;
}

.wcip-cancel-plan button.button {
    background: transparent !important;
    color: #ef4444 !important;
    border: 1px solid #fecaca !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.wcip-cancel-plan button.button:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

/* RTL Support Modifications */
[dir="rtl"] .wcip-card-header h3 {
    padding-right: 0;
    padding-left: 12px;
}

[dir="rtl"] .wcip-installment-info {
    border-left: none;
    border-right: 4px solid #3b82f6;
    border-radius: 8px 0 0 8px;
}

@media (max-width: 600px) {
    .wcip-installments-list {
        grid-template-columns: 1fr;
    }
    
    .wcip-card-details {
        grid-template-columns: 1fr 1fr; /* Keep 2 columns on mobile if space allows, or 1fr for stack */
    }
}
