/* ===== css/dashboards.css - ESTILOS ESPECÍFICOS DE PANTALLAS ===== */

/* === LOGIN === */
.login-body {
  background: linear-gradient(135deg, var(--mspas-gradient-start), var(--mspas-gradient-end));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background-color: white;
  border-radius: var(--radius-xl);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-xl);
  margin-bottom: var(--spacing-lg);
}

.logo-section {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.logo-section h1 {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--mspas-primary);
  margin-bottom: var(--spacing-sm);
}

.logo-section p {
  color: var(--mspas-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

.login-form {
  margin-bottom: var(--spacing-lg);
}

.test-users {
  background-color: var(--mspas-surface);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
}

.test-users h3 {
  font-size: var(--font-size-base);
  margin-bottom: var(--spacing-md);
  color: var(--mspas-text);
}

.user-grid {
  display: grid;
  gap: var(--spacing-sm);
}

.test-user {
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast);
  font-size: var(--font-size-sm);
}

.test-user:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

/* === DASHBOARD COMPONENTS === */
.dashboard-hero {
  background: linear-gradient(135deg, var(--mspas-gradient-start), var(--mspas-gradient-end));
  color: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.dashboard-hero h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--spacing-sm);
}

.dashboard-hero p {
  opacity: 0.9;
  font-size: var(--font-size-lg);
}

.section-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--mspas-text);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--mspas-primary);
}

/* === REGISTRO DE DATOS === */
.method-card {
  background-color: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all var(--transition-base);
}

.method-card:hover {
  border-color: var(--mspas-primary);
  box-shadow: var(--shadow-md);
}

.method-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--mspas-text);
  margin-bottom: var(--spacing-md);
}

.quantity-input {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.qty-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background-color: var(--mspas-primary);
  color: white;
  font-size: var(--font-size-lg);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.qty-btn:hover {
  transform: scale(1.1);
  background-color: var(--mspas-secondary);
}

.qty-input {
  flex: 1;
  text-align: center;
  font-weight: 600;
  min-width: 60px;
}

/* === TABLAS === */
.table-container {
  background-color: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-xl);
}

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

.table th,
.table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.table th {
  background-color: var(--mspas-surface);
  font-weight: 600;
  color: var(--mspas-text);
  font-size: var(--font-size-sm);
}

.table tr:hover {
  background-color: rgba(99, 102, 241, 0.05);
}

/* === STATUS BADGES === */
.status {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  border-radius: var(--radius-lg);
}

.status-registrado {
  background-color: #fff3e0;
  color: var(--mspas-warning);
}

.status-validado {
  background-color: #e3f2fd;
  color: var(--mspas-secondary);
}

.status-aprobado {
  background-color: #f0fdf4;
  color: var(--mspas-success);
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 767px) {
  .dashboard-hero {
    padding: var(--spacing-lg);
  }
  
  .dashboard-hero h2 {
    font-size: var(--font-size-xl);
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  .table {
    min-width: 600px;
  }
}

/* ===== ESTILOS FORMULARIO DE REGISTRO ===== */

/* Selector de período */
.period-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-select {
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--mspas-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Categorías de métodos */
.method-category {
    margin-bottom: 32px;
}

.category-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.method-grid {
    display: grid;
    gap: 16px;
}

/* Elementos de método individual */
.method-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--surface-light);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.method-item label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

/* Counter input */
.counter-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.counter-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--mspas-primary);
    background: var(--surface);
    color: var(--mspas-primary);
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.counter-btn:hover {
    background: var(--mspas-primary);
    color: white;
    transform: translateY(-1px);
}

.counter-btn:active {
    transform: translateY(0);
}

.counter-input input {
    width: 80px;
    height: 40px;
    text-align: center;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.counter-input input:focus {
    outline: none;
    border-color: var(--mspas-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Resumen total */
.total-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--mspas-primary), var(--mspas-secondary));
    border-radius: 12px;
    color: white;
}

.total-label {
    font-size: 1rem;
    font-weight: 500;
}

.total-value {
    font-size: 2rem;
    font-weight: 700;
}

/* Botones de acción */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
}

.btn {
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-secondary);
    border: 2px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--mspas-primary), var(--mspas-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .method-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .period-selector {
        max-width: 400px;
    }
    
    .action-buttons {
        max-width: 400px;
        margin: 24px auto 0;
    }
}

/* Estilos para toast warnings */
.toast-warning {
    background: linear-gradient(135deg, #F59E0B, #D97706) !important;
}

/* Animaciones para toast */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ===== ESTILOS PERFIL DE USUARIO ===== */

/* Grid de información personal */
.profile-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

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

.info-item label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 8px 0;
    border-bottom: 2px solid var(--border-light);
    background: transparent;
}

