/* CSS variables and Core Design System */
:root {
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Montserrat', sans-serif;

    /* Theme colors (Official brand manual colors) */
    --color-primary: #2e2f33;       /* Brand Charcoal */
    --color-primary-light: #44454a; /* Brand Charcoal lighter variant */
    --color-secondary: #5887da;     /* Brand Blue */
    --color-accent: #f8b400;        /* Gold (retained for dashboard/active warning accents) */
    --color-accent-rgb: 248, 180, 0;
    --color-cyan: #5887da;          /* Map cyan classes to Brand Blue for consistency */
    --color-cyan-rgb: 88, 135, 218;
    --color-success: #10b981;
    --color-danger: #ef4444;
    --color-warning: #f59e0b;

    /* Neutrals */
    --color-bg-dark: #f8fafc;
    --color-bg-card: #ffffff;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-text-white: #f8fafc;
    --color-text-muted: #64748b;
    --color-text-dark: #0f172a;

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-background: rgba(255, 255, 255, 0.03);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-blur: blur(12px);
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(88, 135, 218, 0.2);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

html, body {
    font-family: var(--font-body);
    background-color: var(--color-bg-dark);
    color: #334155;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.02em;
}
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--color-cyan) 0%, #3a60a3 100%);
    color: var(--color-text-white);
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px -3px rgba(88, 135, 218, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(6, 182, 212, 0.6), var(--shadow-glow);
    color: var(--color-text-white);
    filter: brightness(1.1);
}

.btn-premium:active {
    transform: translateY(0);
}

.btn-outline-premium {
    background: transparent;
    color: var(--color-cyan);
    border: 1px solid rgba(6, 182, 212, 0.4);
    padding: 9px 23px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-outline-premium:hover {
    background: rgba(6, 182, 212, 0.08);
    border-color: var(--color-cyan);
    color: #3b82f6;
    transform: translateY(-2px);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--color-bg-card);
    border: var(--color-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 16px;
    padding: 30px;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
    opacity: 0;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    transform: translateY(-6px);
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6), 0 0 30px rgba(6, 182, 212, 0.1);
}

.glass-card:hover::before {
    opacity: 1;
}

