/* ============================================================
   FRONTEND HEADER – TWEE RIJEN
   ============================================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}
.header-row {
    display: flex;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}
.header-row-top {
    justify-content: space-between;
    gap: 12px;
}
.header-row-bottom {
    justify-content: flex-end;
    align-items: stretch;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* ============================================================
   LOGO-AREA met home-knop links van de titel
   ============================================================ */
.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.logo-area .home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    text-decoration: none;
    transition: background 0.2s;
}
.logo-area .home-link:hover {
    background: rgba(255,255,255,0.15);
}
.logo-area .home-icon {
    height: 42px;
    width: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.2s;
}
.logo-area .home-link:hover .home-icon {
    transform: scale(1.08);
}

.title-group h1 {
    margin: 0;
    font-size: 1.6em;
    line-height: 1.2;
}
.title-group a {
    color: white;
    text-decoration: none;
}
.title-group p {
    margin: 0;
    opacity: 0.8;
    font-size: 0.9em;
}

.lang-switch {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}
.lang-switch .lang-link {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9em;
    font-family: 'Segoe UI', system-ui, sans-serif !important;
    transition: background 0.2s;
}
.lang-switch .lang-link:hover,
.lang-switch .lang-link.active {
    background: white;
    color: var(--primary-color);
}
/* ============================================================
   HELP-KNOP (question.png) in header
   ============================================================ */
.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    line-height: 0;
}
.help-btn:hover {
    background: rgba(255,255,255,0.15);
}
.help-btn:active {
    transform: scale(0.95);
}
.help-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
    transition: filter 0.15s;
}
.help-btn:hover .help-icon {
    filter: brightness(0) invert(0.85);
}
.header-text-link {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 0.95rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}
.header-text-link:hover,
.header-text-link.active {
    background: rgba(255,255,255,0.15);
}
.header-text-link-spacer {
    margin-left: auto;
}
.part-dropdown,
.chapter-dropdown {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.4);
    background: transparent;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    max-width: 200px;
}
.part-dropdown option,
.chapter-dropdown option {
    color: #333;
    background: white;
}

/* ============================================================
   HAMBURGER MENU
   ============================================================ */
.header-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.hamburger-btn {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: white;
    font-family: inherit;
    transition: background 0.2s;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hamburger-btn:hover {
    background: rgba(255,255,255,0.15);
}
.hamburger-btn svg {
    display: block;
}

/* ============================================================
   NOTES HEADER LINK
   ============================================================ */
.notes-header-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
    box-sizing: border-box;
}
.notes-header-link:hover,
.notes-header-link.active {
    background: rgba(255, 255, 255, 0.18);
}
.notes-header-icon {
    height: 26px;
    width: auto;
    display: block;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
    transition: filter 0.15s;
}
.notes-header-link:hover .notes-header-icon {
    filter: brightness(0) invert(0.85);
}
.notes-header-text {
    line-height: 1;
}

/* ============================================================
   HEADER ZOEKVELD
   ============================================================ */
