/* Estilos Sostenibles y Cálidos para Espacios PLUS */

:root {
    /* Paleta Cálida y Pastel */
    --primary-color: #e07a5f;
    /* Terracota suave */
    --primary-dark: #c45d41;
    /* Terracota más intenso */
    --primary-light: #f9e3de;
    /* Durazno pastel */

    --secondary-color: #81b29a;
    /* Verde salvia */
    --secondary-dark: #5e8c76;
    /* Verde bosque suave */
    --secondary-light: #e6f0eb;
    /* Menta pastel */

    --accent-color: #f2cc8f;
    /* Amarillo arena */

    --bg-color: #fdfbf7;
    /* Crema/Blanco hueso (Fondo principal) */
    --surface-color: #ffffff;
    /* Blanco puro (Tarjetas/Sidebar) */

    --text-color: #3d405b;
    /* Azul grisáceo oscuro (Texto principal) */
    --text-muted: #8d99ae;
    /* Gris azulado (Texto secundario) */

    --border-color: #eee4dc;
    /* Beige muy suave */

    --success-color: #81b29a;
    --warning-color: #f2cc8f;
    --danger-color: #e76f51;
    /* Rojo coral */
    --info-color: #3d405b;

    /* Dimensiones Sidebar */
    --sidebar-width: 250px;
    --header-height: 70px;

    /* Tipografía */
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --border-radius: 12px;
    /* Bordes más redondeados */
    --border-radius-sm: 8px;

    /* Sombras suaves */
    --shadow-sm: 0 2px 8px rgba(61, 64, 91, 0.05);
    --shadow-md: 0 4px 12px rgba(61, 64, 91, 0.08);

    /* Nuevos tokens para componentes modernos */
    --shadow-xs: 0 1px 2px rgba(61, 64, 91, 0.05);
    --shadow-lg: 0 10px 25px rgba(61, 64, 91, 0.1);
    --shadow-xl: 0 20px 40px rgba(61, 64, 91, 0.15);

    /* Transiciones */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-bounce: 400ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Blur effects */
    --blur-sm: 8px;
    --blur-md: 16px;
    --blur-lg: 24px;

    /* Z-index layers */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-notification: 1080;

    /* Sheets Style Nav Tokens */
    --nav-height: 48px;
    --nav-bg: #ffffff;
    --nav-hover-bg: #f1f3f4;
    --nav-active-color: var(--primary-color);
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    margin: 0;
}

/* --- AI Components --- */

/* --- Components Summary Panel --- */
.components-summary-card {
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.components-chart-container {
    position: relative;
    height: 200px;
}

.progress-stack {
    width: 100%;
    min-height: 50px;
}

.progress-stack .progress {
    margin-bottom: 2px;
    height: 12px;
}

.component-badge {
    font-size: 0.85rem;
    padding: 0.25em 0.5em;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.components-summary-card .card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.components-summary-card h5 {
    color: var(--primary-color);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.5rem;
}

.components-summary-card small {
    display: block;
    margin-bottom: 0.25rem;
}

.components-summary-card small i {
    color: var(--primary-color);
}

/* --- Enhanced Table Components --- */
.table-components {
    border-collapse: separate;
    border-spacing: 0;
}

.table-components td {
    vertical-align: middle;
}

.progress-component {
    height: 10px;
    margin-bottom: 2px;
    font-size: 0.75rem;
}

/* --- Responsive Components --- */
@media (max-width: 768px) {
    .components-summary-card .row>div {
        margin-bottom: 1.5rem;
    }
}

/* --- AI Components --- */
.ai-panel {
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}

.ai-panel .card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.ai-result-content {
    min-height: 200px;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 15px;
    border: 1px solid var(--border-color);
}

.ai-result-content h4 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 10px;
}

.ai-result-content ul {
    list-style-type: none;
    padding-left: 0;
}

.ai-result-content li {
    padding: 8px 0;
    position: relative;
    padding-left: 25px;
}

.ai-result-content li:before {
    content: "✓";
    color: var(--success-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.ai-action-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ai-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ai-action-btn i {
    transition: transform 0.3s ease;
}

.ai-action-btn:hover i {
    transform: scale(1.1);
}

.ai-status-badge {
    font-size: 0.9em;
}

/* --- Layout: Sidebar & Wrapper --- */

/* Layout: Sidebar & Wrapper - Unified Logic (Default Hidden) */

#wrapper {
    display: block;
    width: 100%;
    transition: all 0.3s ease;
}

#sidebar-wrapper {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--surface-color);
    color: var(--text-color);
    border-right: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    margin-left: calc(-1 * var(--sidebar-width));
    /* Default: Hidden */
}

#sidebar-wrapper .sidebar-heading {
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    height: 60px;
    /* Reduced fixed height */
    border-bottom: 1px solid var(--border-color);
}

