/* ============================================================
   SCEMEX Soft UI Design System
   Sidebar izquierda + Header blanco (estilo dashboard moderno)
============================================================ */

:root {
    --sidebar-width: 72px;
    --sidebar-bg: #E8ECF4;
    --sidebar-active-bg: rgba(255, 255, 255, 0.7);
    --scemex-bg: #F9FAFB;
    --scemex-card-bg: #FFFFFF;
    --scemex-blue: #5C67F2;
    --scemex-green: #059669;
    --scemex-red: #DC2626;
    --scemex-amber: #D97706;
    --scemex-text-main: #333C4E;
    --scemex-border: #DCE1E9;
    --radius-standard: 18px;
    --pastel-icon-bg: rgba(92, 103, 242, 0.1);
    --pastel-amber-bg: rgba(217, 119, 6, 0.12);
    --pastel-green-bg: rgba(5, 150, 105, 0.12);
    --pastel-cyan-bg: rgba(8, 145, 178, 0.12);
}

body {
    background-color: var(--scemex-bg) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    color: var(--scemex-text-main) !important;
}

/* --- Layout Sidebar --- */
body.layout-sidebar {
    display: flex;
    min-height: 100vh;
    margin: 0;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 0.75rem;
    text-decoration: none;
    color: var(--scemex-blue);
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.35rem;
}

.sidebar-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-logo-fallback {
    width: 36px;
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--scemex-blue);
}

.sidebar-brand-text {
    font-size: 0.7rem;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0;
    gap: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 12px;
    color: var(--scemex-blue);
    text-decoration: none;
    font-size: 1.25rem;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: var(--sidebar-active-bg);
    color: var(--scemex-blue);
}

.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--scemex-blue);
}

.sidebar-spacer {
    flex: 1;
    min-height: 1rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1035;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (max-width: 991.98px) {
    .main-wrapper {
        margin-left: 0;
    }
}

.top-header {
    background: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px;
    margin: 1rem 1.5rem 1rem 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    color: var(--scemex-text-main) !important;
    text-decoration: none !important;
    padding: 0.25rem;
}

.top-header-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--scemex-text-main);
}

.top-header-subtitle {
    font-size: 0.8rem;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-header-user {
    font-size: 0.9rem;
    color: #666;
}

.main-content {
    flex: 1;
    padding: 0 1.5rem 1.5rem;
}

.main-footer {
    text-align: center;
    padding: 1rem;
    color: #888;
    font-size: 0.8rem;
}

/* --- Cards base (compatibilidad) --- */
.card {
    background: var(--scemex-card-bg) !important;
    border: 1px solid var(--scemex-border) !important;
    border-radius: var(--radius-standard) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06) !important;
}

.card-header {
    background: var(--scemex-card-bg) !important;
    border-bottom: 1px solid var(--scemex-border) !important;
    border-radius: var(--radius-standard) var(--radius-standard) 0 0 !important;
    color: var(--scemex-text-main) !important;
}

/* --- Card SCEMEX Soft UI (sin bordes, sombra suave) --- */
.card-scemex {
    background: var(--scemex-card-bg);
    border: none;
    border-radius: var(--radius-standard);
    box-shadow: 0 10px 15px -3px rgba(149, 157, 165, 0.2), 0 4px 6px -2px rgba(149, 157, 165, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.2s;
}

.card-scemex:hover {
    transform: translateY(-3px);
}

.card-scemex .card-body {
    padding: 0;
}

/* Título de sección con icono pastel circular */
.card-scemex .card-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--scemex-text-main);
    margin-bottom: 1.5rem;
}

.card-scemex .card-title .icon-pastel {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
}

.card-scemex .card-title .icon-pastel i {
    font-size: 1.25rem;
}

.icon-pastel-blue { background: var(--pastel-icon-bg); color: var(--scemex-blue); }
.icon-pastel-amber { background: var(--pastel-amber-bg); color: var(--scemex-amber); }
.icon-pastel-green { background: var(--pastel-green-bg); color: var(--scemex-green); }
.icon-pastel-cyan { background: var(--pastel-cyan-bg); color: #0891B2; }

/* --- Inputs limpios --- */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #555;
}

.form-control {
    border: 1px solid var(--scemex-border);
    border-radius: 10px;
    padding: 0.75rem;
    background-color: #fefefe;
}

.form-control:focus {
    border-color: var(--scemex-blue);
    box-shadow: 0 0 0 0.2rem rgba(92, 103, 242, 0.15);
}

.input-group-text {
    border: 1px solid var(--scemex-border);
    border-radius: 10px;
    background-color: #f8f9fa;
}

/* --- Sticky Action Bar --- */
.sticky-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--scemex-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    z-index: 1030;
    box-shadow: 0 -5px 10px rgba(0, 0, 0, 0.03);
}

/* Botón Primary Soft UI */
.btn-scemex-primary {
    background-color: var(--scemex-blue);
    border-radius: 12px;
    padding: 0.75rem 2rem;
    color: white !important;
    font-weight: 600;
    border: none;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(92, 103, 242, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-scemex-primary:hover {
    box-shadow: 0 6px 8px rgba(92, 103, 242, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    color: white !important;
}

/* Barra de acciones inline (formulario viaje): no fija, fluye con el contenido.
   Evita solaparse con el primer bloque: el .sticky-actions base (TMS) lleva z-index alto
   y padding de barra fija; style.css añade margin negativo — hay que resetear todo eso. */
.sticky-actions-inline {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    box-shadow: none !important;
    background: transparent !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: auto !important;
    margin: 0 0 1.25rem 0 !important;
    padding: 0.5rem 0 1rem 0 !important;
    border-top: none !important;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

/* Solo cuando hay barra sticky fija abajo (sin -inline) */
main:has(.sticky-actions:not(.sticky-actions-inline)) { padding-bottom: 80px; }

/* --- Navbar --- */
.navbar-sce {
    background: linear-gradient(135deg, #1E40AF 0%, #2563EB 100%) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    border-radius: 0 0 var(--radius-standard) var(--radius-standard);
}

.navbar-sce .nav-link { color: rgba(255, 255, 255, 0.9) !important; }
.navbar-sce .nav-link:hover { color: #fff !important; }
.navbar-sce .dropdown-item .text-primary { color: var(--scemex-blue) !important; }
.navbar-sce .dropdown-item .text-success { color: var(--scemex-green) !important; }
.navbar-sce .dropdown-item .text-info { color: #0EA5E9 !important; }
.navbar-sce .dropdown-item .text-warning { color: var(--scemex-amber) !important; }

/* --- Botones --- */
.btn-primary { background-color: var(--scemex-blue) !important; border-color: var(--scemex-blue) !important; border-radius: 10px !important; }
.btn-success { background-color: var(--scemex-green) !important; border-color: var(--scemex-green) !important; border-radius: 10px !important; }
.btn-danger { background-color: var(--scemex-red) !important; border-color: var(--scemex-red) !important; border-radius: 10px !important; }
