/* =====================================================
   Módulo: PRÉSTAMOS - Styles aislados
   Namespace: .mod-prestamo-*
   ===================================================== */

.mod-prestamo-container {
    animation: fadeIn 0.4s ease forwards;
}

.mod-prestamo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.mod-prestamo-header h2 {
    font-size: 1.4rem;
    color: var(--cyan);
}

/* Cálculo en tiempo real */
.mod-prestamo-calculo {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.05), rgba(168, 85, 247, 0.05));
    border: 1px solid var(--cyan-dim);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-top: 16px;
}

.mod-prestamo-calculo__title {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.mod-prestamo-calculo__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.mod-prestamo-calculo__item {
    text-align: center;
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.mod-prestamo-calculo__item-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.mod-prestamo-calculo__item-value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green);
}

/* Lista de préstamos - Cards */
.mod-prestamo-list {
    display: grid;
    gap: 16px;
}

.mod-prestamo-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.mod-prestamo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--cyan);
    border-radius: 0 2px 2px 0;
}

.mod-prestamo-card--mora::before {
    background: var(--orange);
}

.mod-prestamo-card--mora-critica::before {
    background: var(--red);
}

.mod-prestamo-card--pagado::before {
    background: var(--green);
}

.mod-prestamo-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow-cyan);
}

.mod-prestamo-card__top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mod-prestamo-card__avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border);
}

.mod-prestamo-card__cliente {
    flex: 1;
    min-width: 0;
}

.mod-prestamo-card__nombre {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mod-prestamo-card--mora .mod-prestamo-card__nombre,
.mod-prestamo-card--mora-critica .mod-prestamo-card__nombre {
    color: var(--orange);
}

.mod-prestamo-card--mora-critica .mod-prestamo-card__nombre {
    color: var(--red);
}

.mod-prestamo-card__codigo {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-display);
}

.mod-prestamo-card__whatsapp {
    flex-shrink: 0;
}

.mod-prestamo-card__datos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.mod-prestamo-card__dato {
    text-align: center;
}

.mod-prestamo-card__dato-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.mod-prestamo-card__dato-value {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
}

.mod-prestamo-card__dias {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-display);
}

.mod-prestamo-card__dias--restante {
    background: var(--cyan-dim);
    color: var(--cyan);
}

.mod-prestamo-card__dias--mora {
    background: var(--orange-dim);
    color: var(--orange);
}

.mod-prestamo-card__dias--mora-critica {
    background: var(--red-dim);
    color: var(--red);
}

/* ===== DETALLE DE PRÉSTAMO ===== */
.mod-prestamo-detalle-header {
    position: sticky;
    top: 60px;
    z-index: var(--z-sticky);
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.mod-prestamo-detalle-header__foto {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--cyan-dim);
}

.mod-prestamo-detalle-header__info {
    flex: 1;
}

.mod-prestamo-detalle-header__nombre {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.mod-prestamo-detalle-header__codigo {
    font-family: var(--font-display);
    font-size: 0.8rem;
    color: var(--cyan);
}

.mod-prestamo-detalle-header__montos {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.mod-prestamo-detalle-header__monto {
    text-align: center;
}

.mod-prestamo-detalle-header__monto-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.mod-prestamo-detalle-header__monto-value {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

/* Timeline de pagos */
.mod-prestamo-timeline {
    position: relative;
    padding-left: 30px;
}

.mod-prestamo-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.mod-prestamo-timeline__item {
    position: relative;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.mod-prestamo-timeline__item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--cyan);
    border: 2px solid var(--bg-primary);
}

.mod-prestamo-timeline__item--pago::before {
    background: var(--green);
}

.mod-prestamo-timeline__fecha {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.mod-prestamo-timeline__montos {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .mod-prestamo-detalle-header {
        flex-direction: column;
        text-align: center;
        top: 56px;
    }

    .mod-prestamo-detalle-header__montos {
        justify-content: center;
    }

    .mod-prestamo-card__datos {
        grid-template-columns: repeat(2, 1fr);
    }
}