#sidebar-wrapper .list-group {
    width: var(--sidebar-width);
    padding: 0.5rem;
    overflow-y: auto;
}

#sidebar-wrapper .list-group-item {
    border: none;
    padding: 0.5rem 0.8rem;
    /* Compact padding */
    margin-bottom: 0.2rem;
    /* Reduced margin */
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.95rem;
    /* Slightly smaller text */
    transition: all 0.2s;
    background: transparent;
}

#sidebar-wrapper .list-group-item:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    transform: translateX(5px);
}

#sidebar-wrapper .list-group-item.active {
    background-color: var(--primary-color);
    color: var(--surface-color);
}

#sidebar-wrapper .list-group-item i {
    width: 25px;
    text-align: center;
    margin-right: 10px;
}

/* --- Collapsible Sidebar Groups --- */

.sidebar-subtitle-header {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-top: 0.5rem;
}

.sidebar-subtitle-header:hover {
    color: var(--primary-color);
}

.sidebar-subtitle-header.no-collapse {
    cursor: default;
}

.sidebar-subtitle-header .chevron-icon {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.sidebar-subtitle-header[aria-expanded="true"] .chevron-icon {
    transform: rotate(90deg);
}

.sidebar-group .collapse .list-group-item {
    margin-left: 0.5rem;
    border-left: 2px solid transparent;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.sidebar-group .collapse .list-group-item.active {
    border-left-color: var(--surface-color);
}

.sidebar-nav {
    padding-bottom: 2rem;
}

/* Custom Scrollbar for Sidebar */
#sidebar-wrapper::-webkit-scrollbar {
    width: 4px;
}

#sidebar-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

#sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Top Navigation Bar (Sheets Style) --- */
.app-nav-container {
    height: var(--nav-height);
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-sticky);
}

.app-nav-brand {
    font-size: 1.1rem;
    color: var(--text-color);
    white-space: nowrap;
}

.btn-nav-sheets {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 2px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    transition: background 0.15s;
    height: 32px;
    line-height: 28px;
}

.btn-nav-sheets:hover {
    background-color: var(--nav-hover-bg);
}

.btn-nav-sheets:focus {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0;
    margin-top: 0 !important;
    /* Sheets style: menu flows from the bar */
}

.dropdown-item {
    padding: 0.4rem 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: var(--nav-hover-bg);
}

.dropdown-item i.w-20 {
    width: 20px;
}

/* User Profile */
.user-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.app-nav-user .nav-link {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.app-nav-user .nav-link:hover {
    background-color: var(--nav-hover-bg);
}

/* --- Layout Rescue (Force Vertical Stack) --- */
#wrapper {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: none !important;
    /* Disable transitions to prevent jumping during load */
}

/* Original Sidebar visibility - ALWAYS HIDDEN */
#sidebar-wrapper {
    display: none !important;
}

.app-nav-container {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    position: fixed !important;
    top: 0 !important;
}

#main-content {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;
    display: block !important;
    margin-top: var(--nav-height) !important;
    /* Critical to offset fixed nav */
}

/* Force responsive nav buttons to not wrap awkwardly */
@media (max-width: 768px) {
    /* REMOVED: Horizontal scroll menu logic in favor of hamburger menu */

    .navbar-collapse {
        margin-top: 0.5rem;
        border-top: 1px solid var(--border-color);
        max-height: 80vh;
        overflow-y: auto;
        padding-bottom: 1rem;
    }
}

/* Ensure no flex from Bootstrap spills into #wrapper directly */
#wrapper.d-flex,
.d-flex#wrapper {
    display: block !important;
}

