/* =========================================================
   MODERN USER PROFILE MENU
========================================================= */

.header-user-menu {
    position: relative;
    z-index: 1050;
}


/* =========================================================
   USER BUTTON
========================================================= */

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 10px;

    min-height: 48px;

    padding: 5px 11px 5px 5px;

    border: 1px solid rgba(255,255,255,.12);

    border-radius: 50px;

    background: rgba(255,255,255,.06);

    color: #fff;

    cursor: pointer;

    transition:
        background .25s ease,
        border-color .25s ease,
        box-shadow .25s ease,
        transform .25s ease;
}

.user-menu-toggle:hover {
    background: rgba(255,255,255,.12);

    border-color: rgba(156,238,105,.5);

    box-shadow:
        0 8px 25px rgba(0,0,0,.18);

    transform: translateY(-1px);
}


/* =========================================================
   AVATAR
========================================================= */

.header-user-avatar {
    width: 38px;
    height: 38px;

    flex-shrink: 0;

    overflow: hidden;

    border-radius: 50%;

    background: #f1f1f1;

    border: 2px solid rgba(156,238,105,.9);

    transition:
        transform .3s ease,
        box-shadow .3s ease;
}

.user-menu-toggle:hover .header-user-avatar {

    transform: scale(1.07);

    box-shadow:
        0 0 0 4px rgba(156,238,105,.12),
        0 5px 15px rgba(0,0,0,.2);

}

.header-user-avatar img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}


/* =========================================================
   USER TEXT
========================================================= */

.header-user-text {
    display: flex;

    flex-direction: column;

    align-items: flex-start;

    line-height: 1.1;
}

.header-user-name {
    max-width: 130px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-family: "Galdeano", sans-serif;

    font-size: 15px;

    font-weight: 600;

    color: #fff;
}

.header-user-role {
    margin-top: 3px;

    font-size: 10px;

    color: rgba(255,255,255,.58);
}


/* =========================================================
   CHEVRON
========================================================= */

.user-chevron {

    font-size: 11px;

    color: rgba(255,255,255,.7);

    transition:
        transform .3s ease,
        color .3s ease;
}

.header-user-menu.open .user-chevron {

    transform: rotate(180deg);

    color: #9cee69;
}


/* =========================================================
   DROPDOWN
========================================================= */

