/* Xolvin Installment Engine - Premium Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700&display=swap');

.xie-installment-container {
    margin: 40px 0;
    padding: 25px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #eef2f1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.xie-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 20px;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.xie-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f0f4f3;
}

.xie-table thead {
    background: #f8fafc;
}

.xie-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9;
}

.xie-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}

.xie-table tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.xie-table tbody tr:hover {
    background-color: #f8fafc;
    transform: scale(1.002);
}

.xie-table tbody tr:last-child td {
    border-bottom: none;
}

.xie-table td strong {
    color: #1e293b;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
}

/* Advance & Monthly amounts */
.xie-table td bdi {
    color: #10b981;
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
}

/* Markup Badge */
.xie-markup-badge {
    display: inline-block;
    background-color: #e74c3c;
    color: #fff;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 5px;
}

.xie-markup-amount {
    display: block;
    font-size: 12px;
    color: #e74c3c;
    margin-top: 2px;
    font-weight: 600;
}

/* Select Plan Button Styling */
.xie-select-plan {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.xie-select-plan:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

.xie-select-plan:active {
    transform: translateY(0);
}

.xie-select-plan:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Info text */
.xie-info-text {
    margin-top: 20px;
    padding: 12px 16px;
    background-color: #f0f9ff;
    border-radius: 10px;
    color: #0369a1;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e0f2fe;
}

/* Modal Styling */
.xie-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: xie-fade-in 0.3s ease;
}

@keyframes xie-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes xie-slide-down {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(1);
    }
}

.xie-modal-content {
    background: #ffffff;
    margin: 40px auto;
    padding: 0;
    border: none;
    border-radius: 12px;
    width: 95%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: xie-slide-down 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.xie-modal-header {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    padding: 25px 30px;
    border-radius: 12px 12px 0 0;
    position: relative;
    color: #fff;
}

.xie-modal-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.xie-product-tag {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.xie-modal-close {
    color: rgba(255, 255, 255, 0.8);
    font-size: 24px;
    line-height: 1;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
}

.xie-modal-close:hover {
    color: #fff;
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.xie-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fff !important;
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.xie-modal-body {
    padding: 30px;
}

/* Modal Info Section */
.xie-modal-info {
    background-color: #f8faf9;
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 1px solid #eef2f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.xie-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border-bottom: 1px dashed #e0e6e3;
    padding-bottom: 8px;
}

.xie-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.xie-info-label {
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.xie-info-value {
    color: #27ae60;
    font-weight: 700;
    font-size: 14px;
}

/* Plan Details Section */
.xie-plan-details {
    background: #fff;
    border: 1px solid #ff980033;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.08);
}

.xie-plan-details-title {
    margin: 0 0 15px 0;
    font-size: 13px;
    font-weight: 700;
    color: #ff9800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.xie-plan-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.xie-plan-detail-item {
    display: flex;
    flex-direction: column;
    padding: 12px 15px;
    background: #fffbf2;
    border-radius: 8px;
    border: 1px solid #fff3e0;
}

.xie-detail-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 5px;
}

.xie-detail-value {
    font-size: 14px;
    font-weight: 700;
    color: #ff6f00;
    word-break: break-word;
}

/* Form Group Styling */
.xie-form-group {
    margin-bottom: 20px;
}

.xie-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 13px;
}

.xie-form-group input,
.xie-form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid #e1e8e5;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background: #fafcfb;
}

.xie-form-group input:hover,
.xie-form-group textarea:hover {
    border-color: #bdc7c3;
}

.xie-form-group input:focus,
.xie-form-group textarea:focus {
    outline: none;
    border-color: #27ae60;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.1);
}

.xie-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Form Actions */
.xie-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    justify-content: flex-end;
}