/* Sección editable */
.editable-section {
    margin: 32px 0;
    padding: 24px 0;
    border-top: 2px solid var(--border-light);
}

.editable-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editable-section h3:before {
    content: "✏️";
    font-size: 1rem;
}

/* Grupos de input */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--mspas-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input:invalid {
    border-color: #EF4444;
}

.input-help {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-style: italic;
}

/* Acciones de formulario */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.form-actions .btn {
    flex: 1;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-secondary);
    border: 2px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--mspas-primary), var(--mspas-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Información del sistema */
.system-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.system-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.system-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.system-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Estados especiales */
.status-connected {
    color: #10B981;
}

.status-disconnected {
    color: #EF4444;
}

.status-syncing {
    color: #F59E0B;
}

/* Asignaciones dinámicas */
#asignaciones-content .assignment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#asignaciones-content .assignment-item {
    padding: 12px 16px;
    background: var(--surface-light);
    border-radius: 8px;
    border-left: 4px solid var(--mspas-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#asignaciones-content .assignment-name {
    font-weight: 500;
    color: var(--text-primary);
}

#asignaciones-content .assignment-code {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .profile-info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        flex: none;
    }
    
    .system-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ===== ESTILOS PERFIL DE USUARIO ===== */

/* Grid de información personal */
.perfil-info-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Mobile: 1 columna */
@media (max-width: 768px) {
    .perfil-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablet: 2 columnas */
@media (min-width: 769px) and (max-width: 1024px) {
    .perfil-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columnas */
@media (min-width: 1025px) {
    .perfil-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Campo de perfil */
.perfil-campo {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background-color: var(--background-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.perfil-campo label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.perfil-valor {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    min-height: 1.2rem;
}

/* Comunidades asignadas */
.comunidad-item {
    padding: 0.75rem;
    background-color: var(--background-light);
    border-radius: 6px;
    border-left: 4px solid var(--mspas-primary);
    margin-bottom: 0.5rem;
}

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

.comunidad-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.comunidad-codigo {
    display: inline-block;
    background-color: var(--mspas-primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 0.5rem;
}

.comunidad-item small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Formularios del perfil */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
    background-color: var(--background-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--mspas-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input:invalid {
    border-color: var(--error-color, #ef4444);
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Botones del perfil */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    justify-content: center;
    min-width: 140px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--mspas-primary), var(--mspas-secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Loading spinner */
.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Estadísticas detalladas del perfil */
.perfil-detalle-stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .perfil-detalle-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Lista de permisos */
#lista-permisos {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Responsive para móviles */
@media (max-width: 480px) {
    .perfil-campo {
        padding: 0.5rem;
    }
    
    .form-group input {
        padding: 0.625rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
        min-width: 120px;
    }
    
    .comunidad-item {
        padding: 0.5rem;
    }
}

/* Estados de validación */
.form-group input:valid {
    border-color: var(--success-color, #10b981);
}

.form-group input:invalid:not(:placeholder-shown) {
    border-color: var(--error-color, #ef4444);
}

/* Animaciones suaves */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
/* ===== BOTONES PEQUEÑOS PARA ACCIONES DE VALIDACIÓN ===== */
.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 0.125rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-warning {
    background-color: var(--mspas-warning);
    color: white;
}

.btn-warning:hover {
    background-color: #D97706;
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #EF4444;
    color: white;
}

.btn-danger:hover {
    background-color: #DC2626;
    transform: translateY(-1px);
}

/* ===== ESTILOS DASHBOARD ENCARGADO ===== */
.territories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.territory-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.territory-card.excelente { 
    border-color: #28a745; 
    background: linear-gradient(135deg, #f0f9f0 0%, #ffffff 100%);
}

.territory-card.bueno { 
    border-color: #28a745; 
}

.territory-card.regular { 
    border-color: #ffc107; 
    background: linear-gradient(135deg, #fff8e1 0%, #ffffff 100%);
}

.territory-card.critico { 
    border-color: #dc3545; 
    background: linear-gradient(135deg, #ffebee 0%, #ffffff 100%);
}

.territory-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.75rem;
    color: #333;
}

.territory-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.territory-stats .stat {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

/* Logo en login */
.main-logo {
    max-height: 60px;
    max-width: 200px;
    width: auto;
    height: auto;
    margin-bottom: var(--spacing-md);
}

/* Logo en header */
.header-logo {
    max-height: 32px;
    max-width: 120px;
    width: auto;
    height: auto;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .main-logo {
        max-height: 50px;
        max-width: 150px;
    }
    
    .header-logo {
        max-height: 28px;
        max-width: 100px;
    }
}