.header-user-dropdown {

    position: absolute;

    top: calc(100% + 12px);

    right: 0;

    width: 315px;

    padding: 8px;

    border-radius: 18px;

    background: rgba(255,255,255,.98);

    border: 1px solid rgba(0,0,0,.06);

    box-shadow:
        0 25px 70px rgba(0,0,0,.18),
        0 5px 20px rgba(0,0,0,.08);

    backdrop-filter: blur(18px);

    -webkit-backdrop-filter: blur(18px);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transform:
        translateY(-12px)
        scale(.96);

    transform-origin: top right;

    transition:
        opacity .25s ease,
        visibility .25s ease,
        transform .3s cubic-bezier(.2,.8,.2,1);

    /* keeps the dropdown scrollable instead of overflowing the
       viewport once it becomes a fixed panel on small screens */
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.header-user-menu.open .header-user-dropdown {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform:
        translateY(0)
        scale(1);
}


/* =========================================================
   PROFILE INFORMATION
========================================================= */

.header-user-info {

    display: flex;

    align-items: center;

    gap: 13px;

    padding: 13px 12px;
}

.header-user-avatar.large {

    width: 56px;
    height: 56px;

    border-width: 2px;

    box-shadow:
        0 6px 18px rgba(0,0,0,.12);
}


/* =========================================================
   USER DETAILS
========================================================= */

.header-user-details {

    display: flex;

    flex-direction: column;

    min-width: 0;
}

.header-user-details strong {

    max-width: 200px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-family: "Galdeano", sans-serif;

    font-size: 18px;

    font-weight: 700;

    color: #262626;
}

.header-user-details span {

    display: flex;

    align-items: center;

    gap: 5px;

    margin-top: 3px;

    font-size: 12px;

    color: #777;
}

.header-user-details span i {

    font-size: 7px;

    color: #7fd94e;
}


/* =========================================================
   DIVIDER
========================================================= */

.user-menu-divider {

    height: 1px;

    margin: 0 8px 7px;

    background: #eeeeee;
}


/* =========================================================
   MENU
========================================================= */

.user-dropdown-links {

    list-style: none;

    padding: 0;

    margin: 0;
}

.user-dropdown-links li {

    margin: 2px 0;
}

.user-dropdown-links li a {

    display: flex;

    align-items: center;

    gap: 11px;

    padding: 10px 9px;

    border-radius: 12px;

    text-decoration: none;

    color: #292929;

    transition:
        background .22s ease,
        transform .22s ease;
}

.user-dropdown-links li a:hover {

    background: #f2fbe9;

    transform: translateX(3px);
}


/* =========================================================
   ICON BOX
========================================================= */

.user-menu-icon {

    width: 38px;
    height: 38px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 10px;

    background: #f5f5f5;

    color: #555;

    font-size: 16px;

    transition:
        background .22s ease,
        color .22s ease,
        transform .22s ease;
}

.user-dropdown-links li a:hover .user-menu-icon {

    background: #9cee69;

    color: #1f2b18;

    transform: scale(1.05);
}


/* =========================================================
   MENU TEXT
========================================================= */

.user-dropdown-links li a > span:nth-child(2) {

    display: flex;

    flex-direction: column;

    flex: 1;

    font-size: 14px;

    font-weight: 600;
}

.user-dropdown-links li a small {

    display: block;

    margin-top: 2px;

    font-size: 10px;

    font-weight: 400;

    color: #999;
}


/* =========================================================
   MENU ARROW
========================================================= */

.menu-arrow {

    font-size: 11px;

    color: #aaa;

    transition:
        transform .22s ease,
        color .22s ease;
}

.user-dropdown-links li a:hover .menu-arrow {

    color: #6ebf3e;

    transform: translateX(3px);
}


/* =========================================================
   LOGOUT
========================================================= */

.user-dropdown-links .logout-item {

    margin-top: 5px;

    padding-top: 5px;

    border-top: 1px solid #eeeeee;
}

.logout-item a {

    color: #d9534f !important;
}

.logout-item .user-menu-icon {

    background: #fff1f0;

    color: #e25550;
}

.logout-item a:hover {

    background: #fff1f0 !important;
}

.logout-item a:hover .user-menu-icon {

    background: #e25550;

    color: #fff;
}



/* ---------------------------------------------------------
LARGE TABLETS / SMALL LAPTOPS  (≤ 1200px)
--------------------------------------------------------- */
@media (max-width: 1200px) {

    .header-user-dropdown {
        width: 300px;
    }
}


/* ---------------------------------------------------------
 TABLETS — LANDSCAPE  (≤ 991px)
--------------------------------------------------------- */
@media (max-width: 991px) {

    .header-user-dropdown {
        width: 290px;
        max-width: calc(100vw - 30px);
    }

    .header-user-text {
        display: none;
    }

    .user-menu-toggle {
        padding-right: 8px;
        gap: 0;
    }

    .header-user-avatar {
        width: 36px;
        height: 36px;
    }
}


/* ---------------------------------------------------------
 TABLETS — PORTRAIT / LARGE PHONES LANDSCAPE  (≤ 767px)
--------------------------------------------------------- */
@media (max-width: 767px) {

    .header-user-dropdown {
        top: calc(100% + 10px);
        width: 270px;
        padding: 6px;
        border-radius: 16px;
    }

    .header-user-info {
        padding: 11px 10px;
        gap: 11px;
    }

    .header-user-avatar.large {
        width: 50px;
        height: 50px;
    }

    .header-user-details strong {
        font-size: 16px;
        max-width: 160px;
    }

    .user-dropdown-links li a {
        padding: 11px 9px; /* slightly taller for touch targets */
    }

    .user-menu-icon {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .user-dropdown-links li a > span:nth-child(2) {
        font-size: 13px;
    }
}


/* ---------------------------------------------------------
   PHONES — PORTRAIT  (≤ 575px)

--------------------------------------------------------- */
@media (max-width: 575px) {

    .user-menu-toggle {
        min-height: 44px;
        padding: 4px 8px 4px 4px;
        gap: 8px;
    }

    .header-user-avatar {
        width: 34px;
        height: 34px;
    }

    .header-user-dropdown {
        position: fixed;
        top: 64px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        border-radius: 14px;
        transform: translateY(-8px) scale(.98);
    }

    .header-user-menu.open .header-user-dropdown {
        transform: translateY(0) scale(1);
    }

    .header-user-info {
        padding: 12px 8px;
    }

    .header-user-avatar.large {
        width: 46px;
        height: 46px;
    }

    .header-user-details strong {
        font-size: 15px;
        max-width: 140px;
    }

    .header-user-details span {
        font-size: 11px;
    }

    .user-dropdown-links li a {
        padding: 12px 8px; /* ≥44px tap target with icon+line-height */
        gap: 10px;
    }

    .menu-arrow {
        display: none; /* declutter on narrow screens */
    }
}


/* ---------------------------------------------------------
    SMALL PHONES  (≤ 400px)
--------------------------------------------------------- */
@media (max-width: 400px) {

    .header-user-dropdown {
        position: fixed;
        top: 60px;
        right: 10px;
        left: 10px;
        width: auto;
        padding: 6px;
    }

    .header-user-info {
        padding: 10px 6px;
        gap: 10px;
    }

    .header-user-avatar.large {
        width: 42px;
        height: 42px;
    }

    .header-user-details strong {
        font-size: 14px;
        max-width: 120px;
    }

    .user-menu-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
        border-radius: 9px;
    }

    .user-dropdown-links li a small {
        font-size: 9px;
    }
}


/* ---------------------------------------------------------
 EXTRA SMALL PHONES  (≤ 360px)
-------------------------------------------------------- */
@media (max-width: 360px) {

    .user-menu-toggle {
        padding: 3px 6px 3px 3px;
        gap: 6px;
    }

    .header-user-avatar {
        width: 30px;
        height: 30px;
        border-width: 1.5px;
    }

    .header-user-dropdown {
        top: 56px;
        right: 8px;
        left: 8px;
        padding: 5px;
        border-radius: 12px;
    }

    .header-user-details strong {
        font-size: 13px;
        max-width: 100px;
    }

    .user-dropdown-links li a {
        padding: 10px 6px;
        gap: 8px;
    }
}



@media (hover: none) and (pointer: coarse) {

    .user-menu-toggle:hover {
        transform: none;
    }

    .user-dropdown-links li a:hover {
        transform: none;
    }

    .user-dropdown-links li a:hover .menu-arrow {
        transform: none;
    }

    .user-dropdown-links li a:active {
        background: #f2fbe9;
    }

    .logout-item a:active {
        background: #fff1f0 !important;
    }
}