/* Gradients and Glowing Backgrounds */
.glowing-bg {
    position: relative;
    background: radial-gradient(circle at 50% 30%, #2e2f33 0%, #151618 100%) !important;
}

.glowing-bg::after {
    content: '';
    position: absolute;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(88, 135, 218, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    z-index: -1;
    pointer-events: none;
}

.glowing-bg-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(248, 180, 0, 0.08) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
    z-index: -1;
    pointer-events: none;
}

.text-gradient-cyan {
    background: linear-gradient(135deg, var(--color-cyan) 0%, #4f79c2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-gradient-gold {
    background: linear-gradient(135deg, var(--color-accent) 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navigation Menu */
.navbar-custom {
    background: rgba(46, 47, 51, 0.95) !important;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    transition: var(--transition-smooth);
    padding: 15px 0;
    z-index: 1050;
}

.navbar-custom .navbar-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-text-white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-custom .nav-link {
    font-family: var(--font-heading);
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px !important;
    transition: var(--transition-smooth);
    position: relative;
}

.navbar-custom .nav-link:hover, 
.navbar-custom .nav-link.active {
    color: var(--color-cyan);
}

.navbar-custom .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 16px;
    background-color: var(--color-cyan);
    transition: var(--transition-smooth);
}

.navbar-custom .nav-link:hover::after,
.navbar-custom .nav-link.active::after {
    width: calc(100% - 32px);
}

/* Footer Styles */
.footer-custom {
    background-color: #1a1b1d !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 80px 0 30px 0;
    margin-top: 100px;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.footer-custom h5 {
    color: var(--color-text-white);
    margin-bottom: 25px;
    font-size: 1.1rem;
    font-weight: 600;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-links a:hover {
    color: var(--color-cyan);
    transform: translateX(3px);
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-icons a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    border: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-white);
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.social-icons a:hover {
    background: var(--color-cyan);
    color: #050b18;
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--color-primary-light);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-cyan);
}

/* Layout Page overrides for Blazor Default Layout */
.sidebar {
    display: none;
}
.page {
    flex-direction: column !important;
}
main {
    width: 100%;
}
.top-row {
    display: none !important;
}
.content {
    padding-top: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Custom CSS classes for sections */
.section-padding {
    padding: 100px 0;
}

.badge-premium {
    background: rgba(6, 182, 212, 0.1);
    color: var(--color-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 20px;
}

.badge-gold {
    background: rgba(248, 180, 0, 0.1);
    color: var(--color-accent);
    border: 1px solid rgba(248, 180, 0, 0.2);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 20px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

/* Intranet/Dashboard styles */
.intranet-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f3f4f6; /* Light grey background for content */
}

.intranet-sidebar {
    width: 290px; /* Wider default width to display full text labels */
    background-color: #2e2f33; /* Solid brand charcoal */
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    flex-shrink: 0; /* Prevent the sidebar from shrinking */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto; /* Enable scrollbar if sidebar content overflows */
    overflow-x: hidden;
}

/* Collapsed sidebar classes */
.intranet-sidebar.intranet-sidebar-collapsed {
    width: 80px !important;
}

.intranet-sidebar .logo-collapsed {
    display: none !important;
}
.intranet-sidebar .logo-expanded {
    display: flex !important;
}

.intranet-sidebar.intranet-sidebar-collapsed .logo-expanded {
    display: none !important;
}
.intranet-sidebar.intranet-sidebar-collapsed .logo-collapsed {
    display: flex !important;
}

.intranet-sidebar-collapsed .hide-collapsed {
    display: none !important;
}

.intranet-sidebar-collapsed .intranet-nav-link {
    justify-content: center;
    padding: 12px;
}

.intranet-sidebar-collapsed .intranet-nav-link i {
    margin: 0 !important;
    font-size: 1.25rem !important;
}

.intranet-sidebar-collapsed .intranet-nav {
    padding: 15px 10px;
}

/* Sidebar scrollbar styling */
.intranet-sidebar::-webkit-scrollbar {
    width: 6px;
}
.intranet-sidebar::-webkit-scrollbar-track {
    background: #2e2f33;
}
.intranet-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.intranet-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background-color: #f3f4f6;
}

.intranet-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 20px;
    flex: 1;
}

.intranet-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #94a3b8; /* Slate grey for readability on dark background */
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.intranet-nav-link:hover,
.intranet-nav-link.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-cyan);
}

.intranet-header {
    height: 70px;
    border-bottom: 1px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    background-color: #ffffff; /* Solid white header background */
    color: #2e2f33;
}

.intranet-header h5,
.intranet-header .text-white,
.intranet-header span {
    color: #2e2f33 !important;
}

/* Force light card backgrounds and dark text inside the intranet content */
.intranet-content h1,
.intranet-content h2,
.intranet-content h3,
.intranet-content h4,
.intranet-content h5,
.intranet-content h6,
.intranet-content .text-white,
.intranet-content .text-white-50 {
    color: #2e2f33 !important;
}

.intranet-content p,
.intranet-content span:not(.badge):not(.btn-premium):not(.text-gradient-cyan):not(.text-gradient-gold),
.intranet-content td,
.intranet-content th,
.intranet-content label {
    color: #4b5563 !important; /* Dark grey for secondary text */
}

.intranet-content .glass-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02) !important;
}

.intranet-content .glass-card:hover {
    border-color: var(--color-cyan) !important;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.05) !important;
}

