/* =========================================================
   Modules Menu UI Polish v1
   Shared by the public portfolio header and V8 admin topbar.
   ========================================================= */

.modules-launcher {
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
    font-family: inherit;
}

.modules-launcher > summary,
.modules-launcher-button {
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

.modules-launcher > summary::-webkit-details-marker,
.modules-launcher > summary::marker {
    display: none;
    content: "";
}

.modules-launcher-button {
    position: relative;
    isolation: isolate;
    min-height: 44px;
    padding: 5px 9px 5px 7px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(248, 184, 78, .24);
    border-radius: 13px;
    background:
        linear-gradient(135deg, rgba(248, 184, 78, .12), rgba(76, 213, 255, .055) 58%, rgba(169, 112, 255, .065)),
        rgba(8, 9, 15, .72);
    color: var(--text, #f4f1eb);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.035), 0 10px 30px rgba(0,0,0,.13);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: border-color .22s ease, background .22s ease, box-shadow .22s ease, transform .22s ease;
}

.modules-launcher-button::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -1px;
    border-radius: inherit;
    opacity: 0;
    background: linear-gradient(110deg, rgba(248,184,78,.18), transparent 44%, rgba(76,213,255,.12));
    transition: opacity .22s ease;
}

.modules-launcher-button:hover,
.modules-launcher-button:focus-visible,
.modules-launcher[open] > .modules-launcher-button {
    border-color: rgba(248, 184, 78, .52);
    background:
        linear-gradient(135deg, rgba(248, 184, 78, .17), rgba(76, 213, 255, .075) 58%, rgba(169, 112, 255, .09)),
        rgba(8, 9, 15, .9);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 15px 38px rgba(0,0,0,.24), 0 0 0 1px rgba(248,184,78,.035);
    outline: none;
}

.modules-launcher-button:hover::before,
.modules-launcher-button:focus-visible::before,
.modules-launcher[open] > .modules-launcher-button::before {
    opacity: 1;
}

.modules-launcher-button:active {
    transform: translateY(1px);
}

.modules-launcher-symbol {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(248,184,78,.27);
    border-radius: 10px;
    background: radial-gradient(circle at 28% 22%, rgba(255,220,151,.28), transparent 38%), rgba(248,184,78,.1);
    color: #ffc35a;
    box-shadow: inset 0 0 16px rgba(248,184,78,.065);
}

.modules-launcher-symbol svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.modules-launcher-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
    line-height: 1;
    text-align: start;
}

.modules-launcher-copy small {
    color: #9ca6b8;
    font: 700 7px/1.1 var(--font-latin, inherit);
    letter-spacing: .14em;
}

.modules-launcher-copy strong {
    color: #f7f4ed;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.01em;
}

.modules-launcher-count {
    min-width: 20px;
    height: 20px;
    padding-inline: 5px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 7px;
    background: rgba(255,255,255,.045);
    color: #d7deea;
    font: 750 9px/1 var(--font-latin, inherit);
}

.modules-launcher-chevron {
    width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    color: #7f8ba0;
    transition: transform .22s ease, color .22s ease;
}

.modules-launcher-chevron svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.modules-launcher[open] .modules-launcher-chevron {
    transform: rotate(180deg);
    color: #ffc35a;
}

.modules-panel {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 12px);
    inset-inline-end: 0;
    width: min(382px, calc(100vw - 24px));
    max-height: min(650px, calc(100vh - 110px));
    padding: 10px;
    overflow: hidden auto;
    border: 1px solid rgba(248,184,78,.23);
    border-radius: 19px;
    background:
        radial-gradient(circle at 8% 0%, rgba(248,184,78,.12), transparent 32%),
        radial-gradient(circle at 100% 18%, rgba(76,213,255,.075), transparent 31%),
        linear-gradient(155deg, rgba(12,14,23,.985), rgba(5,7,13,.99));
    color: #edf2f9;
    box-shadow: 0 30px 90px rgba(0,0,0,.64), inset 0 1px 0 rgba(255,255,255,.035);
    backdrop-filter: blur(24px) saturate(125%);
    -webkit-backdrop-filter: blur(24px) saturate(125%);
    transform-origin: top right;
    animation: modulesPanelIn .2s cubic-bezier(.22,.75,.22,1) both;
    scrollbar-width: thin;
    scrollbar-color: rgba(248,184,78,.35) transparent;
}

[dir="rtl"] .modules-panel {
    transform-origin: top left;
}