.header-search-form {
    display: flex;
    align-items: center;
    align-self: stretch;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    overflow: hidden;
    margin-left: 8px;
    max-width: 320px;
    transition: background 0.2s, border-color 0.2s;
    box-sizing: border-box;
}
.header-search-form:hover {
    background: rgba(255,255,255,0.15);
}
.header-search-form:focus-within {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.7);
}
.header-search-type {
    background: transparent;
    color: white;
    border: none;
    padding: 6px 4px 6px 10px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    max-width: 120px;
    border-right: 1px solid rgba(255,255,255,0.4);
}
.header-search-type option {
    color: #333;
    background: white;
}
.header-search-input {
    flex: 1;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
    line-height: 1.45;
}
.header-search-input::placeholder {
    color: rgba(255,255,255,0.7);
}
.header-search-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.header-search-btn:hover { opacity: 0.8; }
.header-search-btn img {
    height: 18px;
    width: 18px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
.search-input-invalid {
    animation: search-invalid-shake 0.4s ease;
}
@keyframes search-invalid-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

/* ============================================================
   ZOEKBARE CHAPTER DROPDOWN IN HEADER
   ============================================================ */
.chapter-search-dropdown {
    position: relative;
    display: inline-block;
    min-width: 180px;
    max-width: 240px;
    align-self: stretch;
}
.chapter-search-input {
    width: 100%;
    height: 100%;
    padding: 6px 28px 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.4);
    background: transparent;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: text;
    outline: none;
    transition: background 0.2s, border-color 0.2s;
    box-sizing: border-box;
}
.chapter-search-input::placeholder {
    color: rgba(255,255,255,0.7);
    font-weight: 600;
}
.chapter-search-input:focus {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.8);
}
.chapter-search-dropdown::after {
    content: '▾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.7rem;
}
.chapter-search-results {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    z-index: 2000;
    padding: 4px 0;
}
.chapter-search-results.visible { display: block; }
.chapter-search-result-item {
    padding: 8px 14px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chapter-search-result-item:hover,
.chapter-search-result-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
}
.chapter-search-result-item .ch-num {
    font-weight: 700;
    color: var(--primary-color);
    flex-shrink: 0;
    min-width: 26px;
    text-align: right;
}
.chapter-search-result-item .ch-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chapter-search-result-item .ch-name mark {
    background: #fef08a;
    color: inherit;
    padding: 0;
}
.chapter-search-empty {
    padding: 12px 14px;
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
}

/* ============================================================
   ADMIN NAV
   ============================================================ */
.admin-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #1e1b4b;
    color: white;
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
body:has(.admin-navbar) {
    padding-top: 70px !important;
}
.admin-navbar .nav-brand {
    font-size: 1.3em;
    font-weight: bold;
    letter-spacing: 0.5px;
}
.admin-navbar .nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}
.admin-navbar .nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}
.admin-navbar .nav-links a:hover,
.admin-navbar .nav-links a.active {
    color: white;
    background: rgba(255,255,255,0.1);
}
.admin-navbar .nav-links a.logout {
    color: white;
    font-size: 1.4rem;
    padding: 0 4px;
}
.admin-navbar .nav-links a.logout .logout-icon {
    height: 30px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: filter 0.2s;
}
.admin-navbar .nav-links a.logout:hover .logout-icon {
    filter: brightness(0) invert(0.8);
}
.admin-navbar .home-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}
.admin-navbar .home-link:hover { background: rgba(255,255,255,0.1); }
.admin-navbar .home-icon {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: transform 0.2s, filter 0.2s;
}
.admin-navbar .home-icon:hover {
    transform: scale(1.1);
    filter: brightness(0) invert(0.8);
}

/* ============================================================
   AI-KNOP IN HEADER — tekst in plaats van icoon
   Desktop  : "AI" (hardcoded, alle talen)
   Mobiel   : ai_title uit init.php (via responsive.css)
   Hoogte   : align-self stretch — altijd gelijk aan de rij,
              dus automatisch gelijk aan het zoekveld
   ============================================================ */
.header-ai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0 12px;
    margin-left: 6px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.4);
    background: transparent;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Segoe UI', system-ui, sans-serif;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
    box-sizing: border-box;
    line-height: 1;
}
.header-ai-btn:hover {
    background: rgba(255,255,255,0.15);
}
.header-ai-btn:active {
    background: rgba(255,255,255,0.22);
}

.header-ai-label {
    display: none;
    line-height: 1;
}

/* Desktop: korte "AI" */
.header-ai-label-short { display: inline; }

/* Mobiel: volledige ai_title (toggle in responsive.css) */
.header-ai-label-full  { display: none; }

html[dir="rtl"] .header-ai-btn {
    margin-left: 0;
    margin-right: 6px;
}