/* ============================================
   Global brand token
   ============================================ */
:root {
    --primary: #e78f08;
}

/* ============================================
   Page headers
   ============================================ */

/* Oldalcím (h1) */
.fi-header-heading {
    color: #e78f08 !important;
}

/* Topbar – vékony accent csík alul */
.fi-topbar {
    border-bottom: 2px solid rgba(231, 143, 8, 0.18) !important;
}

/* Section / card csoport fejlécek (form szekciók, table above-content) */
.fi-section-header-heading {
    color: #b87400 !important;
    border-left: 3px solid #e78f08 !important;
    padding-left: 0.5rem !important;
}

/* ============================================
   CRM Sidebar – Custom Design
   ============================================ */

/* Sidebar alap – finoman elválasztott háttér */
.fi-sidebar {
    background: linear-gradient(160deg, #f8f9fb 0%, #f1f3f7 100%) !important;
    border-right: 1px solid rgba(0, 0, 0, 0.07) !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04) !important;
}

/* Nav terület – kevesebb padding felül/alul */
.fi-sidebar-nav {
    padding-top: 1rem !important;
    padding-bottom: 1.5rem !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

/* Csoportok közt: tömörebb rés + vizuális elválasztó */
.fi-sidebar-nav-groups {
    gap: 0.25rem !important;
    margin: 0 !important;
}

.fi-sidebar-group {
    gap: 0.125rem !important;
}

/* Szeparátor csoportok közt */
.fi-sidebar-group + .fi-sidebar-group {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Csoportnév – uppercase + tracked betűk */
.fi-sidebar-group-btn {
    padding: 0.25rem 0.5rem 0.375rem !important;
    cursor: default;
}

.fi-sidebar-group-label {
    text-transform: uppercase !important;
    font-size: 0.78rem !important;
    letter-spacing: 0.1em !important;
    font-weight: 700 !important;
    color: #a3aabf !important;
}

/* Csoporton belüli itemek */
.fi-sidebar-group-items {
    gap: 0.1rem !important;
}

/* Nav item alap */
.fi-sidebar-item-btn {
    padding: 0.45rem 0.6rem !important;
    border-radius: 0.45rem !important;
    transition: background-color 0.12s ease, transform 0.08s ease !important;
}

.fi-sidebar-item-label {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
}

.fi-sidebar-item-btn > .fi-icon {
    color: #9ca3af !important;
    flex-shrink: 0;
}

/* Hover */
.fi-sidebar-item.fi-sidebar-item-has-url > .fi-sidebar-item-btn:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.fi-sidebar-item.fi-sidebar-item-has-url > .fi-sidebar-item-btn:hover .fi-icon {
    color: #6b7280 !important;
}

/* Aktív item – bal oldali accent sáv */
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: rgba(231, 143, 8, 0.1) !important;
    box-shadow: inset 3px 0 0 #e78f08 !important;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label {
    color: #92400e !important;
    font-weight: 600 !important;
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-icon {
    color: #e78f08 !important;
}

/* Collapse gomb a csoportfejléc mellé */
.fi-sidebar-group-collapse-btn {
    opacity: 0.4;
    scale: 0.85;
}

.fi-sidebar-group:hover .fi-sidebar-group-collapse-btn {
    opacity: 0.7;
}

/* Logo terület */
.fi-sidebar-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    margin-bottom: 0.25rem;
}

/* Footer szeparátor */
.fi-sidebar-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
    margin: 0 0.25rem 0.5rem !important;
    padding-top: 0.5rem;
}

/* Dark mode kiegészítések */
.dark .fi-sidebar {
    background: linear-gradient(160deg, #1a1d23 0%, #141720 100%) !important;
    border-right-color: rgba(255, 255, 255, 0.06) !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2) !important;
}

.dark .fi-sidebar-group + .fi-sidebar-group {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.dark .fi-sidebar-group-label {
    color: #4b5563 !important;
}

.dark .fi-sidebar-item-label {
    color: #d1d5db !important;
}

.dark .fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: rgba(231, 143, 8, 0.15) !important;
    box-shadow: inset 3px 0 0 #e78f08 !important;
}

.dark .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label {
    color: #f5b730 !important;
}

.dark .fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-icon {
    color: #e78f08 !important;
}

.dark .fi-sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
}

.dark .fi-sidebar-footer {
    border-top-color: rgba(255, 255, 255, 0.06) !important;
}

/* ============================================
   Globális zebra csíkozás – minden Filament táblára.
   Prioritásos sorok (wp-prio-*) felülírják, mert azok td-szinten élnek.
   ============================================ */
.fi-ta-row:nth-child(even) {
    background-color: rgba(231, 143, 8, 0.05) !important;
}

.dark .fi-ta-row:nth-child(even) {
    background-color: rgba(231, 143, 8, 0.05) !important;
}

/* TinyMCE modal z-index fix — dropdownok, dialógok megjelennek modal felett */
.tox-tinymce-aux {
    z-index: 99999 !important;
}

