/**
 * WECC My Credit Frontend Styles - Versión Mejorada
 */

.wecc-my-credit {
    margin: 20px 0;
    max-width: 1200px;
}

/* =================================
   INFORMACIÓN DEL CLIENTE
   ================================= */
.wecc-customer-info {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.wecc-customer-info h3 {
    background: #f8f9fa;
    color: #495057;
    margin: 0;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

.wecc-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    padding: 20px;
}

.wecc-info-item {
    padding: 16px 0;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.wecc-info-item:last-child {
    border-bottom: none;
}

.wecc-info-label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    min-width: 140px;
    flex-shrink: 0;
}

.wecc-info-value {
    color: #212529;
    font-size: 14px;
    flex: 1;
    word-break: break-word;
}

.wecc-customer-type {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

/* Colores para tipos de cliente */
.wecc-type-mayorista {
    background: #e8f5e8;
    color: #2e7d32;
}

.wecc-type-distribuidor {
    background: #e3f2fd;
    color: #1565c0;
}

.wecc-type-minorista {
    background: #fff3e0;
    color: #f57c00;
}

.wecc-type-corporativo {
    background: #f3e5f5;
    color: #7b1fa2;
}

.wecc-type-gobierno {
    background: #e0f2f1;
    color: #00695c;
}

.wecc-type-especial {
    background: #fce4ec;
    color: #c2185b;
}

/* Fallback para tipos no definidos */
.wecc-customer-type:not([class*="wecc-type-"]) {
    background: #f5f5f5;
    color: #757575;
}

.wecc-rfc {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    border: 1px solid #dee2e6;
}

.wecc-info-notes {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 0;
    border-top: 1px solid #dee2e6;
    margin-top: 8px;
}

.wecc-info-notes .wecc-info-label {
    margin-bottom: 8px;
    min-width: auto;
}

.wecc-info-notes .wecc-info-value {
    text-align: left;
    color: #6c757d;
    font-style: italic;
    line-height: 1.5;
}

.wecc-edit-info-link {
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.wecc-edit-info-link a {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.wecc-edit-info-link a:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Responsive para info del cliente */
@media (max-width: 768px) {
    .wecc-info-grid {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .wecc-info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .wecc-info-label {
        min-width: auto;
        margin-right: 0;
    }
    
    .wecc-info-value {
        text-align: left;
    }
}

/* =================================
   RESUMEN DE CRÉDITO
   ================================= */
.wecc-credit-summary {
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.wecc-credit-summary h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: white;
}

/* ESTADO BLOQUEADO */
.wecc-credit-summary.wecc-blocked {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    position: relative;
}

.wecc-blocked-info {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.wecc-block-icon {
    font-size: 48px;
    line-height: 1;
    opacity: 0.9;
}

.wecc-block-message h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    color: white;
    font-weight: 700;
}

.wecc-block-message p {
    margin: 0 0 8px 0;
    font-size: 16px;
    line-height: 1.4;
    color: rgba(255,255,255,0.95);
}

.wecc-action-required {
    font-weight: 600;
    color: #fff3cd !important;
}

.wecc-blocked-actions {
    text-align: center;
    margin-top: 20px;
}

.wecc-btn-warning {
    background: #ffc107;
    color: #212529;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
    font-weight: 700;
}

.wecc-btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.6);
    color: #212529;
    text-decoration: none;
}

.wecc-contact-info {
    margin-top: 12px;
    color: rgba(255,255,255,0.8);
}

/* ESTADO NORMAL */
.wecc-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.wecc-summary-cards.wecc-disabled {
    opacity: 0.6;
    filter: grayscale(50%);
}

.wecc-summary-item {
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.wecc-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

.wecc-value {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
}

.wecc-value.wecc-available {
    color: #2ecc71;
}

.wecc-value.wecc-used {
    color: #ffd3ce;
}

.wecc-next-due {
    text-align: center;
    margin-top: 16px;
    color: rgba(255,255,255,0.8);
}

/* CARDS ORIGINALES (para compatibilidad) */
.wecc-summary-card {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.wecc-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.wecc-summary-card h4 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wecc-summary-card .amount {
    font-size: 28px;
    font-weight: bold;
    margin: 12px 0;
    line-height: 1.2;
}

.wecc-credit-positive { color: #28a745; }
.wecc-credit-negative { color: #dc3545; }
.wecc-credit-zero { color: #6c757d; }

.wecc-positive-balance {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* =================================
   ADEUDOS PENDIENTES
   ================================= */
.wecc-pending-charges {
    margin: 30px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.wecc-pending-charges h3 {
    background: #007cba;
    color: white;
    margin: 0;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
}

/* Acciones de Pago Mejoradas */
.wecc-payment-actions {
    background: #fff3cd;
    border-bottom: 1px solid #ffeaa7;
    padding: 24px;
}

.wecc-payment-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.wecc-payment-summary .summary-text h4 {
    margin: 0 0 8px 0;
    color: #856404;
    font-size: 18px;
}

.wecc-payment-summary .total-amount {
    color: #dc3545;
    font-weight: bold;
    font-size: 24px;
}

.wecc-payment-summary p {
    margin: 0;
    color: #856404;
    font-size: 14px;
}

/* Botones Modernos - Estilo Cápsula */
.wecc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 50px; /* Cápsula completa */
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-align: center;
    min-height: 44px;
    white-space: nowrap;
}

.wecc-btn-large {
    padding: 18px 36px;
    font-size: 16px;
    min-height: 52px;
}

.wecc-btn-primary {
    background: #007cba;
    color: white !important;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.25);
}

.wecc-btn-primary:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);
    color: white;
    text-decoration: none;
}

.wecc-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.wecc-btn-secondary {
    background: #6c757d;
    color: white !important;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.25);
}

.wecc-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
    color: white;
    text-decoration: none;
}

.wecc-btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

/* Remover iconos de texto - solo usar texto */
.btn-icon {
    display: none;
}

/* Lista de Cargos */
.wecc-charges-list {
    padding: 24px;
}

.wecc-charge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.wecc-charge-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.wecc-charge-item.overdue {
    border-color: #dc3545;
    background: #f8d7da;
}

.charge-info {
    flex: 1;
}

.charge-title {
    font-size: 16px;
    margin-bottom: 8px;
}

.charge-title strong {
    color: #212529;
}

.order-link a {
    color: #007cba;
    text-decoration: none;
    font-weight: normal;
}

.charge-dates {
    margin-top: 8px;
}

.created-date {
    color: #6c757d;
}

.due-date {
    font-weight: 600;
}

.due-date.pending {
    color: #856404;
}

.due-date.overdue {
    color: #dc3545;
}

.charge-amount {
    margin: 0 20px;
    text-align: center;
}

.charge-amount .amount {
    font-size: 20px;
    font-weight: bold;
    color: #dc3545;
    display: block;
}

.charge-actions {
    flex-shrink: 0;
}

/* =================================
   MOVIMIENTOS RECIENTES
   ================================= */
.wecc-recent-movements {
    margin: 30px 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    overflow: hidden;
}

.wecc-recent-movements h3 {
    background: #6c757d;
    color: white;
    margin: 0;
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 600;
}

.wecc-ledger-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
}

.wecc-ledger-table th,
.wecc-ledger-table td {
    border-bottom: 1px solid #dee2e6;
    text-align: left;
    vertical-align: top;
}

.wecc-ledger-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wecc-ledger-table tbody tr:hover {
    background: #f8f9fa;
   
}

.wecc-ledger-table .amount {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
}

/* COLUMNA DE MONTO - Ancho fijo para evitar que se parta */
.wecc-ledger-table th:nth-child(1),
.wecc-ledger-table td:nth-child(1) {
    min-width: 100px;
    width: 100px;
    white-space: nowrap;
}

/* COLUMNA DE MONTO - Ancho fijo para evitar que se parta */
.wecc-ledger-table th:nth-child(4),
.wecc-ledger-table td:nth-child(4) {
    min-width: 150px;
    width: 150px;
    white-space: nowrap;
    text-align: right;
}

/* Asegurar que los precios no se partan en múltiples líneas */
.wecc-ledger-table .amount strong {
    white-space: nowrap;
    display: inline-block;
}

.wecc-type-charge { 
    background: #f8d7da; 
    color: #721c24; 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 12px;
    font-weight: 600;
}

.wecc-type-payment { 
    background: #d1ecf1; 
    color: #0c5460; 
    padding: 4px 8px; 
    border-radius: 4px; 
    font-size: 12px;
    font-weight: 600;
}

.status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status.pending {
    background: #fff3cd;
    color: #856404;
}

.status.paid {
    background: #d4edda;
    color: #155724;
}

.status.completed {
    background: #d1ecf1;
    color: #0c5460;
}

/* =================================
   PAGINACIÓN
   ================================= */
.wecc-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.wecc-pagination-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.wecc-pagination-btn:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
    text-decoration: none;
}

.wecc-pagination-current {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: #007cba;
    color: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

/* =================================
   RESPONSIVE PARA TABLA (STACK EN MÓVILES)
   ================================= */
@media (max-width: 768px) {
    /* Tabla responsiva - convertir a cards */
    .wecc-ledger-table {
        border: 0;
    }
    
    .wecc-ledger-table thead {
        display: none;
    }
    
    .wecc-ledger-table tbody {
        display: block;
    }
    
    .wecc-ledger-table tr {
        display: block;
        border: 1px solid #dee2e6;
        margin-bottom: 16px;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        overflow: hidden;
        padding: 10px; /* Padding interno para toda la tarjeta */
    }
    
    .wecc-ledger-table tr:hover {
        background: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    /* Layout básico para todas las celdas */
    .wecc-ledger-table td {
        display: block;
        padding: 8px 0; /* Reducido porque ya tenemos padding en tr */
        border-bottom: 1px solid #f1f3f4;
        border-right: none;
        text-align: left;
        position: relative;
    }
    
    .wecc-ledger-table td:last-child {
        border-bottom: none;
    }
    
    /* Labels arriba del contenido */
    .wecc-ledger-table td:before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: #495057;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
        opacity: 0.8;
    }
    
    /* Fila especial para TIPO + MONTO (lado a lado) */
    .wecc-ledger-table td:nth-child(3) { /* Tipo */
        float: left;
        width: calc(40% - 8px);
        margin-right: 16px;
        border-bottom: none;
        border-right: 1px solid #f1f3f4;
        padding: 8px 8px 8px 0; /* Ajuste de padding */
    }
    
    .wecc-ledger-table td:nth-child(4) { /* Monto */
        float: left;
        width: calc(60% - 8px);
        border-bottom: 1px solid #f1f3f4;
        clear: none;
        padding: 8px 0; /* Padding normal */
    }
    
    /* Limpiar float después del monto */
    .wecc-ledger-table td:nth-child(5) { /* Estado */
        clear: both;
    }
    
    /* Estilos especiales para el contenido en mobile */
    .wecc-ledger-table td .amount {
        font-size: 16px;
        font-weight: bold;
    }
    
    .wecc-ledger-table td .status {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    /* Ajustar tipos de transacción en mobile */
    .wecc-ledger-table td .wecc-type-charge,
    .wecc-ledger-table td .wecc-type-payment {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* =================================
   RESPONSIVE GENERAL
   ================================= */
@media (max-width: 768px) {
    .wecc-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .wecc-blocked-info {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .wecc-block-icon {
        font-size: 36px;
    }
    
    .wecc-block-message h4 {
        font-size: 18px;
    }
    
    .wecc-payment-summary {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .wecc-charge-item {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .charge-amount {
        margin: 0;
        text-align: center;
        order: -1;
    }
    
    .wecc-pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .wecc-my-credit {
        margin: 10px 0;
    }
    
    .wecc-credit-summary {
        margin: 15px 0;
        padding: 20px;
        border-radius: 12px;
    }
    
    .wecc-credit-summary h3 {
        font-size: 20px;
    }
    
    .wecc-blocked-info {
        padding: 16px;
    }
    
    .wecc-block-message h4 {
        font-size: 16px;
    }
    
    .wecc-block-message p {
        font-size: 14px;
    }
    
    .wecc-summary-item {
        padding: 12px;
    }
    
    .wecc-value {
        font-size: 20px;
    }
    
    .wecc-pending-charges,
    .wecc-recent-movements {
        border-radius: 8px;
        margin: 15px 0;
    }
    
    .wecc-charges-list,
    .wecc-recent-movements h3,
    .wecc-pending-charges h3 {
        padding: 16px;
    }
    
    .wecc-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .wecc-btn-large {
        padding: 12px 20px;
        font-size: 14px;
    }
}
