/* =============================================================
   CRM HEADER — Global, all pages
   Sidebar navy: #0d1a74  |  Accent orange: #f56c21
   ============================================================= */

:root {
    --hdr-navy: #0d1a74;
    --hdr-navy2: #1a2d9e;
    --hdr-orange: #f56c21;
    --hdr-orange2: #ff8c42;
    --hdr-bg: #ffffff;
    --hdr-border: rgba(13, 26, 116, .12);
    --hdr-shadow: 0 2px 18px rgba(13, 26, 116, .09);
    --hdr-h: 72px;
    --hdr-sidebar: 252px;
    --hdr-sidebar-mini: 72px;
}

/* ── Hide original .header (theme default) ── */
.header {
    display: none !important;
}

/* ══════════════════════════════════════
   HEADER SHELL
══════════════════════════════════════ */
.crm-header {
    position: fixed;
    top: 0;
    left: var(--hdr-sidebar);
    right: 0;
    height: var(--hdr-h);
    z-index: 1040;
    background: var(--hdr-bg);
    border-bottom: 1.5px solid var(--hdr-border);
    box-shadow: var(--hdr-shadow);
    transition: left .25s ease;
}

.crm-header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 24px;
    gap: 16px;
}

.crm-header-spacer {
    flex: 1;
}

/* ══════════════════════════════════════
   HAMBURGER (mobile)
══════════════════════════════════════ */
.crm-mobile-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid var(--hdr-border);
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
}

.crm-bar-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.crm-bar-icon span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--hdr-navy);
    border-radius: 4px;
}

/* ══════════════════════════════════════
   GREETING BLOCK
══════════════════════════════════════ */
.crm-greet {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Sun/moon icon box */
.crm-greet-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #e8eaf6 0%, #f4f0fb 100%);
    border: 1.5px solid var(--hdr-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.crm-greet-avatar i {
    font-size: 22px;
    /* gradient text — same as sidebar accent */
    background: linear-gradient(135deg, var(--hdr-navy) 0%, var(--hdr-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crm-greet-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* "Good Afternoon, Super Admin" — bold navy */
.crm-greet-top {
    display: flex;
    align-items: baseline;
    gap: 5px;
    line-height: 1.2;
}

.crm-greet-hello,
.crm-greet-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--hdr-navy);
    /* ← same navy as sidebar */
}

.crm-greet-bottom {
    display: flex;
    align-items: center;
}

/* Role pill  — orange left bar, navy text, orange icon */
.crm-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--hdr-navy);
    /* ← navy text */
    border-left: 3px solid var(--hdr-orange);
    padding-left: 7px;
    line-height: 1;
}

.crm-role-pill i {
    font-size: 13px;
    color: var(--hdr-orange);
    /* ← orange icon */
}

/* ══════════════════════════════════════
   CLOCK WIDGET
   Layout: [clock-icon]  [HH:MM][PM][:SS]
                         [Wed, Aug 12 2026]
══════════════════════════════════════ */
.crm-clock-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    /* light navy-tint background */
    background: linear-gradient(135deg, #f0f2fc 0%, #eceffe 100%);
    /* gradient border: navy → orange */
    border: none;
    border-radius: 16px;
    padding: 7px 16px;
    flex-shrink: 0;
    position: relative;
    /* gradient border trick */
    box-shadow:
        0 0 0 1.5px transparent,
        inset 0 0 0 1.5px transparent;
    /* real gradient border via outline + background-clip alternative */
    background-image:
        linear-gradient(135deg, #f0f2fc 0%, #eceffe 100%);
    background-origin: border-box;
    /* gradient border via pseudo is tricky — use box-shadow approach */
    box-shadow:
        0 0 0 1.5px rgba(13, 26, 116, .18),
        0 3px 12px rgba(13, 26, 116, .08);
    min-width: 200px;
}

/* Orange-navy gradient border on clock widget using outline */
.crm-clock-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1.5px;
    background: linear-gradient(135deg, var(--hdr-navy) 0%, var(--hdr-orange) 100%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Circle clock icon */
.crm-clock-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg,
            rgba(13, 26, 116, .10) 0%,
            rgba(245, 108, 33, .10) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(13, 26, 116, .12);
}

.crm-clock-icon i {
    font-size: 17px;
    color: var(--hdr-navy);
}

.crm-clock-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Time row: 03:17 PM :50 ── */
.crm-clock-time {
    display: flex;
    align-items: baseline;
    gap: 0;
    line-height: 1;
}

/* HH:MM — big, bold, navy */
#crm-clock-hhmm {
    font-size: 1rem;
    font-weight: 800;
    color: var(--hdr-navy);
    font-variant-numeric: tabular-nums;
    letter-spacing: .5px;
}

/* AM/PM — orange, slightly smaller */
.crm-clock-ampm {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--hdr-orange);
    margin-left: 4px;
    margin-right: 2px;
    align-self: center;
}

