/**
 * SisControl - Sistema de Control
 * Archivo de estilos unificado para módulos
 * Versión: 1.0.0
 * Descripción: Estilos consistentes con gradientes azules modernos
 */

/* ========================================
   ESTILOS GENERALES
   ======================================== */

body {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    min-height: 100vh;
    padding: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.main-container {
    max-width: 98%;
    margin: 0 auto;
    padding: 0 1%;
}

/* ========================================
   TARJETAS (CARDS)
   ======================================== */

.card {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: none;
    margin-bottom: 20px;
    background-color: #ffffff;
}

.card-header {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
    border-radius: 15px 15px 0 0 !important;
    padding: 20px;
    font-weight: bold;
    font-size: 1.2em;
    border: none;
}

.card-body {
    padding: 2rem;
}

/* ========================================
   SELECTORES MÚLTIPLES
   ======================================== */

.multipleselect {
    height: 400px;
    border: 2px solid #b3e5fc;
    border-radius: 10px;
    padding: 10px;
    background-color: #ffffff;
    overflow-y: auto;
}

.multipleselect option {
    padding: 8px;
    margin: 2px 0;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multipleselect option:hover {
    background-color: #4fc3f7;
    color: white;
}

.multipleselect option:checked {
    background: linear-gradient(135deg, #4dd0e1 0%, #0097a7 100%);
    color: white;
}

/* ========================================
   BOTONES
   ======================================== */

.btn-primary-gradient {
    background: linear-gradient(135deg, #4dd0e1 0%, #0097a7 100%);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary-gradient:hover {
    background: linear-gradient(135deg, #26c6da 0%, #00838f 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(77, 208, 225, 0.4);
}

.btn-danger-gradient {
    background: linear-gradient(135deg, #ff7043 0%, #d84315 100%);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.btn-danger-gradient:hover {
    background: linear-gradient(135deg, #ff5722 0%, #bf360c 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 112, 67, 0.4);
}

.btn-success-gradient {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.btn-success-gradient:hover {
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 187, 106, 0.4);
}

.btn-transfer {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5em;
    margin: 10px 0;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-transfer:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ========================================
   TÍTULOS Y SECCIONES
   ======================================== */

.section-title {
    font-weight: 600;
    color: #01579b;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #e1f5fe;
    border-radius: 8px;
    text-align: center;
    font-size: 1.1em;
}

.page-title {
    color: white;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* ========================================
   BADGES Y ETIQUETAS
   ======================================== */

.service-badge {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
    margin-bottom: 20px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(86, 204, 242, 0.3);
}

.badge-call {
    background: linear-gradient(135deg, #26c6da 0%, #00acc1 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    margin-left: 10px;
}

.badge-info {
    background: linear-gradient(135deg, #29b6f6 0%, #0277bd 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
}

.badge-warning {
    background: linear-gradient(135deg, #ffa726 0%, #f57c00 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
}

.badge-success {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85em;
}

/* ========================================
   ALERTAS
   ======================================== */

.alert-info-custom {
    background-color: #e1f5fe;
    border: 2px solid #4fc3f7;
    color: #01579b;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.alert-warning-custom {
    background-color: #fff3e0;
    border: 2px solid #ffb74d;
    color: #e65100;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.alert-success-custom {
    background-color: #e8f5e9;
    border: 2px solid #81c784;
    color: #1b5e20;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.alert-danger-custom {
    background-color: #ffebee;
    border: 2px solid #e57373;
    color: #b71c1c;
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

/* ========================================
   INPUTS Y FORMULARIOS
   ======================================== */

.form-control:focus,
.form-select:focus {
    border-color: #4fc3f7;
    box-shadow: 0 0 0 0.25rem rgba(79, 195, 247, 0.25);
}

.input-group-text {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
    border: none;
    font-weight: 600;
}

/* Estilo para inputs con icono */
.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .form-control {
    padding-left: 45px;
}

.input-icon-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #4fc3f7;
}

/* ========================================
   TABLAS
   ======================================== */

.table-custom {
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.table-custom thead {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
}

.table-custom thead th {
    border: none;
    padding: 15px 10px;
    font-weight: 700;
    text-align: center;
    font-size: 14px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.table-custom tbody tr {
    transition: all 0.2s ease;
}

.table-custom tbody tr:hover {
    background-color: #e1f5fe;
    transform: scale(1.005);
}

.table-custom tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #e0e0e0;
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.table-custom tfoot th {
    padding: 15px 10px;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

/* ========================================
   MODALES
   ======================================== */

.modal-header {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-footer {
    border-top: 1px solid #e0e0e0;
    padding: 15px 20px;
}

/* ========================================
   UTILIDADES
   ======================================== */

.text-gradient {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
}

.bg-gradient-light {
    background: linear-gradient(135deg, #b3e5fc 0%, #81d4fa 100%);
}

.shadow-custom {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.rounded-custom {
    border-radius: 15px;
}

/* ========================================
   SPINNER DE CARGA
   ======================================== */

.spinner-custom {
    border: 4px solid #e1f5fe;
    border-top: 4px solid #2f80ed;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   BREADCRUMB
   ======================================== */

.breadcrumb-custom {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.breadcrumb-custom .breadcrumb-item a {
    color: #2f80ed;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-custom .breadcrumb-item.active {
    color: #01579b;
    font-weight: 600;
}

/* ========================================
   PAGINACIÓN
   ======================================== */

.pagination-custom .page-link {
    color: #2f80ed;
    border: 1px solid #b3e5fc;
    margin: 0 3px;
    border-radius: 5px;
}

.pagination-custom .page-link:hover {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    color: white;
    border-color: transparent;
}

.pagination-custom .page-item.active .page-link {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
    border-color: transparent;
    color: white;
}

/* ========================================
   TOOLTIPS PERSONALIZADOS
   ======================================== */

.tooltip-custom {
    position: relative;
    display: inline-block;
}

.tooltip-custom .tooltip-text {
    visibility: hidden;
    background-color: #01579b;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85em;
}

.tooltip-custom:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .main-container {
        padding: 0 5px;
        max-width: 100%;
    }

    .card-header {
        font-size: 1em;
        padding: 15px;
    }

    .btn-transfer {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }

    .multipleselect {
        height: 300px;
    }

    .section-title {
        font-size: 0.95em;
        padding: 8px;
    }

    .page-title {
        font-size: 1.5em;
    }

    .table-custom thead th,
    .table-custom tbody td,
    .table-custom tfoot th {
        font-size: 11px;
        padding: 8px 5px;
    }
}

@media (max-width: 576px) {
    body {
        padding: 10px 0;
    }

    .card-body {
        padding: 1rem;
    }

    .service-badge {
        font-size: 0.9em;
        padding: 8px 15px;
    }

    .btn-transfer {
        width: 45px;
        height: 45px;
        font-size: 1em;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

/* ========================================
   MAINFRAME / IFRAME
   ======================================== */

/* El iframe del mainframe ocupa todo el espacio disponible menos el navbar y el iframe de notificaciones */
.iframe-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px); /* 56px es la altura típica de un navbar de Bootstrap */
    overflow: hidden;
}

/* Para iframes con clase mainframe-full */
iframe.mainframe-full {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
}

/* Para el iframe secundario (xx) que es de notificaciones */
iframe.notification-frame {
    width: 100%;
    height: 30px;
    border: none;
    flex-shrink: 0;
}

/* Estilos específicos para la página principal con layout completo */
body.layout-principal {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
}

body.layout-principal html {
    height: 100%;
    overflow: hidden;
}

/* ========================================
   IMPRESIÓN
   ======================================== */

@media print {
    body {
        background: white;
        padding: 0;
    }

    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }

    .btn, .no-print {
        display: none;
    }
}

/* ========================================
   ESTILOS ADICIONALES PARA REPORTES
   ======================================== */

/* Mejora de contraste en texto de tablas */
.table-custom tbody td {
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

/* Hacer los números más legibles */
.table-custom tbody td[style*="text-align: center"] {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.3px;
}

/* Estilo para celdas pequeñas */
.table-custom tbody td[style*="font-size: 10px"] {
    font-size: 13px !important;
    font-weight: 500;
}

/* Mejorar legibilidad del footer de tablas */
.table-custom tfoot {
    background: linear-gradient(135deg, #56ccf2 0%, #2f80ed 100%);
}

/* Agregar espacio entre filas para mejor legibilidad */
.table-custom tbody tr {
    border-bottom: 2px solid #f5f5f5;
}

/* Estilo alternado de filas para mejor legibilidad */
.table-custom tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.table-custom tbody tr:nth-child(odd) {
    background-color: #ffffff;
}

/* Asegurar que hover funcione correctamente */
.table-custom tbody tr:hover {
    background-color: #e1f5fe !important;
}

/* ========================================
   ESTILOS PARA SELECTORES PERSONALIZADOS
   ======================================== */

.select-custom {
    width: 100%;
    max-width: 300px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
    color: #01579b;
    background: linear-gradient(135deg, #ffffff 0%, #e1f5fe 100%);
    border: 2px solid #4fc3f7;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f80ed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

.select-custom:hover {
    border-color: #2f80ed;
    box-shadow: 0 4px 10px rgba(79, 195, 247, 0.3);
    transform: translateY(-2px);
}

.select-custom:focus {
    border-color: #2f80ed;
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.2);
    background: linear-gradient(135deg, #ffffff 0%, #b3e5fc 100%);
}

.select-custom option {
    padding: 10px;
    background-color: white;
    color: #333;
    font-weight: 500;
}

.select-custom option:hover,
.select-custom option:checked {
    background: linear-gradient(135deg, #4fc3f7 0%, #2f80ed 100%);
    color: white;
}

/* Contenedor para centrar el select */
.select-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 15px;
}

.select-wrapper label {
    font-size: 16px;
    font-weight: 600;
    color: #01579b;
    margin-bottom: 5px;
}

/* Estilos mejorados para botones con iconos */
.btn i.glyphicon {
    margin-right: 8px;
}

.btn-primary-gradient,
.btn-success-gradient,
.btn-danger-gradient {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.btn-primary-gradient i,
.btn-success-gradient i,
.btn-danger-gradient i {
    font-size: 16px;
}

/* Botones en headers de cards */
.card-header .btn {
    background: rgba(255, 255, 255, 0.95);
    color: #2f80ed;
    border: 2px solid rgba(255, 255, 255, 0.8);
    font-weight: 600;
    padding: 8px 16px;
    font-size: 13px;
}

.card-header .btn:hover {
    background: white;
    color: #01579b;
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-header .btn i {
    color: #43a047;
}

/* Contenedor de botones flexibles */
.btn-group-flex {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column !important;
        gap: 10px;
    }

    .card-header .btn {
        width: 100%;
    }
}
