/* Ruta Interna - Estilos personalizados */

:root {
    --ri-verde: #28a745;
    --ri-azul: #007bff;
    --ri-verde-claro: #d4edda;
    --ri-azul-claro: #cce5ff;
}

body {
    background-color: #f5f7fa;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--ri-azul) 0%, #0056b3 100%) !important;
}
.navbar-brand {
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

/* Cards con sombra suave */
.card {
    border-radius: 12px;
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
}

/* Botones redondeados */
.btn {
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.btn:hover {
    transform: translateY(-1px);
}
.btn-success {
    background-color: var(--ri-verde);
    border-color: var(--ri-verde);
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Selects estilizados */
.form-select-lg {
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    border-radius: 10px;
    border: 2px solid #dee2e6;
}
.form-select-lg:focus {
    border-color: var(--ri-azul);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
}

/* Número de paso en resultados */
.paso-numero {
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Formulario de búsqueda */
.form-check-input:checked {
    background-color: var(--ri-verde);
    border-color: var(--ri-verde);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%) !important;
}

/* Dashboard métricas */
.display-6 {
    font-size: 2rem;
}

/* Tabla del CRUD */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* Animación suave de entrada */
.card {
    animation: fadeInUp 0.3s ease-out;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Sidebar Admin ─────────────────────── */
.admin-wrapper {
    min-height: calc(100vh - 120px);
}
.admin-sidebar {
    width: 240px;
    min-height: calc(100vh - 56px);
    background: #1a1a2e;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-header {
    padding: 1.25rem 1rem;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.3px;
}
.sidebar-section-title {
    padding: 1rem 1rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}
.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-nav li a {
    display: block;
    padding: 0.6rem 1rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}
.sidebar-nav li a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-left-color: rgba(0,123,255,0.4);
}
.sidebar-nav li a.active {
    background: rgba(0,123,255,0.15);
    color: #fff;
    border-left-color: var(--ri-azul);
    font-weight: 600;
}
.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.5rem 0;
}
.sidebar-footer a {
    display: block;
    padding: 0.6rem 1rem;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.15s;
}
.sidebar-footer a:hover {
    color: #fff;
}
.sidebar-group {
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-group-toggle,
.sidebar-group-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.55);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-align: left;
}
.sidebar-group-toggle:hover,
.sidebar-group-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}
.sidebar-group-toggle.active,
.sidebar-group-link.active {
    color: #fff;
}
.sidebar-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.15s ease;
}
.sidebar-group-toggle[aria-expanded="false"] .sidebar-chevron {
    transform: rotate(-90deg);
}
.sidebar-nav-nested li a {
    padding-left: 1.75rem;
    font-size: 0.88rem;
}
.nav-tabs-admin .nav-link {
    color: #495057;
    font-weight: 500;
}
.nav-tabs-admin .nav-link.active {
    font-weight: 600;
}
.admin-content {
    min-width: 0;
    background: #f5f7fa;
}

/* Autocompletado destino */
#destino-lista .list-group-item {
    cursor: pointer;
    font-size: 0.95rem;
    border-left: 0;
    border-right: 0;
}
#origen-lista .list-group-item {
    cursor: pointer;
    font-size: 0.95rem;
    border-left: 0;
    border-right: 0;
}
#destino-lista .list-group-item:hover,
#destino-lista .list-group-item:focus,
#origen-lista .list-group-item:hover,
#origen-lista .list-group-item:focus {
    background-color: var(--ri-azul-claro);
}
#destino-buscar:not(:disabled) {
    border-color: var(--ri-azul);
}
#origen-buscar:not(:disabled) {
    border-color: var(--ri-azul);
}

/* Grafo admin */
.grafo-wrap {
    position: relative;
}
.grafo-btn-agregar-lugar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}
#grafo-network {
    width: 100%;
    height: min(65vh, 560px);
    min-height: 320px;
    border-radius: 8px;
    background: #fafbfc;
    border: 1px solid #e9ecef;
}
.grafo-leyenda {
    display: inline-block;
    width: 24px;
    height: 4px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 4px;
}
.grafo-leyenda-activa { background: #28a745; }
.grafo-leyenda-accesible { background: #0d6efd; }
.grafo-leyenda-inactiva { background: #adb5bd; }

/* Asistente / Prompt (página pública) */
.prompt-bar {
    background: linear-gradient(135deg, #fff 0%, var(--ri-azul-claro) 100%);
    border-left: 4px solid var(--ri-azul) !important;
}
.prompt-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 5rem;
    z-index: 1040;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    padding: 0;
}
.prompt-offcanvas {
    width: min(420px, 92vw);
}
.prompt-offcanvas .offcanvas-body textarea {
    min-height: 180px;
    resize: vertical;
    border-radius: 10px;
}

/* Página pública */
.ri-publico {
    max-width: 100%;
    overflow-x: hidden;
}

.ri-publico .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Responsive */
@media (max-width: 768px) {
    .display-5 {
        font-size: 1.8rem;
    }
    .display-6 {
        font-size: 1.5rem;
    }
    .prompt-fab {
        right: 1rem;
        bottom: 4.5rem;
    }

    /* Modo de interfaz: botones apilados en móvil */
    .ri-publico .btn-group.w-100 {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .ri-publico .btn-group.w-100 > .btn {
        border-radius: 50px !important;
        width: 100%;
        margin: 0 !important;
    }

    .ri-publico .wizard-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ri-publico .wizard-topbar #btn-wizard-nueva {
        align-self: stretch;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .ri-publico .card-body {
        padding: 1rem !important;
    }
}