/* x-cloak helper (globálisan szükséges az Alpine-hoz) */
[x-cloak] { display: none !important; }

/* ============================================
   Menü kereső a sidebar nav tetején
   ============================================ */
.crm-menu-search-wrap {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.5rem 0.75rem 0.625rem;
    margin: 0 -1rem;
    padding-left: calc(0.75rem + 1rem);
    padding-right: calc(0.75rem + 1rem);
    background: #f8f9fb;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.crm-menu-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.crm-menu-search-icon {
    position: absolute;
    left: 0.6rem;
    width: 0.9rem;
    height: 0.9rem;
    color: #9ca3af;
    pointer-events: none;
    flex-shrink: 0;
}

.crm-menu-search-input {
    width: 100%;
    font-size: 0.8125rem;
    line-height: 1.25rem;
    padding: 0.4rem 1.75rem 0.4rem 2rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    color: #374151;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.crm-menu-search-input::placeholder {
    color: #a3aabf;
}

.crm-menu-search-input:focus {
    outline: none;
    border-color: rgba(231, 143, 8, 0.5);
    box-shadow: 0 0 0 3px rgba(231, 143, 8, 0.15);
}

.crm-menu-search-clear {
    position: absolute;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 999px;
    transition: color 0.12s ease, background 0.12s ease;
}

.crm-menu-search-clear svg {
    width: 0.75rem;
    height: 0.75rem;
}

.crm-menu-search-clear:hover {
    color: #e78f08;
    background: rgba(231, 143, 8, 0.1);
}

.crm-menu-search-empty {
    padding: 0.4rem 0.6rem 0;
    font-size: 0.75rem;
    font-style: italic;
    color: #a3aabf;
}

.dark .crm-menu-search-wrap {
    background: #1a1d23;
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.dark .crm-menu-search-input {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
}

.dark .crm-menu-search-input::placeholder {
    color: #4b5563;
}

.dark .crm-menu-search-icon {
    color: #6b7280;
}

.dark .crm-menu-search-clear {
    color: #6b7280;
}

.dark .crm-menu-search-empty {
    color: #4b5563;
}

/* Összecsukott (icon-rail) sidebar esetén a keresőnek csak az ikonja látszódjon,
   ugyanúgy ahogy a többi menüpont label-je is eltűnik ilyenkor. */
.fi-sidebar:not(.fi-sidebar-open) .crm-menu-search-wrap {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.fi-sidebar:not(.fi-sidebar-open) .crm-menu-search-field {
    justify-content: center;
}

.fi-sidebar:not(.fi-sidebar-open) .crm-menu-search-icon {
    position: static;
    width: 1rem;
    height: 1rem;
}

.fi-sidebar:not(.fi-sidebar-open) .crm-menu-search-input,
.fi-sidebar:not(.fi-sidebar-open) .crm-menu-search-clear,
.fi-sidebar:not(.fi-sidebar-open) .crm-menu-search-empty {
    display: none !important;
}

/* ============================================
   Mindent becsuk gomb a sidebar nav tetején
   ============================================ */
.crm-collapse-all-wrap {
    display: flex;
    justify-content: flex-end;
    padding: 0.125rem 0.75rem 0.5rem;
}

.crm-collapse-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #c8cfe0;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}

.crm-collapse-all-btn svg {
    width: 0.8rem;
    height: 0.8rem;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.crm-collapse-all-btn:hover {
    color: #e78f08;
    background: rgba(231, 143, 8, 0.08);
    border-color: rgba(231, 143, 8, 0.25);
}

.crm-collapse-all-btn:hover svg {
    transform: translateY(-1px);
}

.crm-collapse-all-btn:active {
    transform: scale(0.96);
}

.dark .crm-collapse-all-btn {
    color: #3d4557;
}

.dark .crm-collapse-all-btn:hover {
    color: #e78f08;
    background: rgba(231, 143, 8, 0.1);
    border-color: rgba(231, 143, 8, 0.2);
}

/* ============================================
   Globális scroll-to-top gomb
   ============================================ */

.crm-scroll-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: opacity 0.15s, box-shadow 0.15s, transform 0.1s;
}

.crm-scroll-top-btn:hover  { opacity: 0.85; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); transform: translateY(-1px); }
.crm-scroll-top-btn:active { transform: translateY(0); }

.crm-scroll-top-btn svg {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

/* ============================================
   Topbar user menu – monogram + név + nyíl
   ============================================ */

.crm-user-menu-trigger-topbar {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 0.5rem !important;
    transition: background-color 0.12s ease !important;
}

.crm-user-menu-trigger-topbar:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

.crm-user-menu-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-user-menu-chevron {
    width: 0.875rem;
    height: 0.875rem;
    color: #9ca3af;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .crm-user-menu-name {
        display: none;
    }
}

/* ============================================
   Userenkénti menüsorrend szerkesztő (sidebar-nav-order)
   ============================================ */
/* „Sorrend” + „Becsuk mind” egy sorban */
.crm-nav-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    padding: 0.125rem 0.75rem 0.5rem;
}