/* Page Content - ADJUSTED FOR SIDEBAR BY DEFAULT */
#page-content-wrapper {
    width: 100%;
    margin-left: var(--sidebar-width);
    /* Adjusted for sidebar by default */
    transition: all 0.3s ease;
    min-height: 100vh;
}

/* Estado Toggled (HIDDEN SIDEBAR) */
#wrapper.toggled #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width));
    /* Hide Sidebar */
}

#wrapper.toggled #page-content-wrapper {
    margin-left: 0;
    /* Full width when sidebar hidden */
}

/* --- Sidebar Overlay (Mobile) --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 64, 91, 0.4);
    z-index: 900;
    /* Below sidebar (1000) but above content */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

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

/* --- Responsive Layout --- */
@media (max-width: 768px) {

    /* On mobile, content is always full width */
    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }

    /* Sidebar acts as drawer on mobile */
    #sidebar-wrapper {
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    /* Global Mobile Spacing Adjustments */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Reduce gutter size on mobile */
    .g-4,
    .gx-4,
    .gy-4 {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    /* Compact Typography */
    h1.h2 {
        font-size: 1.5rem;
    }

    /* Prevent horizontal scroll from negative margins */
    .row {
        margin-right: -0.5rem;
        margin-left: -0.5rem;
    }

    .col,
    [class*="col-"] {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
    }
}

/* --- Top Navigation --- */
.navbar-custom {
    height: var(--header-height);
    background-color: var(--surface-color);
    box-shadow: var(--shadow-sm);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#menu-toggle {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
}

#menu-toggle:hover {
    background-color: var(--primary-light);
}

/* --- Componentes --- */

/* Cards */
.card,
.dashboard-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background-color: var(--surface-color);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Botones */
.btn {
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1.2rem;
    font-weight: 500;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-primary-custom,
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary-custom:hover,
.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    border: none;
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    background: transparent;
    box-shadow: none;
}

.btn-outline-primary:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Tablas */
.table th {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 20px;
    font-weight: 500;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.bg-success {
    background-color: var(--secondary-color) !important;
}

/* Usamos verde salvia para success */
.bg-danger {
    background-color: var(--danger-color) !important;
}

/* Dashboard Specifics */
.stat-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.icon-primary {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.icon-secondary {
    background-color: var(--secondary-light);
    color: var(--secondary-color);
}

.icon-accent {
    background-color: #fef5e6;
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    /* Mobile: wrapper.toggled = Sidebar Hidden (Default for mobile via JS) */

    /* Cuando está TOGGLED (Oculto - Default en móvil): */
    #wrapper.toggled #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    #wrapper.toggled #page-content-wrapper {
        margin-left: 0;
    }

    /* Cuando NO está toggled (Abierto - Overlay visible): */
    /* REMOVED: Automatic overlay causing blur issues on mobile
    #wrapper:not(.toggled)::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    */

    /* El sidebar debe estar por encima del overlay */
    #sidebar-wrapper {
        z-index: 1000;
        display: none;
        /* Ensure safe default */
    }
}

/* --- Project Detail Refinement --- */
.border-end-md {
    border-right: 1px solid var(--border-color);
}

@media (max-width: 767.98px) {
    .border-end-md {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 1.5rem;
    }
}

.lca-card {
    transition: all 0.3s ease;
    min-width: 180px;
    display: flex;
    flex-direction: column;
}

.lca-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.lca-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lca-horizontal .lca-card {
    flex: 1 1 0;
    min-width: 0;
}

.lca-horizontal .lca-arrow {
    flex: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-color);
}

.lca-horizontal {
    width: 100%;
}

.lca-row {
    display: grid !important;
    width: 100%;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 0.75rem;
    align-items: stretch;
}

.lca-row .lca-arrow {
    display: none;
}

.lca-row .lca-card {
    margin: 0 !important;
}

.lca-row-flex {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: stretch;
}

.lca-row-flex .lca-card {
    flex: 0 0 calc(16.666% - 0.75rem);
    max-width: calc(16.666% - 0.75rem);
}

