:root {
    --color-accent: #00A9CE;          /* Pantone 312 C */
    --color-base: #002654;            /* Pantone 2758 C */
    --color-neutral: #E6E8EA;         /* Gris Claro Frío */
    --color-text: #2F343A;            /* Gris Carbón */
    --color-white: #FFFFFF;           /* Blanco Puro */
    
    --color-accent-hover: #008eb0;    /* Darkened accent for hovers */
    --color-base-light: #003b80;      /* Lightened base for gradients */
    
    --shadow-premium: 0 4px 12px rgba(0, 38, 84, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 38, 84, 0.15);
    --transition-speed: 0.3s;
}

/* =========================================
   1. Typography & Background Defaults
========================================= */
body {
    font-family: 'Inter', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
}

.content-wrapper, .main-footer {
    background-color: var(--color-neutral) !important;
}

a {
    color: var(--color-accent);
    transition: color var(--transition-speed) ease;
}
a:hover {
    color: var(--color-base);
}

/* =========================================
   2. Buttons (Premium & Micro-Animations)
========================================= */
.btn-primary, .btn-info {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: var(--color-white) !important;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: 6px;
    transition: all var(--transition-speed) cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-primary:hover, .btn-info:hover {
    background-color: var(--color-accent-hover) !important;
    border-color: var(--color-accent-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 169, 206, 0.35);
}

.btn-primary:active, .btn-info:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 169, 206, 0.25);
}

.btn-success {
    border-radius: 6px;
    font-weight: 600;
    transition: all var(--transition-speed) ease;
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
}

/* =========================================
   3. Sidebar (Institutional Base #002654)
========================================= */
:root {
    --sidebar-expanded-width: 300px;
}

.main-sidebar.sidebar-dark-primary {
    background: linear-gradient(180deg, var(--color-base) 0%, #00122e 100%) !important;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

@media (min-width: 768px) {
    body:not(.sidebar-collapse) .main-sidebar,
    body:not(.sidebar-collapse) .main-sidebar::before {
        width: var(--sidebar-expanded-width) !important;
    }

    body:not(.sidebar-collapse) .content-wrapper,
    body:not(.sidebar-collapse) .main-header,
    body:not(.sidebar-collapse) .main-footer {
        margin-left: var(--sidebar-expanded-width) !important;
    }
}

.main-sidebar .brand-link,
.main-sidebar .user-panel .info,
.main-sidebar .nav-sidebar .nav-link {
    overflow: visible;
}

.main-sidebar .nav-sidebar .nav-link p,
.main-sidebar .nav-header {
    max-width: 220px;
    white-space: normal;
    line-height: 1.2;
}

.main-sidebar .nav-header {
    padding-right: 12px;
    font-size: 0.78rem;
}

/* Active navigation link */
.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
    background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-accent-hover) 100%) !important;
    color: var(--color-white) !important;
    box-shadow: 0 4px 10px rgba(0, 169, 206, 0.4) !important;
    border-radius: 6px;
    margin: 0 8px;
    width: auto;
}

/* Hover navigation link (Micro animation) */
.nav-sidebar > .nav-item > .nav-link {
    transition: all 0.2s ease;
    border-radius: 6px;
    margin: 0 8px;
    width: auto;
}
.nav-sidebar > .nav-item > .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    transform: translateX(4px);
}

.nav-sidebar > .nav-item.has-treeview > .nav-link {
    border-left: 3px solid rgba(0, 169, 206, 0.55);
    background-color: rgba(255, 255, 255, 0.035);
    padding-right: 2.35rem;
}

