/* ═══════════════════════════════════════════════════════════════
   3BOO – Admin overrides for django-unfold 0.79
   Cross-browser: Chrome, Edge, Firefox, Safari
   ═══════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════
   1. SIDEBAR — layout fix
   ═══════════════════════════════════════════════════════════════
   Unfold uses xl: (1280px) breakpoint for the sidebar.
   We lower it to 1024px via plain CSS (Tailwind lg: classes
   are NOT in unfold's compiled CSS, so we can't use them).
   ─────────────────────────────────────────────────────────────── */

/* Show sidebar wrapper at ≥1024px */
@media (min-width: 1024px) {
    .relative.z-60 > .fixed.w-\[288px\] {
        display: block !important;
        position: relative !important;
    }
}

/* Smooth scrolling for nav */
#nav-sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Nav items container — fill space */
#nav-sidebar-apps {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 0%;
    padding-bottom: 16px;
}

/* Compact nav items so 18 groups fit */
#nav-sidebar-apps a {
    height: 34px !important;
    font-size: 0.8125rem;
}

/* Group headings — smaller */
#nav-sidebar-apps h2 {
    font-size: 0.75rem;
    padding-top: 6px;
    padding-bottom: 4px;
}


/* ═══════════════════════════════════════════════════════════════
   2. TABS — top model tabs (General, Familia, Evaluaciones…)
   ═══════════════════════════════════════════════════════════════ */

/* Tab bar — visible pill-style container */
#tabs-items {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    max-width: 100%;
    background: #f3f4f6 !important;
    padding: 4px !important;
    border-radius: 8px !important;
}

/* Each tab — pill button */
#tabs-items > a {
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap;
    font-size: 0.8125rem !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    color: #4b5563 !important;
    text-decoration: none !important;
    cursor: pointer;
    -webkit-transition: all 0.15s ease;
    transition: all 0.15s ease;
}

/* Tab hover */
#tabs-items > a:hover {
    background: rgba(0,0,0,0.04) !important;
    border-color: #e5e7eb !important;
}

/* Active tab — white pill with shadow */
#tabs-items > a.active {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
    -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
}

/* Tab wrapper — no overflow clip */
#tabs-wrapper {
    overflow: visible !important;
}


/* ═══════════════════════════════════════════════════════════════
   3. FIELDSET SUB-TABS (Datos personales, Datos médicos…)
   ═══════════════════════════════════════════════════════════════ */

/* Fieldset tab container */
div[x-data*="activeFieldsetTab"] > div > nav {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    background: #f3f4f6 !important;
    padding: 4px !important;
    border-radius: 8px !important;
}

/* Each fieldset sub-tab */
div[x-data*="activeFieldsetTab"] > div > nav > a {
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap;
    font-size: 0.8125rem !important;
    padding: 6px 14px !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    color: #4b5563 !important;
    text-decoration: none !important;
    -webkit-transition: all 0.15s ease;
    transition: all 0.15s ease;
}

div[x-data*="activeFieldsetTab"] > div > nav > a:hover {
    background: rgba(0,0,0,0.04) !important;
    border-color: #e5e7eb !important;
}

div[x-data*="activeFieldsetTab"] > div > nav > a.active {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
    -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
}


/* ═══════════════════════════════════════════════════════════════
   4. SIDEBAR — Active item highlighting (subtle indicator)
   ═══════════════════════════════════════════════════════════════
   Unfold adds class "active" + "text-primary-600" + "bg-base-100"
   to the matching <a> in the sidebar. We add a subtle left accent
   only to the single active link (not the whole group).
   ─────────────────────────────────────────────────────────────── */

/* Active sidebar link — subtle left accent dot + indigo text */
#nav-sidebar-apps a.active {
    position: relative;
    background: rgba(79, 70, 229, 0.06) !important;
    color: #4f46e5 !important;
    font-weight: 600 !important;
}

/* Small rounded indicator bar on the left */
#nav-sidebar-apps a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 0 3px 3px 0;
    background: #4f46e5;
}

/* Active icon inherits the indigo tone */
#nav-sidebar-apps a.active .material-symbols-outlined {
    color: #4f46e5 !important;
}


