/* ============================================================
   css/header.css — Header & Navbar AutoServis
   Scope: .site-header și tot ce e în el
   ============================================================ */

/* ------------------------------------------------------------
   Variabile
   ------------------------------------------------------------ */
:root {
    --h-bg:          #0d1b2a;
    --h-bg-light:    #162032;
    --h-border:      rgba(255, 255, 255, 0.07);
    --h-accent:      #2563eb;
    --h-accent-glow: rgba(37, 99, 235, 0.35);
    --h-orange:      #f59e0b;
    --h-green:       #10b981;
    --h-red:         #ef4444;
    --h-text:        #e2e8f0;
    --h-text-muted:  #64748b;
    --h-height:      68px;
    --h-radius:      10px;
    --h-transition:  0.2s ease;
    font-family: 'Inter', 'Poppins', sans-serif;
}

/* ------------------------------------------------------------
   Reset & baza globala (incarcat pe toate paginile cu header)
   ------------------------------------------------------------ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', 'Poppins', sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
a { color: var(--h-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------
   Structura principala
   ------------------------------------------------------------ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: var(--h-bg);
    border-bottom: 1px solid var(--h-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    height: var(--h-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

/* ------------------------------------------------------------
   Brand / Logo
   ------------------------------------------------------------ */
.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--h-accent) 0%, #1d4ed8 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15em;
    color: #fff;
    box-shadow: 0 4px 14px var(--h-accent-glow);
    transition: transform var(--h-transition), box-shadow var(--h-transition);
}

.site-brand:hover .brand-logo {
    transform: translateY(-2px) rotate(-3deg);
    box-shadow: 0 8px 20px var(--h-accent-glow);
}

.brand-name {
    display: block;
    font-size: 1.05em;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-sub {
    display: block;
    font-size: 0.7em;
    font-weight: 400;
    color: var(--h-text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ------------------------------------------------------------
   Navigatie
   ------------------------------------------------------------ */
.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
    display: none;
}

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--h-radius);
    color: var(--h-text-muted);
    text-decoration: none;
    font-size: 0.875em;
    font-weight: 500;
    white-space: nowrap;
    transition: background var(--h-transition), color var(--h-transition);
}

.nav-link i {
    font-size: 0.95em;
    flex-shrink: 0;
}

.nav-link:hover {
    background: var(--h-bg-light);
    color: var(--h-text);
    text-decoration: none;
}

.nav-link.is-active {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}

.nav-link.is-active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: #60a5fa;
    border-radius: 2px 2px 0 0;
}

.nav-link--admin {
    color: var(--h-green);
}

.nav-link--admin:hover {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
}

.nav-link--admin.is-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.nav-link--urgenta {
    color: #f87171;
}

.nav-link--urgenta:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.nav-link--urgenta.is-active {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Badge notificari */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--h-orange);
    color: #000;
    font-size: 0.7em;
    font-weight: 700;
    border-radius: 20px;
    line-height: 1;
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
    50%       { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); }
}

/* ------------------------------------------------------------
   Zona dreapta: ceas + user + logout + hamburger
   ------------------------------------------------------------ */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

/* Ceas */
.header-clock {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    background: var(--h-bg-light);
    border: 1px solid var(--h-border);
    border-radius: 20px;
    font-size: 0.875em;
    font-weight: 600;
    color: var(--h-text);
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

.header-clock__dot {
    font-size: 0.45em;
    color: var(--h-green);
    animation: dot-blink 2s step-start infinite;
}

@keyframes dot-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

/* User chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--h-bg-light);
    border: 1px solid var(--h-border);
    border-radius: 24px;
    cursor: default;
}

.user-chip__avatar {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--h-accent), #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    color: #fff;
    flex-shrink: 0;
}

/* Poza reala in chip (inlocuieste iconita) */
.user-chip__avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid rgba(255,255,255,0.35);
}

