/**
 * ESTILOS: DETALLES DEL CLIENTE
 * Versión: 2.1.0
 * Fecha: 2026-10-31
 * Actualizado: Ancho ampliado a 1800px para mejor aprovechamiento del espacio
 */

:root {
    /* Colores Corporativos Puntos Net */
    --puntos-primary-dark: #30586B;
    --puntos-primary-medium: #407C94;
    --puntos-primary-mid: #3A637B;
    --puntos-primary-light: #6DA6C1;
    --puntos-primary-accent: #5C88A5;
    
    /* Colores Funcionales */
    --puntos-success: #28a745;
    --puntos-warning: #ffc107;
    --puntos-danger: #dc3545;
    --puntos-info: #17a2b8;
}

/* ==================== CONTENEDOR PRINCIPAL ==================== */
.cliente-detalle-container {
    max-width: 1800px; /* Ampliado de 1400px para mejor aprovechamiento del espacio */
    margin: 0 auto;
    padding: 20px 40px; /* Márgenes laterales aumentados para balance visual */
}

/* ==================== HEADER ==================== */
.detalle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.detalle-header-left,
.detalle-header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-volver {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-volver:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.btn-accion-rapida {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-editar {
    background: var(--puntos-primary-medium);
    color: white;
}

.btn-editar:hover {
    background: var(--puntos-primary-dark);
}

.btn-imprimir {
    background: var(--puntos-success);
    color: white;
}

.btn-imprimir:hover {
    background: #218838;
}

.btn-menu {
    background: #64748b;
    color: white;
    padding: 10px 15px;
}

.btn-menu:hover {
    background: #475569;
}

/* Dropdown de Acciones */
.dropdown-acciones {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    text-align: left;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: #f8fafc;
}

.dropdown-menu button.btn-danger {
    color: #dc2626;
}

.dropdown-menu button.btn-danger:hover {
    background: #fef2f2;
}

.dropdown-menu button i {
    width: 16px;
    text-align: center;
}

/* ==================== TÍTULO Y ESTADO ==================== */
.detalle-titulo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.titulo-info h1 {
    margin: 0 0 5px 0;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.codigo-cliente {
    margin: 0;
    font-size: 16px;
    color: #64748b;
    font-weight: 500;
}

.badge-estado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.badge-activo {
    background: #d1fae5;
    color: #065f46;
}

.badge-inactivo {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-pendiente {
    background: #fef3c7;
    color: #92400e;
}

.badge-revision {
    background: #fed7aa;
    color: #9a3412;
}

/* Badge de Excepción */
.badge-excepcion {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: var(--puntos-warning);
    color: #856404;
    margin-left: 15px;
}

/* ==================== TABS ==================== */
.detalle-tabs {
    display: flex;
    gap: 5px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    background: #f8fafc;
    color: #475569;
}

.tab-btn.active {
    background: var(--puntos-primary-medium);
    color: white;
}

.tab-btn i {
    font-size: 16px;
}

/* ==================== CONTENIDO ==================== */
.detalle-contenido {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 30px;
    min-height: 400px;
}

/* Secciones de Información */
.info-seccion {
    margin-bottom: 40px;
}

.info-seccion:last-child {
    margin-bottom: 0;
}

.info-seccion h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.info-seccion h3 i {
    color: var(--puntos-primary-medium);
}

/* Grid de Información */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item span {
    font-size: 15px;
    color: #0f172a;
    font-weight: 500;
}

.info-item a {
    color: var(--puntos-primary-medium);
    text-decoration: none;
}

.info-item a:hover {
    text-decoration: underline;
}

/* ==================== CONTACTOS ==================== */
.contactos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.contacto-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.contacto-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.contacto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.contacto-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-principal {
    font-size: 11px;
    padding: 4px 8px;
    background: #fff3cd;
    color: #856404;
    border-radius: 12px;
    font-weight: 600;
}

.badge-representante {
    font-size: 11px;
    padding: 4px 8px;
    background: #d1fae5;
    color: #065f46;
    border-radius: 12px;
    font-weight: 600;
}

.contacto-representante {
    border: 2px solid var(--puntos-primary-light);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.contacto-representante:hover {
    border-color: var(--puntos-primary-medium);
    box-shadow: 0 6px 12px -2px rgba(64, 124, 148, 0.15);
}

.contacto-body p {
    margin: 8px 0;
    font-size: 14px;
    color: #475569;
    display: flex;
    align-items: start;
    gap: 8px;
}

.contacto-body i {
    width: 16px;
    margin-top: 2px;
    color: #64748b;
}

/* Emails de Facturación */
.emails-facturacion-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-facturacion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.email-facturacion-item:hover {
    background: #e2e8f0;
    border-color: var(--puntos-primary-light);
}

.email-facturacion-item i {
    color: var(--puntos-primary-medium);
    font-size: 16px;
}

.email-facturacion-item a {
    color: var(--puntos-primary-dark);
    text-decoration: none;
    font-size: 14px;
}

.email-facturacion-item a:hover {
    text-decoration: underline;
}

/* ==================== DOCUMENTOS ==================== */
.documentos-lista {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.documento-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s;
}

.documento-item.documento-subido {
    border-color: var(--puntos-success);
    background: #d4edda;
}

.documento-item.documento-pendiente {
    border-color: #fbbf24;
    background: #fffbeb;
}

.documento-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.documento-info > i {
    font-size: 32px;
    color: #64748b;
    width: 40px;
    text-align: center;
}

.documento-subido .documento-info > i {
    color: var(--puntos-success);
}

.documento-detalles h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.documento-nombre {
    margin: 3px 0;
    font-size: 13px;
    color: #475569;
}

.documento-size {
    margin: 3px 0;
    font-size: 12px;
    color: #64748b;
}

.documento-pendiente-msg {
    margin: 3px 0;
    font-size: 13px;
    color: #92400e;
    font-style: italic;
}

.documento-estado {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.btn-icono {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--puntos-primary-medium);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icono:hover {
    background: var(--puntos-primary-dark);
}

/* ==================== HISTORIAL - TIMELINE ==================== */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-icon {
    position: absolute;
    left: -40px;
    top: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 50%;
    font-size: 14px;
}

.timeline-item.accion-creado .timeline-icon {
    border-color: #10b981;
    background: #d1fae5;
}

.timeline-item.accion-actualizado .timeline-icon {
    border-color: var(--puntos-primary-medium);
    background: #d1ecf1;
}

.timeline-item.accion-documento .timeline-icon {
    border-color: #8b5cf6;
    background: #ede9fe;
}

.timeline-item.accion-estado .timeline-icon {
    border-color: #f59e0b;
    background: #fef3c7;
}

.timeline-item.accion-eliminado .timeline-icon {
    border-color: #ef4444;
    background: #fee2e2;
}

.timeline-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.timeline-fecha {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.timeline-usuario {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
}

.timeline-descripcion {
    margin: 0;
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
}

.timeline-cambios {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.cambio-anterior,
.cambio-nuevo {
    font-size: 12px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    margin: 5px 0;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ==================== ESTADOS VACÍOS Y ERRORES ==================== */
.empty-state,
.error-state,
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #64748b;
}

.empty-state i,
.error-state i,
.loading i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state p,
.error-state p {
    margin: 0;
    font-size: 16px;
}

.error-state {
    color: #dc2626;
}

/* ==================== ALERTAS ==================== */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-info {
    background: #d1ecf1;
    color: var(--puntos-primary-dark);
    border: 1px solid var(--puntos-primary-light);
}

.alert-info i {
    font-size: 18px;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid var(--puntos-warning);
}

.alert-warning i {
    font-size: 20px;
    color: var(--puntos-warning);
}

.alert-excepcion {
    background: #fff3cd;
    border: 2px solid var(--puntos-warning);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.alert-excepcion-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.alert-excepcion-header i {
    font-size: 24px;
    color: var(--puntos-warning);
}

.alert-excepcion-header strong {
    font-size: 16px;
    color: #856404;
}

.alert-excepcion-body {
    margin-left: 36px;
}

.alert-excepcion-body p {
    margin: 8px 0;
    color: #856404;
}

.alert-excepcion-body .badge-puede-facturar {
    display: inline-block;
    padding: 6px 12px;
    background: var(--puntos-success);
    color: white;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 10px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .cliente-detalle-container {
        padding: 15px;
    }

    .detalle-header {
        flex-direction: column;
        align-items: stretch;
    }

    .detalle-header-left,
    .detalle-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .detalle-titulo {
        flex-direction: column;
        align-items: start;
        gap: 15px;
    }

    .titulo-info h1 {
        font-size: 22px;
    }

    .detalle-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .detalle-contenido {
        padding: 20px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .contactos-grid {
        grid-template-columns: 1fr;
    }

    .timeline {
        padding-left: 30px;
    }

    .timeline::before {
        left: 12px;
    }

    .timeline-icon {
        left: -32px;
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .btn-accion-rapida span {
        display: none;
    }

    .btn-accion-rapida {
        padding: 10px 15px;
    }

    .titulo-info h1 {
        font-size: 20px;
    }

    .codigo-cliente {
        font-size: 14px;
    }
}
