/* Public Loan Card CSS - Rediseño Total Vibrante y Profesional */

/* Base Card Styles */
.loan-card {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
    border: 1px solid #f1f5f9;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    margin: 0 auto;
}

.loan-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #10b981, #3b82f6);
}

/* Header */
.loan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.loan-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    flex: 1;
}

.client-username {
    color: #6366f1;
    font-weight: 600;
    font-size: 0.9rem;
    background: #eef2ff;
    padding: 4px 12px;
    border-radius: 999px;
    display: inline-block;
    margin-top: 4px;
}

.loan-status {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.loan-status.active {
    background: #dcfce7;
    color: #15803d;
}

/* Summary Box */
.summary-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.summary-label {
    color: #64748b;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-label i {
    color: #94a3b8;
}

.summary-value {
    color: #1e293b;
    font-weight: 700;
    font-size: 1rem;
}

.summary-value.debt {
    color: #ef4444;
    background: #fef2f2;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Progress Section */
.installments-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.percent-pill {
    background: #eff6ff;
    color: #2563eb;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
}

.progress {
    height: 10px;
    background: #f1f5f9;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress .bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    transition: width 0.5s ease;
}

/* Grid de Información - AQUÍ ESTÁ EL DISEÑO CLAVE */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.payment-info-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 110px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.payment-info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: #e2e8f0;
}

/* Iconos con colores vibrantes */
.payment-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

/* Colores específicos para cada tipo de icono */
.icon-date { background: #eff6ff; color: #3b82f6; }
.icon-period { background: #f5f3ff; color: #8b5cf6; }
.icon-interest { background: #fffbeb; color: #f59e0b; }
.icon-paid { background: #ecfdf5; color: #10b981; }
.icon-method { background: #fdf2f8; color: #db2777; }
.icon-key { background: #f0fdfa; color: #0d9488; }

.payment-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    display: block; /* Asegura que sea visible */
}

.payment-card-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    display: block !important; /* Fuerza visibilidad */
}

/* Contenedor inferior (Método y Llave) */
.payment-info-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.payment-info-container .payment-info-card {
    min-height: 100px;
}

/* Key Card interactiva */
.key-card {
    cursor: pointer;
}

.key-card:active {
    transform: scale(0.98);
}

/* Next Badge - Diseño Verde Limpio */
.next-badge {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 1.5rem;
}

.next-badge .info-icon {
    width: 36px;
    height: 36px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.next-text {
    font-size: 0.9rem;
    color: #166534;
    line-height: 1.4;
}

.next-text strong {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #15803d;
    margin-bottom: 2px;
}

/* Historial Accordion */
.history-accordion {
    border: 1px solid #f1f5f9;
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
}

.history-header {
    width: 100%;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.history-header:hover {
    background: #f1f5f9;
}

.history-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-header h4 i {
    color: #6366f1;
}

.history-toggle-icon {
    color: #94a3b8;
    transition: transform 0.3s ease;
}

.history-accordion.open .history-toggle-icon {
    transform: rotate(180deg);
}

.history-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.history-accordion.open .history-content {
    max-height: 600px;
    padding: 18px;
    border-top: 1px solid #f1f5f9;
}

.history-summary-pill {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.summary-pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-pill strong {
    color: #1e293b;
    font-weight: 700;
}

.summary-pill.abonado {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.summary-pill.pendiente {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.history-table td {
    padding: 12px 0;
    font-size: 0.85rem;
    color: #475569;
    border-bottom: 1px solid #f8fafc;
}

.history-amount {
    font-weight: 700;
    color: #10b981;
}

/* Slider Profesional para Cuota */
.slider-calc {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    outline: none;
    transition: all 0.2s;
    margin: 10px 0;
}
.slider-calc::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #db2777;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(219, 39, 119, 0.3);
    transition: all 0.2s;
}
.slider-calc::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #be185d;
}

/* Simulator Styles */
.simulator-accordion {
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    background: white;
}

.simulator-header {
    width: 100%;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0fdfa;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.simulator-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0d9488;
    display: flex;
    align-items: center;
    gap: 10px;
}

.simulator-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.simulator-accordion.open .simulator-content {
    max-height: 1200px;
    padding: 18px;
    border-top: 1px solid #ccfbf1;
}

.sim-form-group {
    margin-bottom: 1rem;
}

.sim-form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.sim-input-wrapper {
    display: flex;
    gap: 8px;
}

.sim-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: #1e293b;
    font-weight: 600;
}

.sim-input:focus {
    outline: none;
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.sim-result-box {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    margin-top: 1rem;
}

.sim-result-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    padding: 4px 0;
}

.sim-result-row.total {
    border-top: 1px dashed #e2e8f0;
    margin-top: 8px;
    padding-top: 8px;
    font-weight: 700;
    color: #1e293b;
}

.amortization-table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.amortization-table th {
    text-align: left;
    color: #94a3b8;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.amortization-table td {
    padding: 8px 0;
    border-bottom: 1px solid #f8fafc;
}

.amortization-table .cuota-val {
    font-weight: 700;
    color: #0d9488;
}

.amortization-table .last-row {
    background: #f0fdfa;
    font-weight: 700;
}