.user-chip__name {
    display: block;
    font-size: 0.825em;
    font-weight: 600;
    color: var(--h-text);
    line-height: 1.2;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip__role {
    display: block;
    font-size: 0.7em;
    color: var(--h-text-muted);
    line-height: 1.2;
}

/* Buton logout */
.btn-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--h-radius);
    color: #f87171;
    font-size: 0.875em;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--h-transition), border-color var(--h-transition), color var(--h-transition);
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    text-decoration: none;
}

/* Hamburger (ascuns pe desktop) */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: var(--h-bg-light);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    cursor: pointer;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    height: 2px;
    background: var(--h-text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
    transform-origin: center;
}

.hamburger span:nth-child(2) {
    width: 70%;
}

/* Animatie hamburger → X */
.hamburger.is-active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger.is-active span:nth-child(2) {
    opacity: 0;
    width: 0;
}
.hamburger.is-active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ------------------------------------------------------------
   Bell dropdown notificări
   ------------------------------------------------------------ */
.notif-bell-wrap {
    position: relative;
    flex-shrink: 0;
}

.notif-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--h-bg-light);
    border: 1px solid var(--h-border);
    border-radius: var(--h-radius);
    color: var(--h-text-muted);
    font-size: 1.05em;
    cursor: pointer;
    transition: background var(--h-transition), color var(--h-transition), border-color var(--h-transition);
}

.notif-bell-btn:hover {
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.3);
    color: #93c5fd;
}

.notif-bell-btn.has-notifs {
    color: var(--h-orange);
    border-color: rgba(245, 158, 11, 0.35);
    animation: bell-shake 3s ease infinite;
}

@keyframes bell-shake {
    0%, 80%, 100% { transform: rotate(0deg); }
    82%            { transform: rotate(12deg); }
    86%            { transform: rotate(-10deg); }
    90%            { transform: rotate(8deg); }
    94%            { transform: rotate(-5deg); }
}

.notif-bell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--h-red);
    color: #fff;
    font-size: 0.62em;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--h-bg);
}

/* Dropdown panel */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: #1a2840;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1100;
    overflow: hidden;
    animation: drop-in 0.18s ease;
}

@keyframes drop-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-dropdown__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.notif-dropdown__title {
    font-size: 0.875em;
    font-weight: 700;
    color: var(--h-text);
    display: flex;
    align-items: center;
    gap: 7px;
}

.notif-dropdown__title i {
    color: var(--h-orange);
}

.notif-dropdown__count {
    background: var(--h-red);
    color: #fff;
    font-size: 0.7em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 2px;
}

.notif-dropdown__empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    color: var(--h-text-muted);
    font-size: 0.85em;
}

.notif-dropdown__empty i {
    color: var(--h-green);
    font-size: 1.2em;
}

/* Lista preview */
.notif-dropdown__list {
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.notif-dropdown__list::-webkit-scrollbar { width: 4px; }
.notif-dropdown__list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Item notificare */
.notif-di {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: background var(--h-transition);
    cursor: pointer;
}

.notif-di:hover {
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}

.notif-di--unread {
    background: rgba(37, 99, 235, 0.06);
    border-left: 2px solid #2563eb;
    padding-left: 14px;
}

.notif-di--unread:hover {
    background: rgba(37, 99, 235, 0.1);
}

.notif-di__icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    flex-shrink: 0;
    margin-top: 1px;
}

.notif-di__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-di__title {
    font-size: 0.8em;
    font-weight: 600;
    color: var(--h-text);
    line-height: 1.35;
    display: block;
}

.notif-di__text {
    font-size: 0.74em;
    color: var(--h-text-muted);
    line-height: 1.35;
    display: block;
}

.notif-di__time {
    font-size: 0.7em;
    color: var(--h-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: 2px;
}

/* Footer link */
.notif-dropdown__footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 16px;
    font-size: 0.8em;
    font-weight: 600;
    color: #60a5fa;
    text-decoration: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    transition: background var(--h-transition), color var(--h-transition);
}

.notif-dropdown__footer:hover {
    background: rgba(37, 99, 235, 0.1);
    color: #93c5fd;
    text-decoration: none;
}