.crm-nav-toolbar .crm-collapse-all-wrap {
    padding: 0;
    margin-left: auto;
}

.crm-nav-order-bar {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1 1 100%;
    padding: 0.5rem 0.6rem;
    border: 1px dashed rgba(231, 143, 8, 0.5);
    border-radius: 0.5rem;
    background: rgba(231, 143, 8, 0.07);
}

.crm-nav-order-hint {
    font-size: 0.7rem;
    color: #e78f08;
}

.crm-nav-order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.crm-nav-order-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #c8cfe0;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.crm-nav-order-btn svg {
    width: 0.8rem;
    height: 0.8rem;
    flex-shrink: 0;
}

.crm-nav-order-btn:hover:not(:disabled) {
    color: #e78f08;
    background: rgba(231, 143, 8, 0.08);
    border-color: rgba(231, 143, 8, 0.25);
}

.crm-nav-order-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.crm-nav-order-btn-primary {
    color: #fff;
    background: #e78f08;
}

.crm-nav-order-btn-primary:hover:not(:disabled) {
    color: #fff;
    background: #cf7f06;
}

.dark .crm-nav-order-btn {
    color: #3d4557;
}

.dark .crm-nav-order-btn-primary {
    color: #fff;
}

/* Szerkesztő mód: keresés/„Becsuk mind” rejtve, húzható elemek jelölve */
.crm-nav-editing .crm-menu-search-wrap,
.crm-nav-editing .crm-collapse-all-wrap {
    display: none !important;
}

.crm-nav-editing .fi-sidebar-group-btn {
    cursor: grab;
}

.crm-nav-editing .fi-sidebar-group-collapse-btn {
    display: none;
}

.crm-nav-editing li.fi-sidebar-item[data-nav-key] {
    cursor: grab;
    outline: 1px dashed rgba(231, 143, 8, 0.35);
    outline-offset: -1px;
    border-radius: 0.375rem;
}

.crm-nav-editing .fi-sortable-ghost {
    opacity: 0.4;
}

/* Kiemelt toolbar-gombok („Sorrend” + „Becsuk mind”) — mindkét témában látható,
   narancs kontúr + halvány háttér, hoverre tömör narancs. Az előző, visszafogott
   szabályokat szándékosan felülírja (nagyobb specificitás). */
.crm-nav-toolbar .crm-nav-order-btn,
.crm-nav-toolbar .crm-collapse-all-btn {
    font-size: 0.72rem;
    font-weight: 800;
    color: #e78f08;
    background: rgba(231, 143, 8, 0.12);
    border: 1.5px solid rgba(231, 143, 8, 0.6);
    padding: 0.4rem 0.85rem;
    box-shadow: 0 1px 2px rgba(231, 143, 8, 0.18);
}

.crm-nav-toolbar .crm-nav-order-btn svg,
.crm-nav-toolbar .crm-collapse-all-btn svg {
    width: 0.95rem;
    height: 0.95rem;
}

.crm-nav-toolbar .crm-nav-order-btn:hover:not(:disabled),
.crm-nav-toolbar .crm-collapse-all-btn:hover {
    color: #fff;
    background: #e78f08;
    border-color: #e78f08;
    box-shadow: 0 2px 6px rgba(231, 143, 8, 0.35);
}

.crm-nav-toolbar .crm-nav-order-btn-primary {
    color: #fff;
    background: #e78f08;
    border-color: #e78f08;
}

.crm-nav-toolbar .crm-nav-order-btn-primary:hover:not(:disabled) {
    background: #cf7f06;
    border-color: #cf7f06;
}

/* Egy sorban maradjon a két gomb: nincs tördelés, szorosabb gombok.
   Csak szerkesztő módban törhet (a húzási sáv teljes sort kap). */
.crm-nav-toolbar {
    flex-wrap: nowrap;
    gap: 0.35rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.crm-nav-editing .crm-nav-toolbar {
    flex-wrap: wrap;
}

.crm-nav-toolbar .crm-nav-order-btn,
.crm-nav-toolbar .crm-collapse-all-btn {
    white-space: nowrap;
    letter-spacing: 0.04em;
    padding: 0.35rem 0.6rem;
    gap: 0.25rem;
}

.crm-nav-toolbar .crm-collapse-all-btn {
    flex-shrink: 0;
}

/* Szerkesztő mód: „Nyitva/Zárva indul” gomb a csoport fejlécében */
.crm-nav-collapse-toggle {
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    cursor: pointer;
    color: #e78f08;
    background: transparent;
    border: 1px solid rgba(231, 143, 8, 0.5);
}

.crm-nav-collapse-toggle.is-on {
    color: #fff;
    background: #e78f08;
    border-color: #e78f08;
}
