/**
 * Issue #8528 (MS-014) — Termont CRM Admin Header — fixed full-width
 * @author Olivier RAVEAU - Oliv.Ai 🥷
 * @since 2026-04-30
 */

/* Reset for crm-admin-page body to neutralize WP admin bar bumper */
html.crm-admin-page-html, body.crm-admin-page { margin-top: 0 !important; }
body.crm-admin-page { padding-top: 52px !important; }

/**
 * Override admin-fullbleed.css rule that hides `body.admin-fullbleed > header`.
 * Issue #8528 hotfix: on /clerks-admin/admin-organizations/ + /admin-users/ +
 * /organisations-ifs/ (all using elementor_header_footer template + admin-fullbleed
 * body class), the existing CSS hides ALL direct-child <header> elements. Bump
 * specificity to display:flex so our new bar wins.
 */
header#dms-crm-admin-header.dms-crm-admin-header,
body.admin-fullbleed > header#dms-crm-admin-header,
body.crm-admin-page > header#dms-crm-admin-header {
    display: flex !important;
}

.dms-crm-admin-header {
    position: fixed; top: 0; left: 0; right: 0;
    width: 100%; height: 52px;
    background: #003366; /* Termont primary */
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-family: 'Arial', sans-serif;
    align-items: stretch;
}
.dms-crm-admin-header-inner {
    display: flex; align-items: center; height: 100%;
    padding: 0 16px; gap: 4px;
    max-width: 100%;
}

/* Logo — Issue #8549: !important needed because Logistik theme rule
   `img:not([draggable]) { height:auto; max-width:100% }` has same specificity
   (0,0,1,1) and loads later in cascade — so prior #8541 rule lost. */
.dms-crm-admin-logo { flex-shrink: 0; margin-right: 8px; display: flex; align-items: center; }
header#dms-crm-admin-header .dms-crm-admin-logo img,
.dms-crm-admin-logo img {
    display: block !important;
    height: 24px !important;
    width: auto !important;
    max-width: 100px !important;
    object-fit: contain;
}

/* Nav links — base */
.dms-crm-nav { display: flex; align-items: center; height: 100%; }
.dms-crm-nav-link {
    display: inline-flex; align-items: center; height: 52px;
    padding: 0 14px;
    color: rgba(255,255,255,0.85);
    font-size: 13px; font-weight: 500; text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.dms-crm-nav-link:hover {
    background: rgba(255,255,255,0.08); color: #fff;
    border-bottom-color: rgba(255,255,255,0.4);
    text-decoration: none;
}
.dms-crm-nav-link--active {
    color: #fff !important;
    border-bottom-color: #4a9fd4 !important;
    background: rgba(255,255,255,0.05);
}

/* Admin nav (gold tint + separator) */
.dms-crm-nav--admin {
    margin-left: 8px; padding-left: 12px;
    border-left: 1px solid rgba(255,255,255,0.15);
}
.dms-crm-nav--admin::before {
    content: '👑 ADMIN';
    font-size: 9px; font-weight: 700; letter-spacing: 1px;
    color: rgba(255,220,100,0.6);
    margin-right: 8px; align-self: center; white-space: nowrap;
}
.dms-crm-nav--admin .dms-crm-nav-link { color: rgba(255,220,100,0.9); }
.dms-crm-nav--admin .dms-crm-nav-link:hover {
    background: rgba(255,220,100,0.12);
    color: #ffd764;
    border-bottom-color: #ffd764;
}

/* Logout pinned right */
.dms-crm-logout { margin-left: auto; color: rgba(255,150,150,0.85); }
.dms-crm-logout:hover { background: rgba(220,53,69,0.18); color: #ff6b6b; border-bottom-color: #ff6b6b; }

/* Responsive */
@media (max-width: 768px) {
    .dms-crm-nav-link { padding: 0 8px; font-size: 12px; }
    .dms-crm-admin-logo img { height: 24px; }
    .dms-crm-nav--admin::before { content: '👑'; margin-right: 4px; }
    .dms-crm-nav--admin { margin-left: 4px; padding-left: 6px; }
}
@media (max-width: 480px) {
    .dms-crm-admin-header-inner { padding: 0 8px; }
    .dms-crm-nav-link { padding: 0 6px; font-size: 11px; }
    .dms-crm-logout-label { display: none; }
}