.modules-panel::-webkit-scrollbar { width: 7px; }
.modules-panel::-webkit-scrollbar-track { background: transparent; }
.modules-panel::-webkit-scrollbar-thumb { background: rgba(248,184,78,.28); border-radius: 999px; }

.modules-panel::before {
    content: "";
    position: absolute;
    top: -7px;
    inset-inline-end: 28px;
    width: 13px;
    height: 13px;
    border-top: 1px solid rgba(248,184,78,.23);
    border-inline-start: 1px solid rgba(248,184,78,.23);
    background: #0a0c14;
    transform: rotate(45deg);
}

.modules-panel-beam {
    position: absolute;
    top: 0;
    inset-inline: 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(248,184,78,.82), rgba(76,213,255,.45), transparent);
    opacity: .8;
    pointer-events: none;
}

.modules-panel-header {
    position: relative !important;
    inset: auto !important;
    min-height: 64px !important;
    margin: 0 0 7px !important;
    padding: 11px 12px 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,.075) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    backdrop-filter: none !important;
}

.modules-panel-header > div {
    min-width: 0;
    display: grid;
    gap: 6px;
}

.modules-panel-header small {
    display: block;
    color: #f4b94f;
    font: 750 8px/1 var(--font-latin, inherit);
    letter-spacing: .18em;
}

.modules-panel-header strong {
    display: block;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.02em;
}

.modules-panel-header > span {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(248,184,78,.2);
    border-radius: 10px;
    background: rgba(248,184,78,.08);
    color: #ffc55e;
    font: 800 10px/1 var(--font-latin, inherit);
}

.modules-panel-list {
    display: grid;
    gap: 5px;
}

.modules-panel-item {
    position: relative;
    min-width: 0;
    min-height: 62px;
    padding: 9px 10px;
    display: grid;
    grid-template-columns: 38px minmax(0,1fr) 24px;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 13px;
    color: #dbe3ef !important;
    text-decoration: none !important;
    overflow: hidden;
    transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease;
}

.modules-panel-item::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(92deg, rgba(248,184,78,.13), rgba(76,213,255,.055) 66%, transparent);
    transition: opacity .2s ease;
}

.modules-panel-item:hover,
.modules-panel-item:focus-visible,
.modules-panel-item.active {
    border-color: rgba(248,184,78,.16);
    background: rgba(255,255,255,.026);
    color: #fff !important;
    outline: none;
    transform: translateX(2px);
}

[dir="rtl"] .modules-panel-item:hover,
[dir="rtl"] .modules-panel-item:focus-visible,
[dir="rtl"] .modules-panel-item.active {
    transform: translateX(-2px);
}

.modules-panel-item:hover::before,
.modules-panel-item:focus-visible::before,
.modules-panel-item.active::before {
    opacity: 1;
}

.modules-panel-icon,
.modules-panel-copy,
.modules-panel-arrow {
    position: relative;
    z-index: 1;
}

.modules-panel-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
    color: #ffc257;
    font-size: 16px;
    font-weight: 800;
    box-shadow: inset 0 0 18px rgba(248,184,78,.035);
}

.modules-panel-item:hover .modules-panel-icon,
.modules-panel-item.active .modules-panel-icon {
    border-color: rgba(248,184,78,.25);
    background: rgba(248,184,78,.09);
}

.modules-panel-copy {
    min-width: 0;
    display: grid;
    gap: 5px;
    text-align: start;
}

.modules-panel-copy b {
    display: block;
    overflow: hidden;
    color: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modules-panel-copy small {
    display: -webkit-box;
    overflow: hidden;
    color: #7f8da4;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.35;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.modules-panel-arrow {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #68758b;
    font-size: 13px;
    font-style: normal;
    transition: color .2s ease, background .2s ease, transform .2s ease;
}

.modules-panel-item:hover .modules-panel-arrow,
.modules-panel-item.active .modules-panel-arrow {
    background: rgba(255,255,255,.045);
    color: #ffc45b;
    transform: translate(1px,-1px);
}

[dir="rtl"] .modules-panel-arrow,
[dir="rtl"] .modules-panel-footer i {
    transform: scaleX(-1);
}

[dir="rtl"] .modules-panel-item:hover .modules-panel-arrow,
[dir="rtl"] .modules-panel-item.active .modules-panel-arrow {
    transform: scaleX(-1) translate(1px,-1px);
}

.modules-panel-footer {
    position: static !important;
    margin: 8px 0 0 !important;
    padding: 8px 0 0 !important;
    display: block !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.075) !important;
    background: transparent !important;
}

