:root {
    /* Sosecorp Brand Palette */
    --primary: #e31e24; /* Rojo Sosecorp */
    --primary-light: #ff4d4d;
    --primary-dark: #b31419;
    --accent: #2d2e2e; /* Gris Corporativo Logo */
    --sidebar-bg: #1a1a1a; /* Oscuro neutro */
    --sidebar-hover: #2d2e2e;
    --content-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #2d2e2e;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    /* Premium Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --sidebar-width: 280px;
    --border-radius: 12px;
    
    /* Modern Palette Enhancements */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background-color: var(--content-bg);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#content {
    flex: 1;
    min-width: 0; /* Evita que el contenido rompa el layout flex */
    min-height: 100vh;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width); /* Espacio para el sidebar fijo */
}

/* Navbar / Topbar Premium */
.navbar {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

/* Sidebar Styling */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #f8fafc;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    box-shadow: 10px 0 30px rgba(0,0,0,0.05);
    height: 100vh;
    position: fixed; /* Cambiado a fixed para máxima estabilidad */
    top: 0;
    left: 0;
    overflow-y: auto;
}

#sidebar .logo-section {
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
}

#sidebar .logo-section h3 {
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 0;
    font-size: 1.5rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#sidebar .nav-list {
    padding: 1rem;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

#sidebar .nav-link i {
    font-size: 1.25rem;
    margin-right: 1rem;
    opacity: 0.7;
    transition: all 0.3s;
}

#sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
    transform: translateX(4px);
}

#sidebar .nav-link:hover i {
    opacity: 1;
    color: var(--primary-light);
}

#sidebar .nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#sidebar .nav-link.active i {
    opacity: 1;
}

/* Cards Premium */
.card {
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Tab Enhancements */
.nav-pills-premium {
    background: #f1f5f9;
    padding: 6px;
    border-radius: 18px;
    gap: 4px;
}

.nav-pills-premium .nav-link {
    border-radius: 14px !important;
    padding: 10px 20px !important;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.nav-pills-premium .nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.5);
    color: var(--primary);
}

.nav-pills-premium .nav-link.active {
    background: #fff !important;
    color: var(--primary) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.05);
}

.nav-pills-premium .nav-link i {
    font-size: 1.1rem;
}

/* Tables Premium */
.table {
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

.table tr {
    transition: all 0.2s;
}

.table tbody tr {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    border-radius: 12px;
}

.table tbody tr td {
    background: #fff;
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr td:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.table tbody tr td:last-child {
    border-right: 1px solid var(--border-color);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

.table tbody tr:hover td {
    background-color: #fcfdfe;
    border-color: var(--primary-light);
}

/* Badges Premium */
.badge {
    padding: 0.4em 0.8em;
    font-weight: 600;
    letter-spacing: -0.01em;
    border-radius: 6px;
    font-size: 0.7rem;
}

.bg-opacity-10 {
    background-color: rgba(var(--bs-primary-rgb), 0.1) !important;
}

/* Buttons Premium */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(79, 70, 229, 0.3);
}

/* Avatars */
.avatar-sm {
    box-shadow: var(--shadow-sm);
    border: 2px solid #fff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--content-bg);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: -100%;
        height: 100%;
    }
    #sidebar.active {
        left: 0;
    }
    #content {
        margin-left: 0 !important; /* Quitar margen en móviles */
    }
}

@media (max-width: 576px) {
    .content-wrapper {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }
    .container-fluid, .container {
        padding-left: 0.15rem !important;
        padding-right: 0.15rem !important;
    }
    .navbar {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    .glass-card {
        border-radius: 16px !important;
    }
    .mobile-bg-transparent {
        background-color: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
    .mobile-card {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
        border-radius: 16px !important;
    }
}

/* Sidebar Overlay for Mobile */
#sidebarOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#sidebarOverlay.active {
    display: block;
    opacity: 1;
}