/* ═══════════════════════════════════════════════════════════════
   6. "MI PANEL" HEADER BUTTON — responsive
   ═══════════════════════════════════════════════════════════════ */

/* Mobile: hide label, show only icon */
@media (max-width: 767px) {
    #boo-my-panel-btn .boo-panel-label {
        display: none !important;
    }
    #boo-my-panel-btn {
        padding: 6px 8px !important;
    }
}

/* Hide in print */
@media print {
    #boo-my-panel-btn {
        display: none !important;
    }
}


/* ═══════════════════════════════════════════════════════════════
   5. DARK MODE overrides
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
    /* Sidebar active — dark mode */
    #nav-sidebar-apps a.active {
        background: rgba(129, 140, 248, 0.10) !important;
        color: #a5b4fc !important;
    }
    #nav-sidebar-apps a.active::before {
        background: #818cf8;
    }
    #nav-sidebar-apps a.active .material-symbols-outlined {
        color: #a5b4fc !important;
    }

    /* Tabs — dark mode */
    #tabs-items {
        background: rgba(255,255,255,0.06) !important;
    }
    #tabs-items > a {
        color: #d1d5db !important;
    }
    #tabs-items > a:hover {
        background: rgba(255,255,255,0.08) !important;
        border-color: rgba(255,255,255,0.1) !important;
    }
    #tabs-items > a.active {
        background: #374151 !important;
        border-color: #4b5563 !important;
        color: #818cf8 !important;
    }
    div[x-data*="activeFieldsetTab"] > div > nav {
        background: rgba(255,255,255,0.06) !important;
    }
    div[x-data*="activeFieldsetTab"] > div > nav > a {
        color: #d1d5db !important;
    }
    div[x-data*="activeFieldsetTab"] > div > nav > a:hover {
        background: rgba(255,255,255,0.08) !important;
        border-color: rgba(255,255,255,0.1) !important;
    }
    div[x-data*="activeFieldsetTab"] > div > nav > a.active {
        background: #374151 !important;
        border-color: #4b5563 !important;
        color: #818cf8 !important;
    }
}


/* ═══════════════════════════════════════════════════════════════
   BL-72 — OMNISEARCH (command palette)
   ═══════════════════════════════════════════════════════════════ */

/* Overlay */
.omnisearch-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.45); display: flex;
    align-items: flex-start; justify-content: center;
    padding-top: 12vh;
}
.omnisearch-overlay.hidden { display: none; }

/* Dialog */
.omnisearch-dialog {
    background: #fff; border-radius: 12px; width: 540px; max-width: 94vw;
    box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden;
}
.dark .omnisearch-dialog { background: #1e1e2e; }

/* Header row */
.omnisearch-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; border-bottom: 1px solid #e5e7eb;
}
.dark .omnisearch-header { border-color: #374151; }

.omnisearch-input {
    flex: 1; border: none; outline: none; font-size: 15px;
    background: transparent; color: inherit;
}
.omnisearch-input::placeholder { color: #9ca3af; }

.omnisearch-kbd {
    font-size: 11px; background: #f3f4f6; border: 1px solid #d1d5db;
    border-radius: 4px; padding: 1px 6px; color: #6b7280; font-family: inherit;
}
.dark .omnisearch-kbd { background: #374151; border-color: #4b5563; color: #9ca3af; }

/* Results list */
.omnisearch-results {
    max-height: 360px; overflow-y: auto; padding: 4px 0;
}
.omnisearch-empty {
    padding: 24px; text-align: center; color: #9ca3af; font-size: 14px;
}

/* Result item */
.omnisearch-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; text-decoration: none; color: inherit;
    cursor: pointer; transition: background .1s;
}
.omnisearch-item:hover,
.omnisearch-item.selected { background: #f3f4f6; }
.dark .omnisearch-item:hover,
.dark .omnisearch-item.selected { background: #27273a; }

.omnisearch-item-icon { font-size: 18px; color: #6366f1; flex-shrink: 0; }
.omnisearch-item-text { display: flex; flex-direction: column; min-width: 0; }
.omnisearch-item-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omnisearch-item-section { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Trigger button — now rendered in userlinks.html via Tailwind classes.
   Only the overlay/dialog styles remain here. */