/* :SS — small, muted gray */
.crm-clock-sec {
    font-size: 1rem;
    font-weight: 800;
    color: var(--hdr-navy);
    font-variant-numeric: tabular-nums;
    letter-spacing: .5px;
}

/* Date row — muted, smaller */
.crm-clock-date {
    font-size: 0.73rem;
    color: #6b7a99;
    font-weight: 500;
    white-space: nowrap;
}

/* ══════════════════════════════════════
   RIGHT SECTION
══════════════════════════════════════ */
.crm-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Notification bell (no popup, just link) ── */
.crm-notif-wrap {
    position: relative;
}

.crm-notif-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f2fc;
    /* navy-orange gradient border */
    border: 1.5px solid transparent;
    background-clip: padding-box;
    box-shadow:
        0 0 0 1.5px var(--hdr-border),
        0 2px 8px rgba(13, 26, 116, .07);
    color: var(--hdr-navy);
    text-decoration: none;
    position: relative;
    transition: background .2s, box-shadow .2s, transform .15s;
    cursor: pointer;
}

.crm-notif-btn:hover {
    background: #e6e9f8;
    box-shadow:
        0 0 0 2px var(--hdr-navy),
        0 4px 12px rgba(13, 26, 116, .15);
    transform: translateY(-1px);
}

.crm-notif-btn i {
    font-size: 18px;
    color: var(--hdr-navy);
}

/* Orange count badge */
.crm-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--hdr-orange);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid #fff;
}

/* ── Profile avatar ── */
.crm-profile-drop {
    position: relative;
}

.crm-avatar-btn {
    display: flex;
    align-items: center;
    position: relative;
    text-decoration: none;
    cursor: pointer;
}

.crm-avatar-btn::after {
    display: none !important;
}

.crm-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    /* orange border matching sidebar accent */
    border: 2.5px solid var(--hdr-orange);
    box-shadow: 0 2px 10px rgba(245, 108, 33, .28);
    transition: box-shadow .2s, transform .15s;
}

.crm-avatar-btn:hover .crm-avatar-img {
    box-shadow: 0 4px 16px rgba(245, 108, 33, .45);
    transform: scale(1.05);
}

/* Green online dot */
.crm-avatar-online {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.crm-profile-menu {
    min-width: 240px;
}

/* ── Mobile ellipsis ── */
.crm-mobile-menu {
    display: none;
}

/* ══════════════════════════════════════
   PAGE WRAPPER OFFSET
══════════════════════════════════════ */
.page-wrapper {
    margin-left: var(--hdr-sidebar) !important;
    padding-top: var(--hdr-h) !important;
    transition: margin-left .25s ease;
}

/* Mini sidebar */
.mini-sidebar .crm-header {
    left: var(--hdr-sidebar-mini);
}

.mini-sidebar .page-wrapper {
    margin-left: var(--hdr-sidebar-mini) !important;
}

/* Mini sidebar expanded */
.expand-menu.mini-sidebar .crm-header {
    left: var(--hdr-sidebar) !important;
}

.expand-menu.mini-sidebar .page-wrapper {
    margin-left: var(--hdr-sidebar) !important;
}

/* Sidebar always above content */
.sidebar {
    z-index: 1050 !important;
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */

/* Tablet 768–991 */
@media (max-width: 991.98px) {
    .crm-header {
        left: 0 !important;
        height: 62px;
    }

    .page-wrapper {
        margin-left: 0 !important;
        padding-top: 62px !important;
    }

    .crm-mobile-btn {
        display: flex;
    }

    .crm-clock-widget {
        min-width: 175px;
        padding: 8px 12px;
    }

    #crm-clock-hhmm {
        font-size: 1.15rem;
    }

    .sidebar {
        padding-top: 62px;
        z-index: 1045 !important;
    }
}

/* Mobile <768 */
@media (max-width: 767.98px) {
    .crm-header {
        left: 0 !important;
        height: 56px;
    }

    .crm-header-inner {
        padding: 0 14px;
        gap: 10px;
    }

    .page-wrapper {
        margin-left: 0 !important;
        padding-top: 56px !important;
    }

    .crm-clock-widget {
        display: none !important;
    }

    .crm-greet {
        display: none !important;
    }

    .crm-mobile-menu {
        display: block;
    }

    .crm-mobile-btn {
        display: flex;
    }

    .page-wrapper .content {
        padding: 12px !important;
    }

    .sidebar {
        padding-top: 56px;
    }
}

/* Extra small <480 */
@media (max-width: 479.98px) {
    .crm-header {
        height: 52px;
    }

    .crm-header-inner {
        padding: 0 10px;
        gap: 8px;
    }

    .page-wrapper {
        padding-top: 52px !important;
    }

    .sidebar {
        padding-top: 52px;
    }
}