.modules-panel-footer a {
    min-height: 43px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 31px minmax(0,1fr) 22px;
    align-items: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #b9c4d5 !important;
    text-decoration: none !important;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.modules-panel-footer a:hover,
.modules-panel-footer a:focus-visible {
    border-color: rgba(248,184,78,.15);
    background: rgba(248,184,78,.065);
    color: #fff !important;
    outline: none;
}

.modules-panel-footer a > span {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: rgba(255,255,255,.04);
    color: #f7bd52;
    font-size: 13px;
}

.modules-panel-footer b {
    min-width: 0;
    overflow: hidden;
    font-size: 11px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modules-panel-footer i {
    display: grid;
    place-items: center;
    color: #66758c;
    font-size: 12px;
    font-style: normal;
}

/* Public mobile navigation module group */
.mobile-modules-group {
    margin-top: 10px;
    padding: 17px 0 15px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.mobile-modules-group > small {
    grid-column: 1 / -1;
    padding: 0 2px 4px;
    color: #efb74f;
    font: 750 9px/1 var(--font-latin, inherit);
    letter-spacing: .16em;
}

.mobile-nav .mobile-modules-group > a {
    min-width: 0;
    min-height: 52px;
    padding: 10px 12px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid rgba(255,255,255,.065) !important;
    border-radius: 12px;
    background: rgba(255,255,255,.026);
    color: #e2e8f2;
    font-size: 12px !important;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0 !important;
}

.mobile-nav .mobile-modules-group > a:hover,
.mobile-nav .mobile-modules-group > a:focus-visible {
    border-color: rgba(248,184,78,.25) !important;
    background: rgba(248,184,78,.07);
    color: #fff;
}

.mobile-modules-group > a span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-modules-group > a i {
    flex: 0 0 auto;
    color: #7d899d;
    font-size: 12px;
    font-style: normal;
}

.mobile-nav .mobile-modules-group > .mobile-modules-admin {
    grid-column: 1 / -1;
    border-color: rgba(248,184,78,.15) !important;
    background: linear-gradient(90deg, rgba(248,184,78,.07), rgba(76,213,255,.025));
}

/* Admin-specific compact placement */
.modules-launcher--admin .modules-launcher-button {
    min-height: 42px;
    background:
        linear-gradient(135deg, rgba(248,184,78,.12), rgba(76,213,255,.05)),
        rgba(7,10,19,.78);
}

.modules-launcher--admin .modules-panel {
    top: calc(100% + 10px);
}

@keyframes modulesPanelIn {
    from { opacity: 0; transform: translateY(-7px) scale(.975); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 1280px) and (min-width: 1121px) {
    .site-header .modules-launcher-copy small { display: none; }
    .site-header .modules-launcher-button { gap: 7px; }
    .site-header .modules-launcher-count { display: none; }
}

@media (max-width: 1120px) {
    .site-header .site-modules-dropdown { display: none; }
}

@media (max-width: 900px) {
    .modules-launcher--admin .modules-launcher-button {
        width: 42px;
        min-width: 42px;
        padding: 5px;
        justify-content: center;
    }
    .modules-launcher--admin .modules-launcher-copy,
    .modules-launcher--admin .modules-launcher-count,
    .modules-launcher--admin .modules-launcher-chevron {
        display: none;
    }
    .modules-launcher--admin .modules-launcher-symbol {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
    .modules-launcher--admin .modules-panel {
        position: fixed;
        top: 68px;
        inset-inline: 12px;
        width: auto;
        max-height: calc(100vh - 82px);
    }
    .modules-launcher--admin .modules-panel::before { display: none; }
}

@media (max-width: 560px) {
    .mobile-modules-group { grid-template-columns: 1fr; }
    .modules-panel { width: calc(100vw - 18px); }
    .modules-panel-copy small { font-size: 8.5px; }
}

@media (prefers-reduced-motion: reduce) {
    .modules-panel { animation: none; }
    .modules-launcher-button,
    .modules-launcher-chevron,
    .modules-panel-item,
    .modules-panel-item::before,
    .modules-panel-arrow { transition: none; }
}

/* =========================================================
   Modules Menu UI Polish v1.1
   English desktop header spacing fix
   Keeps the Arabic/RTL layout unchanged.
   ========================================================= */
@media (min-width: 1281px) {
    html[dir="ltr"] .site-header .site-modules-dropdown .modules-launcher-button {
        padding: 5px 7px 5px 5px;
        gap: 6px;
    }

    html[dir="ltr"] .site-header .site-modules-dropdown .modules-launcher-symbol {
        width: 29px;
        height: 29px;
        flex-basis: 29px;
    }
}