.xie-btn-cancel,
.xie-btn-submit {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.xie-btn-cancel {
    background-color: #95a5a6;
    color: #fff;
}

.xie-btn-cancel:hover {
    background-color: #7f8c8d;
}

.xie-btn-submit {
    background-color: #27ae60;
    color: #fff;
}

.xie-btn-submit:hover {
    background-color: #229954;
}

.xie-btn-submit:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* Toggle Button for Mobile */
.xie-mobile-toggle-btn {
    display: none;
    width: 100%;
    padding: 15px;
    background: #fff;
    border: 1px solid #eef2f1;
    border-radius: 12px;
    font-weight: 600;
    color: #1a202c;
    cursor: pointer;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s ease;
}

.xie-mobile-toggle-btn:hover {
    background: #f8fafc;
}

.xie-mobile-toggle-btn .xie-toggle-icon {
    font-size: 12px;
    color: #64748b;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .xie-mobile-toggle-btn {
        display: flex !important;
    }

    .xie-plans-wrapper {
        display: none;
        margin-top: 10px;
    }

    .xie-installment-container .xie-title {
        display: none !important;
        /* Title already inside toggle or redundant */
    }

    .xie-installment-container {
        padding: 10px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* Stack the table on mobile / tablet */
    .xie-installment-container .xie-table,
    .xie-installment-container .xie-table thead,
    .xie-installment-container .xie-table tbody,
    .xie-installment-container .xie-table th,
    .xie-installment-container .xie-table td,
    .xie-installment-container .xie-table tr {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .xie-installment-container .xie-table thead tr {
        position: absolute !important;
        top: -9999px !important;
        left: -9999px !important;
    }

    .xie-installment-container .xie-table {
        border: none !important;
        background: transparent !important;
    }

    .xie-installment-container .xie-table tbody tr {
        background: #ffffff !important;
        border: 1px solid #f1f5f9 !important;
        border-radius: 12px !important;
        margin-bottom: 20px !important;
        padding: 15px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
        transform: none !important;
    }

    .xie-installment-container .xie-table td {
        border: none !important;
        padding: 10px 0 !important;
        text-align: right !important;
        position: relative !important;
        padding-left: 50% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 13px !important;
        border-bottom: 1px dashed #f1f5f9 !important;
        white-space: normal !important;
        min-height: 40px !important;
    }

    .xie-installment-container .xie-table td:last-child {
        border-bottom: none !important;
        padding-bottom: 5px !important;
        padding-top: 15px !important;
        justify-content: center !important;
        padding-left: 0 !important;
    }

    .xie-installment-container .xie-table td::before {
        content: attr(data-label) !important;
        position: absolute !important;
        left: 0 !important;
        width: 45% !important;
        padding-right: 10px !important;
        white-space: nowrap !important;
        text-align: left !important;
        font-weight: 600 !important;
        color: #64748b !important;
        text-transform: uppercase !important;
        font-size: 10px !important;
        letter-spacing: 0.05em !important;
    }

    /* Hide label for the action button row if it's too much */
    .xie-installment-container .xie-table td[data-label="Action"]::before {
        display: none !important;
    }

    .xie-installment-container .xie-table td strong {
        font-size: 14px !important;
    }

    .xie-installment-container .xie-table td bdi {
        font-size: 15px !important;
    }

    .xie-installment-container .xie-select-plan {
        width: 100% !important;
        padding: 12px !important;
        font-size: 14px !important;
    }

    .xie-installment-container .xie-info-text {
        font-size: 12px !important;
    }

    /* Modal Adjustments */
    .xie-modal-content {
        width: 95%;
        margin: 20px auto;
        max-height: 95vh;
    }

    .xie-modal-header {
        padding: 20px;
    }

    .xie-modal-body {
        padding: 20px;
    }

    .xie-plan-details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .xie-modal-info {
        padding: 15px;
        margin-bottom: 20px;
    }

    .xie-form-group input,
    .xie-form-group textarea {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    .xie-form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .xie-btn-cancel,
    .xie-btn-submit {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .xie-installment-container {
        padding: 15px 12px;
    }

    .xie-table tbody tr {
        padding: 12px;
        margin-bottom: 15px;
    }

    .xie-title {
        font-size: 16px;
    }

    .xie-table td::before {
        font-size: 10px;
    }

    .xie-table td bdi {
        font-size: 16px;
    }
}