/* Table overrides inside the intranet content */
.intranet-content table {
    color: #2e2f33 !important;
}
.intranet-content thead tr {
    border-bottom: 2px solid #e2e8f0 !important;
}
.intranet-content tr {
    border-bottom: 1px solid #e2e8f0 !important;
}
.intranet-content td {
    background-color: transparent !important;
}
.intranet-content .table-dark {
    --bs-table-bg: transparent !important;
    --bs-table-color: #2e2f33 !important;
}

/* Form controls overrides inside intranet content */
.intranet-content input,
.intranet-content select,
.intranet-content textarea {
    background-color: #ffffff !important;
    color: #2e2f33 !important;
    border: 1px solid #cbd5e1 !important;
}

.intranet-content input:focus,
.intranet-content select:focus,
.intranet-content textarea:focus {
    border-color: var(--color-cyan) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 135, 218, 0.15) !important;
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1030;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

@media (max-width: 991.98px) {
    .intranet-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1040;
        width: 290px !important;
        transform: translateX(-100%);
    }
    
    .intranet-sidebar.intranet-sidebar-mobile-open {
        transform: translateX(0) !important;
    }
    
    .intranet-content {
        padding: 20px 15px !important;
    }
    
    .intranet-header {
        padding: 0 20px !important;
    }
}

/* ==========================================================================
   ECU LIGHT CORPORATE THEME OVERRIDES
   ========================================================================== */

/* 1. Header Navigation and Logo Colors */
.navbar-custom .navbar-brand,
.navbar-custom .nav-link {
    color: #ffffff !important;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--color-cyan) !important;
}

/* 2. Overriding Dark Backgrounds for Body Sections */
section[style*="background-color: #030712"],
section[style*="background-color: #050b18"],
section[style*="background-color: #030712;"],
section[style*="background-color: #050b18;"] {
    background-color: #ffffff !important;
    color: #334155 !important;
}

section[style*="background-color: #050b18"],
section[style*="background-color: #050b18;"] {
    background-color: #f1f5f9 !important; /* Soft gray contrast background */
}

/* 3. Text and Headings Overrides inside light sections */
section[style*="background-color: #030712"] h1,
section[style*="background-color: #030712"] h2,
section[style*="background-color: #030712"] h3,
section[style*="background-color: #030712"] h4,
section[style*="background-color: #030712"] h5,
section[style*="background-color: #030712"] h6,
section[style*="background-color: #050b18"] h1,
section[style*="background-color: #050b18"] h2,
section[style*="background-color: #050b18"] h3,
section[style*="background-color: #050b18"] h4,
section[style*="background-color: #050b18"] h5,
section[style*="background-color: #050b18"] h6 {
    color: #0f172a !important;
}

section[style*="background-color: #030712"] p,
section[style*="background-color: #030712"] li,
section[style*="background-color: #030712"] span:not(.badge-premium):not(.badge-gold),
section[style*="background-color: #050b18"] p,
section[style*="background-color: #050b18"] li,
section[style*="background-color: #050b18"] span:not(.badge-premium):not(.badge-gold) {
    color: #475569 !important;
}

section[style*="background-color: #030712"] .text-white,
section[style*="background-color: #050b18"] .text-white {
    color: #0f172a !important;
}

section[style*="background-color: #030712"] .text-muted,
section[style*="background-color: #050b18"] .text-muted {
    color: #64748b !important;
}

/* 4. Headings & Text inside Deep Navy blue glowing-bg headers */
.glowing-bg h1,
.glowing-bg h2,
.glowing-bg h3,
.glowing-bg h4,
.glowing-bg h5,
.glowing-bg h6,
.glowing-bg .text-white {
    color: #ffffff !important;
}

.glowing-bg p,
.glowing-bg .text-muted {
    color: #cbd5e1 !important;
}

/* 5. Clean Institutional Cards on Light Backgrounds */
section[style*="background-color: #030712"] .glass-card,
section[style*="background-color: #050b18"] .glass-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02) !important;
}

section[style*="background-color: #030712"] .glass-card:hover,
section[style*="background-color: #050b18"] .glass-card:hover {
    border-color: var(--color-cyan) !important;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03) !important;
}

