/* ============================================
   ATM MONITOR - CSS LIMPIO Y COMPLETO
   Gobierno Digital Elegante
   ============================================ */

/* VARIABLES CSS */
:root {
    /* Colores institucionales */
    --atm-primary: #2563eb;
    --atm-primary-hover: #1d4ed8;
    --atm-danger: #dc2626;
    --atm-danger-light: #fef2f2;
    --atm-danger-border: #fecaca;
    --atm-success: #059669;
    --atm-success-light: #f0fdf4;
    --atm-success-border: #bbf7d0;
    --atm-warning: #d97706;
    --atm-warning-light: #fef3c7;
    --atm-warning-border: #fde68a;
    
    /* Grises del sistema */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Bordes y sombras */
    --border-radius: 6px;
    --border-color: var(--gray-200);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* RESET Y BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
    background: #fafbfc;
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   HEADER INSTITUCIONAL
   ============================================ */

.header-institucional {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.brand-institucional {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.escudo-atm {
    width: 48px;
    height: 48px;
    background: var(--atm-primary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.institucion {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.sistema-nombre {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: 1px;
}

.header-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
}

.status-simple {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 13px;
    color: var(--gray-600);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--atm-success);
    flex-shrink: 0;
}

/* ============================================
   BOTONES
   ============================================ */

.btn-simple {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.btn-simple:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-primary {
    background: var(--atm-primary);
    border-color: var(--atm-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--atm-primary-hover);
    border-color: var(--atm-primary-hover);
    color: white;
}

/* ============================================
   CONTENIDO PRINCIPAL
   ============================================ */

.container-principal {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-lg);
}

/* ============================================
   NAVEGACIÓN DE PESTAÑAS
   ============================================ */

.nav-simple {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-item {
    padding: 0.5rem 1rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
}

.nav-item:hover {
    color: var(--atm-primary);
}

.nav-item.active {
    color: var(--atm-primary);
    border-bottom-color: var(--atm-primary);
}

.nav-count {
    background: var(--gray-100);
    color: var(--gray-500);
    padding: 0.2rem 0.4rem;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.nav-item.active .nav-count {
    background: #dbeafe;
    color: var(--atm-primary);
}

/* ============================================
   ESTADÍSTICAS
   ============================================ */

.stats-limpio {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.stat-simple {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    text-align: center;
    transition: box-shadow 0.15s ease;
}

.stat-simple:hover {
    box-shadow: var(--shadow-sm);
}

.stat-numero {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-simple.esperando .stat-numero { color: var(--atm-warning); }
.stat-simple.asignados .stat-numero { color: var(--atm-primary); }
.stat-simple.proceso .stat-numero { color: var(--atm-success); }

/* ============================================
   TABLA
   ============================================ */

.tabla-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tabla-gobierno {
    width: 100%;
    border-collapse: collapse;
}

.tabla-gobierno thead {
    background: var(--gray-50);
}

.tabla-gobierno th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tabla-gobierno tbody tr {
    transition: background-color 0.15s ease;
}

.tabla-gobierno tbody tr:hover {
    background: var(--gray-50);
}

.tabla-gobierno tbody tr:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.tabla-gobierno tbody tr.asignada {
    background: #eff6ff;
    border-left: 3px solid var(--atm-primary);
}

.tabla-gobierno tbody tr.asignada:hover {
    background: #dbeafe;
}

.tabla-gobierno td {
    padding: 0.5rem 0.75rem;
    vertical-align: top;
    font-size: 13px;
}

/* ============================================
   ELEMENTOS DE CONTENIDO
   ============================================ */

/* Tiempo */
.tiempo-simple {
    font-family: "SF Mono", "Monaco", "Consolas", monospace;
    font-size: 12px;
}

.tiempo-hora {
    font-weight: 600;
    color: var(--gray-800);
    display: block;
    margin-bottom: 2px;
}

.tiempo-transcurrido {
    color: var(--gray-500);
    font-size: 11px;
}

/* Ciudadano */
.ciudadano-simple {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.2;
}

/* Etiquetas */
.etiquetas-container {
    margin-top: 0.25rem;
    font-size: 11px;
    color: #64748b;
    line-height: 1.3;
}

.tag-separator {
    margin: 0 0.25rem;
    opacity: 0.5;
    color: #94a3b8;
}

/* Teléfono */
.telefono-simple {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--atm-danger);
    text-decoration: none;
    font-weight: 500;
    padding: 0.3rem 0.6rem;
    background: var(--atm-danger-light);
    border: 1px solid var(--atm-danger-border);
    border-radius: var(--border-radius);
    font-size: 12px;
    transition: all 0.15s ease;
}

.telefono-simple:hover {
    background: var(--atm-danger-border);
    border-color: #f87171;
    color: #b91c1c;
    transform: translateY(-1px);
}

.telefono-icon {
    font-size: 11px;
}

/* CUIT */
.cuit-simple {
    font-family: "SF Mono", "Monaco", "Consolas", monospace;
    background: var(--gray-50);
    color: var(--gray-600);
    padding: 0.3rem 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 500;
}

.sin-dato {
    color: var(--gray-400);
    font-style: italic;
    font-size: 13px;
}

/* Consulta */
.consulta-text {
    font-size: 12px;
    color: #374151;
    line-height: 1.4;
    max-width: 200px;
    word-break: break-word;
    min-height: 1em;
}

/* ============================================
   BADGES
   ============================================ */

.badge-discreto {
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    line-height: 1.2;
    display: inline-block;
    min-width: 45px;
    text-align: center;
}

.badge-rango-1 {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.badge-rango-2 {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-esperando {
    background: var(--atm-warning-light);
    color: #92400e;
    border: 1px solid var(--atm-warning-border);
}

.badge-asignado {
    background: #dbeafe;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-proceso {
    background: var(--atm-success-light);
    color: var(--atm-success);
    border: 1px solid var(--atm-success-border);
}

.badge-completado {
    background: var(--atm-success-light);
    color: #166534;
    border: 1px solid var(--atm-success-border);
}

/* ============================================
   OPERADOR Y ASIGNACIÓN
   ============================================ */

.operador-simple {
    font-size: 12px;
    color: var(--gray-500);
}

.operador-asignado {
    font-weight: 600;
    color: var(--atm-primary);
    font-size: 12px;
}

.operador-container:hover {
    background: #f8fafc;
    border-radius: 4px;
    padding: 0.25rem;
    margin: -0.25rem;
}

.btn-asignar {
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    padding: 0.3rem 0.6rem;
    border-radius: var(--border-radius);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.15s ease;
}

.btn-asignar:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

/* ============================================
   ACCIONES
   ============================================ */

.acciones-simple {
    display: flex;
    gap: 0.25rem;
}

.btn-accion-simple {
    width: 28px;
    height: 28px;
    border: 1px solid var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-600);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
}

.btn-accion-simple:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-accion-simple.completar {
    background: var(--atm-success-light);
    border-color: var(--atm-success-border);
    color: var(--atm-success);
}

.btn-accion-simple.completar:hover {
    background: #dcfce7;
    border-color: #86efac;
}

/* ============================================
   ESTADOS ESPECIALES
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.6;
}

.empty-state h5 {
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
    font-size: 15px;
    font-weight: 600;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 13px;
    line-height: 1.5;
}

/* Sync status */
.sync-status {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-bottom: var(--spacing-md);
    font-size: 13px;
    color: #166534;
}

.sync-status.syncing {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.sync-status.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ============================================
   ANIMACIONES
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-20px); opacity: 0; }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 1400px) {
    .container-principal {
        max-width: 1400px;
    }
    
    .stats-limpio {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .tabla-gobierno th,
    .tabla-gobierno td {
        padding: 0.4rem 0.6rem;
        font-size: 12px;
    }
    
    .ciudadano-simple {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .container-principal {
        padding: var(--spacing-md);
    }

    .header-content {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }

    .header-status {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .stats-limpio {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-item {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 12px;
    }

    .hide-mobile {
        display: none;
    }

    .acciones-simple {
        flex-direction: column;
        gap: 0.125rem;
    }

    .btn-accion-simple {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .etiquetas-container {
        font-size: 10px;
    }

    .badge-discreto {
        font-size: 9px;
        padding: 0.15rem 0.3rem;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .stats-limpio {
        grid-template-columns: 1fr;
    }

    .sistema-nombre {
        font-size: 15px;
    }

    .tabla-gobierno th,
    .tabla-gobierno td {
        padding: 0.4rem 0.25rem;
    }

    .telefono-simple {
        padding: 0.25rem 0.4rem;
        font-size: 11px;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-mono { font-family: "SF Mono", "Monaco", "Consolas", monospace; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }

/* Focus states para accesibilidad */
.btn-simple:focus,
.btn-accion-simple:focus,
.nav-item:focus {
    outline: 2px solid var(--atm-primary);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Botón rojo - No Respondió */
.btn-accion-simple.no-respondio {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b4b1b1;
}

.btn-accion-simple.no-respondio:hover {
    background: #fee2e2;
    border-color: #f87171;
}


/* Animación sutil para llamar la atención */
@keyframes pulse-red {
    0%, 100% { 
        box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
    }
    50% { 
        box-shadow: 0 1px 6px rgba(220, 38, 38, 0.6);
    }
}

/* Mejorar el contraste para "no-respondió" */
.conversation-row.has-no-respondido {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%) !important;
    border-left: 5px solid #dc2626 !important;
    box-shadow: inset 0 1px 0 rgba(220, 38, 38, 0.1);
}

.conversation-row.has-no-respondido:hover {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.15), inset 0 1px 0 rgba(220, 38, 38, 0.1);
}


/* Ícono visual antes del nombre para casos críticos */
.conversation-row.has-no-respondido .ciudadano-simple::before {
    content: "📞❌ ";
    font-size: 12px;
    margin-right: 4px;
}

/* Badge de estado NO-RESPONDIÓ en naranja oscuro */
.badge-no-respondio-estado {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 10px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    border: 1px solid #9a3412 !important;
    box-shadow: 0 2px 4px rgba(234, 88, 12, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* Conversación resuelta - Estilo visual verde suave */
.conversation-row.has-resuelto {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%) !important;
    border-left: 4px solid #059669 !important;
    box-shadow: inset 0 1px 0 rgba(5, 150, 105, 0.1);
}

.conversation-row.has-resuelto:hover {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.15), inset 0 1px 0 rgba(5, 150, 105, 0.1);
}

/* Badge de estado RESUELTO en verde */
.badge-resuelto-estado {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 10px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    border: 1px solid #065f46 !important;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ícono visual para casos resueltos */
.conversation-row.has-resuelto .ciudadano-simple::before {
    content: "✅ ";
    font-size: 12px;
    margin-right: 4px;
    color: #059669;
}
