/* public/style.css */
:root {
    --primary-color: #004a87; /* Azul institucional */
    --accent-color: #cc0000;  /* Rojo acento */
    --bg-color: #f4f6f9;
    --text-color: #333333;
}

/* === ESTILOS GENERALES === */
body {
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
}

/* === PANTALLA DE LOGIN (index.html) === */
.login-body {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 74, 135, 0.95);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    border-top: 5px solid var(--accent-color);
    text-align: center;
}

.ls-wider {
    letter-spacing: 10px;
}

/* === DASHBOARD (dashboard.html) === */
.navbar-custom {
    background-color: var(--primary-color);
    color: white;
    border-bottom: 4px solid var(--accent-color);
}

.card-header-custom {
    background-color: #e9ecef;
    border-bottom: 2px solid var(--primary-color);
    font-weight: bold;
    color: #333;
}

.cdp-card {
    transition: transform 0.2s;
    border-left: 4px solid var(--primary-color) !important;
}

.cdp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Ajustes Select2 para Bootstrap */
.select2-container .select2-selection--single {
    height: 38px;
    padding: 5px;
    border: 1px solid #ced4da;
    border-radius: 6px;
}

.select2-selection__arrow { top: 5px !important; }

/* === CORRECCIONES DE ACCESIBILIDAD Y HIT-TEST (SANDBOX TOGGLE) === */
.form-check.form-switch {
    padding-left: 2.5em; 
    position: relative;
    z-index: 1;
}

input#switchSandbox {
    cursor: pointer;
    z-index: 2;
}

.form-check.form-switch .form-check-label {
    cursor: pointer;
    z-index: 2;
    position: relative;
}

/* === ESTILOS PARA EL ÁRBOL JERÁRQUICO (V31) === */
ul.tree, ul.tree ul { 
    list-style-type: none; 
    margin: 0; 
    padding: 0; 
}
ul.tree ul { 
    padding-left: 1.5em; 
    border-left: 1px dashed #ccc; 
    margin-left: 10px; 
}
ul.tree li { 
    margin: 5px 0; 
    position: relative; 
}
ul.tree li::before { 
    content: ''; 
    position: absolute; 
    top: 12px; 
    left: -15px; 
    width: 10px; 
    border-top: 1px dashed #ccc; 
}
.tree-node { 
    cursor: pointer; 
    padding: 4px 8px; 
    border-radius: 4px; 
    display: inline-block; 
    transition: background 0.2s; 
    font-size: 0.9em; 
}
.tree-node:hover { 
    background: #e9ecef; 
}
.tree-icon { 
    margin-right: 6px; 
    color: var(--primary-color, #004a87); 
}

/* ==========================================
   ORGANIGRAMA / MAPA JERÁRQUICO HORIZONTAL
   ========================================== */
.tree-org-wrapper {
    position: relative;
    width: 100%;
}

.tree-org {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.tree-org::-webkit-scrollbar {
    height: 8px;
}
.tree-org::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}
.tree-org::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.tree-org-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-width: max-content;
}

.tree-org-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px 16px;
    width: 250px;
    min-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 2;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tree-org-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.tree-org-card.matriz-card {
    border-top: 4px solid #004a87;
}

.tree-org-card.filial-card {
    border-top: 4px solid #0dcaf0;
}

.tree-org-card.activa {
    border: 2px solid #ffc107 !important;
    box-shadow: 0 0 14px rgba(255, 193, 7, 0.5);
}

.tree-org-children {
    display: flex;
    justify-content: center;
    gap: 24px;
    position: relative;
    padding-top: 24px;
    margin-top: 0;
}

.tree-org-children::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 24px;
    background-color: #cbd5e1;
}

.tree-org-node-child {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tree-org-node-child::before {
    content: '';
    position: absolute;
    top: -24px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #cbd5e1;
}

.tree-org-node-child:first-child::before {
    left: 50%;
    width: 50%;
}

.tree-org-node-child:last-child::before {
    width: 50%;
}

.tree-org-node-child:only-child::before {
    display: none;
}

.tree-org-node-child::after {
    content: '';
    position: absolute;
    top: -24px;
    left: 50%;
    width: 2px;
    height: 24px;
    background-color: #cbd5e1;
}

.tree-nav-btn {
    position: absolute;
    top: 60%;
    transform: translateY(-50%);
    z-index: 10;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #004a87;
    cursor: pointer;
    transition: background 0.2s;
}

.tree-nav-btn:hover {
    background: #f8fafc;
    color: #0d6efd;
}

.tree-nav-btn.prev { left: 5px; }
.tree-nav-btn.next { right: 5px; }

/* === WIDGET FLOTANTE DE TELE-ASISTENCIA Y CHAT 1 A 1 === */
/* Z-Index 1080 para superar modales (1055) y modalDetalleMiTicket (1065) */
.soporte-chat-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #0d6efd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 1080 !important;
    transition: transform 0.2s ease, background-color 0.2s ease;
    font-size: 26px;
}

.soporte-chat-bubble:hover {
    transform: scale(1.08);
    background-color: #0b5ed7;
}

