/**
 * Invoice Table Styles
 *
 * @package ENTEL_Membership_Manager
 */

/* ==========================================================================
   Invoice Notice Messages
   ========================================================================== */

.entel-invoice-notice {
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.entel-invoice-notice.entel-error {
    background: #fef7f7;
    border-color: #dc3232;
    color: #dc3232;
}

.entel-invoice-notice.entel-info {
    background: #f0f6fc;
    border-color: #2271b1;
    color: #2271b1;
}

.entel-invoice-notice.entel-warning {
    background: #fcf9f1;
    border-color: #f0b849;
    color: #a77b00;
}

/* ==========================================================================
   Enterprise Message
   ========================================================================== */

.entel-enterprise-invoice-message {
    margin: 20px 0;
}

/* ==========================================================================
   Billing Settings Section
   ========================================================================== */

.entel-billing-settings-section {
    margin: 0 0 40px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f5f7fa 0%, #ffffff 100%);
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.entel-billing-settings-title {
    margin: 0 0 20px 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e3a5f;
    border-bottom: 2px solid #e1e8ed;
    padding-bottom: 12px;
}

.entel-billing-setting-item {
    margin-bottom: 20px;
}

.entel-billing-setting-item:last-child {
    margin-bottom: 0;
}

.entel-billing-setting-item.entel-payment-method-item {
    padding-top: 20px;
    border-top: 1px solid #e1e8ed;
}

.entel-billing-email-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entel-billing-email-display label {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.entel-billing-email-value {
    color: #666;
    flex: 1;
}

.entel-edit-billing-email {
    margin: 0;
}

.entel-billing-email-edit {
    margin-top: 15px;
}

.entel-billing-email-edit label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.entel-billing-email-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.entel-billing-email-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

.entel-save-billing-email,
.entel-cancel-billing-email {
    margin-right: 10px;
}

.entel-billing-email-message {
    display: inline-block;
    margin-left: 15px;
    font-size: 14px;
}

.entel-billing-email-message.success {
    color: #46b450;
}

.entel-billing-email-message.error {
    color: #dc3232;
}

/* Payment Method Display (within Billing Settings) */
.entel-payment-method-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entel-payment-method-display label {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.entel-payment-method-value {
    color: #666;
    flex: 1;
}

.entel-change-payment-button {
    margin: 0;
    white-space: nowrap;
}

.entel-payment-method-notice {
    margin: 15px 0 0 0;
    padding: 10px 15px;
    background: #fff3cd;
    border-left: 4px solid #f0b849;
    color: #a77b00;
    border-radius: 4px;
    font-size: 14px;
}

/* Saved Payment Methods (for users without subscription) */
.entel-saved-payment-methods {
    display: flex;
    align-items: center;
    gap: 15px;
}

.entel-saved-payment-methods label {
    font-weight: 600;
    color: #333;
    margin: 0;
    white-space: nowrap;
}

.entel-payment-methods-list {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    margin: 0;
    padding: 0;
}

.entel-payment-method-row {
    padding: 8px 12px;
    background: #f9f9f9;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
}

.entel-payment-method-display-name {
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.entel-default-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #2271b1;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-transform: uppercase;
}

.entel-no-payment-methods {
    color: #666;
    font-size: 14px;
    margin: 0;
    flex: 1;
}

.entel-manage-payment-methods {
    margin: 0;
    white-space: nowrap;
}

/* ==========================================================================
   Payment Method Modal
   ========================================================================== */

.entel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.entel-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.entel-modal-content {
    position: relative;
    max-width: 600px;
    margin: 50px auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000000;
}

.entel-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.entel-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e3a5f;
}

.entel-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.entel-modal-close:hover {
    color: #dc3232;
}

.entel-modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.entel-payment-gateways-list {
    margin: 0;
}

.entel-payment-gateway-option {
    display: block;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.entel-payment-gateway-option:hover {
    border-color: #2271b1;
    background: #f5f7fa;
}

.entel-payment-gateway-option:last-child {
    margin-bottom: 0;
}

.entel-payment-gateway-option input[type="radio"] {
    margin-right: 12px;
}

.entel-gateway-title {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.entel-gateway-description {
    display: block;
    margin-top: 8px;
    margin-left: 28px;
    color: #666;
    font-size: 13px;
}

.entel-no-gateways {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
    margin: 0;
}

.entel-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e1e8ed;
    display: flex;
    align-items: center;
    gap: 10px;
}

.entel-modal-footer .entel-payment-method-message {
    flex: 1;
    margin-left: 15px;
    font-size: 14px;
}

.entel-modal-footer .entel-payment-method-message.success {
    color: #46b450;
}

.entel-modal-footer .entel-payment-method-message.error {
    color: #dc3232;
}

body.entel-modal-open {
    overflow: hidden;
}

@media screen and (max-width: 782px) {
    .entel-modal-content {
        margin: 20px;
        max-width: calc(100% - 40px);
    }

    .entel-modal-header,
    .entel-modal-body,
    .entel-modal-footer {
        padding: 15px 20px;
    }

    .entel-modal-footer {
        flex-wrap: wrap;
    }

    .entel-modal-footer .button {
        flex: 1 1 45%;
    }

    .entel-modal-footer .entel-payment-method-message {
        flex: 1 1 100%;
        margin: 10px 0 0 0;
    }
}

/* ==========================================================================
   Order History Section
   ========================================================================== */

.entel-order-history-section {
    margin: 30px 0;
}

.entel-outstanding-notice {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Status Badges
   ========================================================================== */

.entel-invoice-status-badge {
    background-color: #999;
    color: #fff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ==========================================================================
   Invoice Table
   ========================================================================== */

.entel-invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.entel-invoice-table thead {
    background: #f0f0f1;
}

.entel-invoice-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
}

.entel-invoice-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f1;
    color: #666;
}

.entel-invoice-table tbody tr:hover {
    background: #f9f9f9;
}

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

.entel-invoice-pdf-link {
    display: inline-block;
    padding: 8px 16px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.2s;
}

.entel-invoice-pdf-link:hover {
    background: #135e96;
    color: #fff;
}

.entel-invoice-pdf-link:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.entel-no-invoice {
    color: #a0a5aa;
    font-style: italic;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media screen and (max-width: 782px) {
    .entel-billing-settings-section {
        padding: 20px;
        margin-bottom: 30px;
    }

    .entel-billing-settings-title {
        font-size: 16px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .entel-billing-email-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .entel-billing-email-value {
        word-break: break-word;
    }

    .entel-payment-method-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .entel-payment-method-value {
        word-break: break-word;
    }

    .entel-change-payment-button,
    .entel-manage-payment-methods {
        width: 100%;
        text-align: center;
    }

    .entel-saved-payment-methods {
        flex-direction: column;
        align-items: flex-start;
    }

    .entel-payment-methods-list {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .entel-payment-method-row {
        width: 100%;
    }

    .entel-payment-method-display-name {
        flex-wrap: wrap;
    }

    .entel-invoice-table {
        display: block;
        overflow-x: auto;
    }

    .entel-invoice-table thead {
        display: none;
    }

    .entel-invoice-table tbody,
    .entel-invoice-table tr,
    .entel-invoice-table td {
        display: block;
        width: 100%;
    }

    .entel-invoice-table tr {
        margin-bottom: 20px;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 10px;
    }

    .entel-invoice-table td {
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f1;
        position: relative;
        padding-left: 50%;
    }

    .entel-invoice-table td:last-child {
        border-bottom: none;
    }

    .entel-invoice-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        font-weight: 600;
        color: #333;
    }
}

@media screen and (max-width: 480px) {
    .entel-billing-email-input {
        max-width: 100%;
    }

    .entel-save-billing-email,
    .entel-cancel-billing-email {
        display: block;
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.entel-billing-email-edit.loading .entel-billing-email-input {
    opacity: 0.6;
    pointer-events: none;
}

.entel-billing-email-edit.loading .entel-save-billing-email,
.entel-billing-email-edit.loading .entel-cancel-billing-email {
    opacity: 0.6;
    cursor: not-allowed;
}