@media (max-width: 1399.98px) {
    .lca-row {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
    .lca-row-flex .lca-card {
        flex: 0 0 calc(33.333% - 0.75rem);
        max-width: calc(33.333% - 0.75rem);
    }
}

@media (max-width: 767.98px) {
    .lca-row {
        grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    }
    .lca-row-flex .lca-card {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

.lca-breakdown {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    flex: 1 1 auto;
    max-height: none;
    overflow: visible;
    padding-right: 4px;
}

.grid-summary-mini {
    background-color: var(--bg-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
}

.anchor-nav {
    position: fixed;
    top: 120px;
    right: 24px;
    width: 220px;
    z-index: 1030;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.anchor-nav.hidden {
    opacity: 0;
    transform: translateX(12px);
    pointer-events: none;
}

.anchor-nav-toggle {
    position: fixed;
    top: 120px;
    right: 24px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fff;
    align-items: center;
    justify-content: center;
    z-index: 1031;
    box-shadow: var(--shadow-sm);
}

.anchor-nav-links .list-group-item.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

@media (max-width: 1199.98px) {
    .anchor-nav {
        display: none;
    }
}

.project-status.activo,
.project-status.Active {
    background-color: var(--secondary-light);
    color: var(--secondary-dark);
}

.smaller {
    font-size: 0.75rem;
}

.italic {
    font-style: italic;
}

/* --- Info Strip --- */
.border-end:last-child {
    border-right: none !important;
}

.smaller-text {
    font-size: 0.8rem;
}

.project-status.small {
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
}

@media (max-width: 991.98px) {
    .border-end {
        border-right: none !important;
        border-bottom: 1px solid var(--border-color);
    }
}

/* --- LCA Configuration Modals --- */
/* Ensure modals are always visible and properly positioned */
.modal {
    z-index: 1055 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

/* Ensure modal dialogs are centered and visible */
.modal-dialog {
    margin: 1.75rem auto;
    max-width: 500px;
}

/* Fix for modals inside containers with overflow */
body.modal-open {
    overflow: hidden;
}

/* Ensure modal content is properly styled */
.modal-content {
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background-color: var(--primary-light);
    border-bottom: 2px solid var(--primary-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-title {
    color: var(--primary-dark);
    font-weight: 600;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-color);
}

/* Form styling inside modals */
.modal-body .form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.modal-body .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(224, 122, 95, 0.25);
}

.modal-body .text-muted {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   MODERN UI COMPONENTS - Phase 1
   ======================================== */

/* --- Loading States --- */

/* Modern Spinner */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-color) 25%,
            var(--border-color) 50%,
            var(--bg-color) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-lg {
    height: 1.5rem;
}

.skeleton-card {
    height: 200px;
    border-radius: var(--border-radius);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(253, 251, 247, 0.9);
    backdrop-filter: blur(var(--blur-sm));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* --- Enhanced Animations --- */

/* Fade animations */
.fade-in {
    animation: fadeIn var(--transition-base);
}

.fade-out {
    animation: fadeOut var(--transition-base);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* Slide animations */
.slide-in-up {
    animation: slideInUp var(--transition-base);
}

.slide-in-down {
    animation: slideInDown var(--transition-base);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Zoom animations */
.zoom-in {
    animation: zoomIn var(--transition-base);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Enhanced Interactive Effects --- */

/* Ripple effect for buttons */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::before {
    width: 300px;
    height: 300px;
}

/* Enhanced card hover */
.card-hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card-hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Glassmorphism effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(var(--blur-md));
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Pulse animation for notifications */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* --- Utility Classes --- */

/* Smooth transitions */
.transition-all {
    transition: all var(--transition-base);
}

.transition-fast {
    transition: all var(--transition-fast);
}

.transition-slow {
    transition: all var(--transition-slow);
}

/* Hover effects */
.hover-scale:hover {
    transform: scale(1.05);
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

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

/* Focus states */
.focus-ring:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Disabled state */
.disabled-opacity {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- DataTables Custom Styling --- */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.1);
}

table.dataTable thead th {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}

table.dataTable tbody tr:hover {
    background-color: var(--primary-light);
}

.dt-buttons {
    margin-bottom: 1rem;
}

.dt-button {
    background-color: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 0.5rem 1rem !important;
    margin-right: 0.5rem !important;
    transition: all var(--transition-fast) !important;
}

.dt-button:hover {
    background-color: var(--primary-light) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-dark) !important;
}

/* --- SweetAlert2 Custom Theme --- */
.swal2-popup {
    border-radius: var(--border-radius) !important;
    font-family: var(--font-family) !important;
}

.swal2-title {
    color: var(--text-color) !important;
}

.swal2-confirm {
    background-color: var(--primary-color) !important;
    border-radius: var(--border-radius-sm) !important;
}

.swal2-cancel {
    background-color: var(--text-muted) !important;
    border-radius: var(--border-radius-sm) !important;
}

/* --- Tippy.js Custom Theme --- */
.tippy-box[data-theme~='sustainability'] {
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
}

.tippy-box[data-theme~='sustainability'][data-placement^='top']>.tippy-arrow::before {
    border-top-color: var(--primary-color);
}

.tippy-box[data-theme~='sustainability'][data-placement^='bottom']>.tippy-arrow::before {
    border-bottom-color: var(--primary-color);
}

.tippy-box[data-theme~='sustainability'][data-placement^='left']>.tippy-arrow::before {
    border-left-color: var(--primary-color);
}

.tippy-box[data-theme~='sustainability'][data-placement^='right']>.tippy-arrow::before {
    border-right-color: var(--primary-color);
}

/* Light theme for help tooltips */
.tippy-box[data-theme~='light-border'] {
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
}

/* --- Responsive Utilities --- */
@media (max-width: 768px) {
    .loading-spinner {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }

    .card-hover-lift:hover {
        transform: none;
    }
}

/* Dashboard Utilities */
.opacity-10 {
    opacity: 0.1 !important;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.bg-gradient-primary-soft {
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-light) 100%);
}

.z-1 {
    z-index: 1;
}

/* --- Mobile Optimizations (Added by Assistant) --- */
@media (max-width: 576px) {

    /* Reduce Hero Section Height and Padding */
    .hero-card {
        min-height: auto !important;
    }

    .hero-card .card-body {
        padding: 2rem 1.5rem !important;
    }

    /* Reduce general card padding on mobile */
    .card-body.p-5 {
        padding: 1.5rem !important;
    }

    .card-body.p-4 {
        padding: 1.25rem !important;
    }

    /* Typography adjustments for readability without taking too much space */
    h1.display-4 {
        font-size: 1.75rem;
    }

    .lead {
        font-size: 1rem !important;
    }

    /* Hide decorative/heavy elements that distract on small screens */
    .trust-section .h5 {
        font-size: 0.9rem;
    }

    /* Adjust features grid to be more compact */
    .feature-icon-circle {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }
}

/* --- Mobile Menu: Auto-expand Categories in Offcanvas (Compact Version) --- */
@media (max-width: 991.98px) {

    /* Target only the main navigation dropdowns inside the offcanvas body */
    .offcanvas-body .navbar-nav .dropdown-menu {
        display: block !important;
        /* Force expansion */
        position: static !important;
        /* Remove popup positioning */
        border: none !important;
        box-shadow: none !important;
        background-color: transparent !important;
        padding-top: 0;
        padding-bottom: 0.2rem;
        margin-top: 0;
    }

    /* Indent items for hierarchy - COMPACT */
    .offcanvas-body .navbar-nav .dropdown-item {
        padding-left: 1.25rem;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
        color: var(--text-color);
        font-size: 0.9rem;
    }

    .offcanvas-body .navbar-nav .dropdown-item:active,
    .offcanvas-body .navbar-nav .dropdown-item:hover {
        background-color: var(--primary-light);
        color: var(--primary-dark);
        border-radius: var(--border-radius-sm);
    }

    /* Style the headers (previously toggles) - COMPACT */
    .offcanvas-body .navbar-nav .nav-link.dropdown-toggle {
        font-weight: 700;
        color: var(--primary-color);
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0.2rem;
        margin-top: 0.5rem;
        padding-left: 0;
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }

    /* Hide the dropdown arrow if it's always open */
    .offcanvas-body .navbar-nav .nav-link.dropdown-toggle::after {
        display: none;
    }
}