/* ------------------------------------------------------------
   Header guest (neautentificat)
   ------------------------------------------------------------ */
.site-header--guest .header-inner {
    justify-content: space-between;
}

.site-header--guest .site-brand {
    pointer-events: none;
}

.guest-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.guest-nav__link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem 1rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    color: #64748b;
    border: 1px solid transparent;
    transition: all .15s;
}
.guest-nav__link:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.guest-nav__link.is-active {
    color: #2563eb;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.guest-nav__link--urgenta {
    color: #dc2626;
    border-color: #fecaca;
    background: #fef2f2;
}

.guest-nav__link--urgenta:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.guest-nav__link--urgenta.is-active {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* Guest header — ascunde ceasul la ecrane medii unde nu mai incape */
@media (max-width: 1100px) {
    .site-header--guest .header-clock {
        display: none;
    }
}

@media (max-width: 900px) {
    .guest-nav {
        gap: .2rem;
    }
    .guest-nav__link {
        font-size: .8rem;
        padding: .4rem .6rem;
    }
}

/* Guest nav icon-only pe ecrane mici — text ascuns, iconița rămâne */
@media (max-width: 600px) {
    .guest-nav {
        gap: .15rem;
    }
    .guest-nav__link {
        font-size: 0;       /* ascunde textul */
        padding: .5rem .6rem;
    }
    .guest-nav__link i {
        font-size: 1rem;    /* iconița rămâne vizibilă */
    }
}

@media (max-width: 480px) {
    .guest-nav__link { padding: .45rem .55rem; }
    .guest-nav__link i { font-size: .95rem; }
}

/* ------------------------------------------------------------
   Responsive — Tablet (≤1024px)
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
    .nav-link span {
        display: none;
    }

    .nav-link {
        padding: 8px 10px;
    }

    .nav-link i {
        font-size: 1.1em;
    }

    .user-chip__info {
        display: none;
    }

    .btn-logout span {
        display: none;
    }

    .btn-logout {
        padding: 8px 10px;
    }
}

/* ------------------------------------------------------------
   Responsive — Mobil (≤768px)
   ------------------------------------------------------------ */
@media (max-width: 768px) {
    :root {
        --h-height: 60px;
    }

    .header-inner {
        padding: 0 16px;
        gap: 12px;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--h-height);
    }

    /* Nav devine dropdown */
    .site-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        order: 10;
        padding: 12px 0 16px;
        border-top: 1px solid var(--h-border);
        overflow-x: visible;
    }

    .site-nav.is-open {
        display: flex;
    }

    .nav-link {
        padding: 11px 14px;
        border-radius: 8px;
    }

    .nav-link span {
        display: inline;
    }

    .nav-link.is-active::after {
        display: none;
    }

    .nav-link.is-active {
        border-left: 3px solid #60a5fa;
        padding-left: 11px;
    }

    .hamburger {
        display: flex;
    }

    .header-clock {
        display: none;
    }

    .user-chip__info {
        display: block;
    }

    .btn-logout span {
        display: inline;
    }

    .brand-sub {
        display: none;
    }
}

/* ------------------------------------------------------------
   Responsive — Mobil mic (≤480px)
   ------------------------------------------------------------ */
@media (max-width: 480px) {
    .header-inner {
        padding: 0 12px;
    }

    .user-chip__name {
        max-width: 80px;
    }
}

/* ------------------------------------------------------------
   Notif dropdown — mobil portrait (≤600px)
   Pe ecrane înguste dropdown-ul devine fixed, full-width
   ------------------------------------------------------------ */
@media (max-width: 600px) {
    .notif-dropdown {
        position: fixed;
        top: 62px;   /* sub header (--h-height: 60px + 2px border) */
        left: 8px;
        right: 8px;
        width: auto;
        max-height: 75vh;
        overflow-y: auto;
        border-radius: 12px;
    }

    .notif-dropdown__list {
        max-height: none; /* scroll-ul îl gestionează părintele */
    }
}
