/* Estilos comunes de FibreManager */

/* --- Estados de contrato --- */
.badge-pendiente  { background-color: #ffc107; color: #000; }
.badge-instalado  { background-color: #28a745; }
.badge-gestionado { background-color: #17a2b8; }
.badge-cancelado  { background-color: #dc3545; }
.badge-expirado   { background-color: #6c757d; }

/* --- Tipos de operador --- */
.badge-actual   { background-color: #28a745; }
.badge-anterior { background-color: #6c757d; }
.badge-ambos    { background-color: #17a2b8; }
.badge-operador { background-color: #6f42c1; }
.badge-tarifa   { background-color: #20c997; }

/* --- Avisos de vencimiento --- */
/* !important: Bootstrap 5.3 fija el color de cada celda de tabla (filas rayadas
   y resaltadas) y taparia estos colores si se ponen en el propio <td> */
.text-expirado { color: #dc3545 !important; font-weight: bold; }
.text-proximo  { color: #fd7e14 !important; font-weight: bold; }
.text-ok       { color: #198754 !important; }

.alert-card {
    border-radius: 10px;
    border: none;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.alert-card:hover { transform: translateX(5px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.alert-urgencia-alta  { border-left: 5px solid #dc3545; background: linear-gradient(135deg, #fff5f5, #ffe6e6); }
.alert-urgencia-media { border-left: 5px solid #ffc107; background: linear-gradient(135deg, #fffbf0, #fff3cd); }
.alert-urgencia-baja  { border-left: 5px solid #28a745; background: linear-gradient(135deg, #f0fff4, #d4edda); }
.alert-expirado       { border-left: 5px solid #6c757d; background: linear-gradient(135deg, #f8f9fa, #e9ecef); }

.badge-urgencia { font-size: 0.8em; padding: 5px 10px; border-radius: 20px; }
.dias-counter   { font-size: 1.5em; font-weight: bold; text-align: center; }
.client-info    { font-size: 0.9em; color: #666; }

/* --- Tarjetas --- */
.card-stat { transition: transform 0.3s; border: none; border-radius: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.card-stat:hover { transform: translateY(-5px); box-shadow: 0 8px 15px rgba(0,0,0,0.2); }
.facturacion-card { border: none; border-radius: 10px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.profile-card, .password-card { border: none; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

.section-title { border-bottom: 3px solid #007bff; padding-bottom: 10px; margin-bottom: 20px; color: #2c3e50; }
.quick-actions { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border-radius: 15px; padding: 20px; margin-bottom: 20px; }
.quick-actions h5 { color: white; margin-bottom: 15px; }
.user-info-card { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); color: white; border-radius: 15px; padding: 20px; margin-bottom: 20px; }

/* --- Tablas con filtros --- */
.table th { background-color: #343a40; color: white; position: relative; }
.filtro-input, .filtro-select {
    width: 100%;
    padding: 5px;
    margin-top: 5px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    background-color: #fff;
    color: #212529;
}
.filtro-input:focus, .filtro-select:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
.filtros-activos { background-color: #e9ecef; padding: 10px; border-radius: 5px; margin-bottom: 15px; }
.badge-filtro { background-color: #007bff; color: white; padding: 5px 10px; border-radius: 20px; margin-right: 5px; margin-bottom: 5px; display: inline-block; font-size: 12px; }
.btn-limpiar-filtros { font-size: 12px; padding: 3px 10px; }
.cabecera-orden { cursor: pointer; user-select: none; }
.cabecera-orden:hover { background-color: #3d454d !important; }
.sort-icon { font-size: 12px; margin-left: 5px; }

/* --- Formularios --- */
.advertencia { border-left: 5px solid #ffc107; background-color: #fffbf0; }
.tarifa-info, .operador-info { font-size: 0.875rem; color: #6c757d; }
.btn-eliminar { background-color: #dc3545; color: white; }
.btn-eliminar:hover { background-color: #bb2d3b; color: white; }
.btn-eliminar:disabled { background-color: #6c757d; cursor: not-allowed; opacity: 0.65; }

.password-strength { height: 5px; border-radius: 5px; margin-top: 5px; transition: all 0.3s ease; }
.strength-weak        { background-color: #dc3545; width: 25%; }
.strength-medium      { background-color: #ffc107; width: 50%; }
.strength-strong      { background-color: #28a745; width: 75%; }
.strength-very-strong { background-color: #20c997; width: 100%; }

/* --- Impresion (usada por "Imprimir / Guardar como PDF") --- */
@media print {
    .navbar, .no-imprimir, .btn, form { display: none !important; }
    .card { border: none !important; box-shadow: none !important; }
    body { font-size: 12px; }
}

/* --- Listado de contratos: 13 columnas con filtro en la cabecera --- */
/* Letra algo menor y celdas mas juntas para que quepan todas las columnas */
#tablaContratos { font-size: 0.8rem; margin-bottom: 0; }
#tablaContratos > :not(caption) > * > * { padding: 0.4rem 0.3rem; }
/* Abajo: asi las cajas de filtro quedan en la misma fila aunque el titulo ocupe dos lineas */
#tablaContratos thead th { vertical-align: bottom; font-weight: 600; }
#tablaContratos tbody td { vertical-align: middle; }
/* La caja de filtro no debe marcar el ancho de la columna, solo ocuparlo */
#tablaContratos .filtro-input,
#tablaContratos .filtro-select { min-width: 4.5rem; padding: 3px 4px; }
/* El titulo puede partirse en dos lineas; asi no ensancha la columna */
#tablaContratos .cabecera-orden { display: inline-block; }
#tablaContratos td:nth-child(1) { width: 1%; }
#tablaContratos th:first-child .filtro-input { min-width: 3rem; }
/* Columnas cortas: nunca partir (ID, documento, fechas, estado, acciones) */
#tablaContratos td:nth-child(1), #tablaContratos td:nth-child(3),
#tablaContratos td:nth-child(8),  #tablaContratos td:nth-child(9),
#tablaContratos td:nth-child(12), #tablaContratos td:nth-child(13) { white-space: nowrap; }
/* Columnas de texto largo: ancho minimo legible */
#tablaContratos td:nth-child(2)  { min-width: 8.5rem; }
#tablaContratos td:nth-child(4)  { min-width: 8.5rem; }
#tablaContratos td:nth-child(10) { min-width: 5rem; }
#tablaContratos td:nth-child(11) { min-width: 7rem; }
/* La insignia de tarifa (nombres largos) puede ocupar dos lineas */
#tablaContratos td:nth-child(7) .badge { white-space: normal; text-align: left; line-height: 1.25; }
#tablaContratos td:nth-child(7) { min-width: 8rem; }

@media (max-width: 767.98px) {
    /* En el movil la tabla se desplaza de lado dentro de su caja (.table-responsive) */
    .filtros-activos .d-flex { flex-wrap: wrap; gap: 0.5rem; }
}