.soporte-chat-window {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 360px;
    max-height: 480px;
    height: 480px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    z-index: 1080 !important;
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.soporte-chat-header {
    background-color: #004a87;
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 0.95rem;
}

.soporte-chat-messages {
    flex-grow: 1;
    padding: 12px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
}

.msg-item {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 10px;
    word-break: break-word;
}

.msg-propio {
    align-self: flex-end;
    background-color: #0d6efd;
    color: white;
    border-bottom-right-radius: 2px;
}

.msg-remoto {
    align-self: flex-start;
    background-color: #e9ecef;
    color: #212529;
    border-bottom-left-radius: 2px;
}

.msg-meta {
    font-size: 0.72rem;
    opacity: 0.75;
    margin-top: 3px;
    display: block;
}

.soporte-chat-footer {
    padding: 10px;
    background: white;
    border-top: 1px solid #e9ecef;
}

/* === ESTILOS PARA LA LANDING PAGE B2G (index.html) === */
.landing-hero {
    background: linear-gradient(135deg, #002244 0%, #004a87 60%, #0066b2 100%);
    color: white;
    padding: 90px 0 70px 0;
    position: relative;
    overflow: hidden;
}

.landing-hero::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 50px;
    margin-bottom: 20px;
}

.feature-box {
    background: white;
    border-radius: 14px;
    padding: 28px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: all 0.25s ease-in-out;
    height: 100%;
}

.feature-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 74, 135, 0.12);
    border-color: #93c5fd;
}

.feature-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 18px;
}

.law-pill-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.pricing-card-b2g {
    background: white;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    padding: 32px 24px;
    transition: all 0.25s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pricing-card-b2g.featured {
    border-color: var(--primary-color);
    box-shadow: 0 12px 30px rgba(0, 74, 135, 0.15);
    position: relative;
}

.pricing-card-b2g.featured::before {
    content: 'Recomendado Sector Público';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: #004a87;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.contract-cta-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    border-radius: 20px;
    padding: 45px;
}

.landing-footer {
    background-color: #0b1329;
    color: #94a3b8;
    padding: 60px 0 30px 0;
    border-top: 4px solid #cc0000;
}

.landing-footer a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s;
}

.landing-footer a:hover {
    color: white;
}

/* =========================================================
   SISTEMA DE DISEÑO RESPONSIVO UNIFICADO PARA SMARTPHONES & TABLETS
   (Mobile-First / Adaptive Responsive CSS)
   ========================================================= */

/* 1. Barra de Herramientas Táctil Deslizable (Quick Actions) */
.quick-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

@media (max-width: 768px) {
    .quick-actions-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .quick-actions-bar > * {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* 2. Select2 y Controles de Formulario Táctiles en Móviles */
@media (max-width: 768px) {
    /* Prevenir zoom involuntario en iPhone / Safari en inputs */
    input.form-control, 
    select.form-select, 
    textarea.form-control,
    .select2-container--default .select2-selection--single {
        font-size: 16px !important;
    }

    .select2-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .select2-container .select2-selection--single {
        height: 42px !important;
        display: flex !important;
        align-items: center !important;
        padding: 6px 10px !important;
    }

    .select2-selection__arrow {
        top: 8px !important;
    }

    /* Espaciado de Tarjetas y Contenedores */
    .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .card {
        border-radius: 12px !important;
        margin-bottom: 12px;
    }

    .card-header {
        padding: 12px 14px !important;
    }

    .card-body {
        padding: 14px !important;
    }

    /* Botones de acción táctiles cómodos (mínimo 40px) */
    .btn {
        min-height: 38px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .btn-sm {
        min-height: 34px;
        padding: 6px 12px;
    }

    /* Navbar institucional compacta en móvil */
    .navbar {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .navbar-brand {
        font-size: 1.05rem !important;
    }

    .navbar .d-flex.align-items-center.gap-2 {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    /* Modales Fullscreen y desplazables en Smartphones */
    .modal-dialog {
        margin: 8px auto;
        max-width: calc(100% - 16px);
    }

    .modal-fullscreen-sm-down {
        margin: 0 !important;
        max-width: 100% !important;
        height: 100% !important;
    }

    .modal-fullscreen-sm-down .modal-content {
        height: 100% !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
    }

    .modal-fullscreen-sm-down .modal-body {
        overflow-y: auto !important;
        flex: 1 1 auto;
    }

    /* Ajustes para la cuadrícula plurianual (Subtítulo 31) */
    #contenedorAniosFuturos .col-3,
    #contenedorAniosFuturos .col-4 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        margin-bottom: 6px;
    }

    /* Tablas responsivas con desplazamiento suave */
    .table-responsive {
        border-radius: 8px;
        -webkit-overflow-scrolling: touch;
    }

    /* Bandeja de CDPs y tarjetas en lista */
    .cdp-card {
        padding: 10px !important;
        margin-bottom: 8px !important;
    }

    .cdp-card .fs-6 {
        font-size: 0.95rem !important;
    }
}

@media (max-width: 576px) {
    #contenedorAniosFuturos .col-3,
    #contenedorAniosFuturos .col-4,
    #contenedorAniosFuturos .col-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Modal login centrado y sin desbordes */
    .login-box {
        padding: 24px 16px !important;
        margin: 10px;
    }
}