/* 6. Form input fields controls on Light Background */
section[style*="background-color: #030712"] input,
section[style*="background-color: #030712"] select,
section[style*="background-color: #030712"] textarea,
section[style*="background-color: #050b18"] input,
section[style*="background-color: #050b18"] select,
section[style*="background-color: #050b18"] textarea {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

section[style*="background-color: #030712"] input:focus,
section[style*="background-color: #030712"] select:focus,
section[style*="background-color: #030712"] textarea:focus,
section[style*="background-color: #050b18"] input:focus,
section[style*="background-color: #050b18"] select:focus,
section[style*="background-color: #050b18"] textarea:focus {
    border-color: var(--color-cyan) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15) !important;
}

section[style*="background-color: #030712"] input::placeholder,
section[style*="background-color: #030712"] textarea::placeholder,
section[style*="background-color: #050b18"] input::placeholder,
section[style*="background-color: #050b18"] textarea::placeholder {
    color: #94a3b8 !important;
}

/* 7. Sgc Document Box container */
section[style*="background-color: #030712"] .border-secondary,
section[style*="background-color: #050b18"] .border-secondary {
    border-color: #e2e8f0 !important;
}

section[style*="background-color: #030712"] div[style*="background: rgba(255,255,255,0.02)"],
section[style*="background-color: #050b18"] div[style*="background: rgba(255,255,255,0.02)"],
section[style*="background-color: #030712"] div[style*="background: rgba(255,255,255,0.02);"],
section[style*="background-color: #050b18"] div[style*="background: rgba(255,255,255,0.02);"] {
    background-color: #f8fafc !important;
}

/* WhatsApp Floating Widget */
.whatsapp-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1050;
    font-family: var(--font-body);
}

.whatsapp-bubble-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #25d366;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    transition: var(--transition-smooth);
    position: relative;
}

.whatsapp-bubble-btn:hover {
    transform: scale(1.1);
    background-color: #128c7e;
    box-shadow: 0 6px 20px rgba(18, 140, 126, 0.6);
}

.whatsapp-chat-box {
    width: 320px;
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    position: absolute;
    bottom: 75px;
    right: 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.whatsapp-chat-header {
    background-color: #075e54;
    padding: 15px;
    color: white;
}

.whatsapp-chat-footer {
    border-top: 1px solid #eaeaea;
}

.whatsapp-badge-ping {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.animate-pulse {
    animation: pulse 2s infinite ease-in-out;
}

/* Accessibility contrast overrides for dark backgrounds */
.login-container label.form-label,
.login-container label.form-check-label {
    color: #e2e8f0 !important; /* Brighter grey/white for form labels */
    font-weight: 600;
}

.login-container .text-muted {
    color: #94a3b8 !important; /* Lighter grey for description text */
}

/* Intranet Sidebar readability improvements */
.intranet-nav small.text-muted {
    color: #cbd5e1 !important; /* Make "GENERAL", "ADMINISTRACIÓN", etc. headers bright grey */
    opacity: 0.95;
}

.intranet-nav-link {
    color: #cbd5e1 !important; /* Make nav links stand out on dark grey background */
}

.intranet-nav-link:hover,
.intranet-nav-link.active {
    color: var(--color-cyan) !important; /* Cyan hover / active states */
    background-color: rgba(255, 255, 255, 0.08) !important;
}

/* Collapsed brand header styles to keep chevron button visible */
.intranet-sidebar-collapsed .brand-header-container {
    padding: 10px !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 95px;
    gap: 8px;
    justify-content: center !important;
    align-items: center !important;
}

.intranet-sidebar-collapsed .brand-header-container .logo-collapsed {
    display: flex !important;
    margin: 0 auto !important;
}

.intranet-sidebar-collapsed #sidebar-toggle-btn {
    margin: 0 !important;
    padding: 4px !important;
    display: block !important;
}