.nav-sidebar > .nav-item.has-treeview > .nav-link .right {
    right: 0.75rem;
    top: 50%;
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: -0.68rem;
    border-radius: 4px;
    color: #ffffff;
    background-color: rgba(0, 169, 206, 0.22);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.nav-sidebar > .nav-item.has-treeview.menu-open > .nav-link .right {
    background-color: rgba(0, 169, 206, 0.45);
}

.nav-sidebar > .nav-item.has-treeview > .nav-link:hover .right {
    background-color: rgba(0, 169, 206, 0.65);
}

.nav-sidebar .nav-treeview {
    margin: 0 8px 6px 16px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-sidebar .nav-treeview > .nav-item > .nav-link {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0.85rem;
}

/* Navbar (Header) */
.main-header.navbar {
    background-color: var(--color-white);
    border-bottom: 1px solid rgba(0, 38, 84, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

/* =========================================
   4. Cards (Glass & Elevation)
========================================= */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-premium);
    transition: box-shadow var(--transition-speed) ease, transform 0.2s ease;
}
.card:hover {
    box-shadow: var(--shadow-hover);
}

/* Card Header Primary -> Base Gradient */
.card-primary:not(.card-outline) > .card-header, 
.bg-primary {
    background: linear-gradient(135deg, var(--color-base) 0%, var(--color-base-light) 100%) !important;
    color: var(--color-white) !important;
    border-bottom: none;
}
/* Fixing border radius for headers */
.card-primary:not(.card-outline) > .card-header {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* Outline Card top border */
.card-primary.card-outline {
    border-top: 3px solid var(--color-base) !important;
}

/* =========================================
   5. Tables (Interaction & Hover)
========================================= */
.table {
    color: var(--color-text);
}
.table thead th {
    border-bottom: 2px solid rgba(0, 38, 84, 0.1);
    color: var(--color-base);
    font-weight: 600;
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, transform 0.1s ease;
}
.clickable-row:hover {
    background-color: #f8f9fa !important;
    box-shadow: inset 4px 0 0 var(--color-accent);
}

/* =========================================
   6. Badges & Utils
========================================= */
.badge-info, .bg-info {
    background-color: var(--color-accent) !important;
    color: var(--color-white) !important;
}
.text-primary, .text-info {
    color: var(--color-accent) !important;
}
.text-dark {
    color: var(--color-base) !important;
}

/* Miscelanea del viejo custom.css */
#materiales-lista .list-group-item { display: flex; justify-content: space-between; align-items: center; }
.filter-buttons .btn { margin-right: 5px; }
tr.not-clickable { cursor: default; }
.table-responsive-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.overdue-row { background-color: #ffdddd !important; }
.lectura-normal { background-color: #d4edda !important; }
.lectura-estimada { background-color: #fff3cd !important; }
#file-preview { margin-top: 15px; display: flex; flex-wrap: wrap; gap: 10px; }
#file-preview img { max-width: 80px; max-height: 80px; height: auto; border: 1px solid #ddd; border-radius: 4px; object-fit: cover; }
.custom-file-label::after { content: "Buscar"; }
.truncate-path { display: inline-block; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

/* =========================================
   7. Small-Box Info Cards (Institutional)
========================================= */
.small-box.bg-info {
    background: linear-gradient(135deg, var(--color-accent) 0%, #008eb0 100%) !important;
}
.small-box.bg-success {
    background: linear-gradient(135deg, var(--color-base) 0%, var(--color-base-light) 100%) !important;
}
.small-box.bg-warning {
    background: linear-gradient(135deg, #4DCAE6 0%, var(--color-accent) 100%) !important;
    color: var(--color-white) !important;
}
.small-box.bg-warning .inner h3,
.small-box.bg-warning .inner p,
.small-box.bg-warning .icon i {
    color: var(--color-white) !important;
}
.small-box.bg-danger {
    background: linear-gradient(135deg, var(--color-text) 0%, #1a1e23 100%) !important;
}
.small-box.bg-teal {
    background: linear-gradient(135deg, #004B91 0%, var(--color-base) 100%) !important;
}
.small-box.bg-primary {
    background: linear-gradient(135deg, var(--color-base) 0%, #001a3d 100%) !important;
}

/* Micro-animations for small-box hover */
.small-box {
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.small-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 38, 84, 0.2);
}

/* Card header overrides for card-info, card-warning etc */
.card-info:not(.card-outline) > .card-header {
    background: linear-gradient(135deg, var(--color-accent) 0%, #008eb0 100%) !important;
    border-bottom: none;
}
.card-warning:not(.card-outline) > .card-header {
    background: linear-gradient(135deg, #4DCAE6 0%, var(--color-accent) 100%) !important;
    border-bottom: none;
}

/* =========================================
   8. Brand Link / Sidebar Logo
========================================= */
.brand-link {
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    background: rgba(0, 0, 0, 0.15);
}
.brand-text {
    font-weight: 700 !important;
    letter-spacing: 1px;
}

/* =========================================
   9. Menú principal para teléfonos
========================================= */
.sisgo-mobile-menu-page {
    background: linear-gradient(180deg, #f7fbff 0%, #eef3f8 100%) !important;
}

.sisgo-mobile-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px 12px;
    width: 100%;
    max-width: 760px;
    margin: 18px auto 0;
    padding: 8px 0 28px;
}

.sisgo-mobile-menu-item {
    min-width: 0;
    color: #1f2d3d;
    text-align: center;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
}

.sisgo-mobile-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 8px;
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(0, 38, 84, .18), inset 0 1px 0 rgba(255, 255, 255, .25);
    color: #fff;
    font-size: 29px;
    transition: transform .16s ease, box-shadow .16s ease;
}

.sisgo-mobile-menu-item:active .sisgo-mobile-menu-icon {
    transform: scale(.95);
    box-shadow: 0 4px 10px rgba(0, 38, 84, .18);
}

.sisgo-mobile-menu-label {
    display: block;
    max-width: 105px;
    margin: 0 auto;
    color: #243447;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.sisgo-icon-blue   { background: linear-gradient(145deg, #08add0, #087ba6); }
.sisgo-icon-green  { background: linear-gradient(145deg, #42c789, #15955d); }
.sisgo-icon-orange { background: linear-gradient(145deg, #ffbd52, #ee7d24); }
.sisgo-icon-purple { background: linear-gradient(145deg, #bf79d8, #8250aa); }
.sisgo-icon-teal   { background: linear-gradient(145deg, #36c7c0, #158b91); }
.sisgo-icon-yellow { background: linear-gradient(145deg, #ffd95c, #e6a824); }
.sisgo-icon-navy   { background: linear-gradient(145deg, #245997, #002654); }

.sisgo-mobile-menu-back {
    padding-left: 0;
    color: #004b91;
    font-weight: 600;
}

@media (max-width: 767.98px) {
    body .main-sidebar {
        display: none !important;
    }

    body .main-header,
    body .content-wrapper,
    body .main-footer {
        margin-left: 0 !important;
    }

    .sisgo-mobile-menu-page {
        min-height: calc(100vh - 57px) !important;
    }

    .sisgo-mobile-menu-page .content-header {
        padding: 18px 12px 2px;
    }

    .sisgo-mobile-menu-page .content-header h1 {
        color: #002654;
        font-size: 24px;
        font-weight: 700;
    }

    .sisgo-mobile-menu-page .content {
        padding: 0 10px;
    }

    .sisgo-mobile-menu-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 19px 6px;
        margin-top: 10px;
    }

    .sisgo-mobile-menu-icon {
        width: clamp(54px, 17vw, 66px);
        height: clamp(54px, 17vw, 66px);
        border-radius: 16px;
        font-size: clamp(23px, 7vw, 28px);
    }

    .sisgo-mobile-menu-label {
        font-size: clamp(10px, 3vw, 12px);
    }
}
