/* Admin UI overrides — loaded after theme CSS */

/* Language switcher trigger — center flag in 38×38 circle button */
.main-header-language > a.nav-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    line-height: 1 !important;
}

/* Language flags: theme sets .main-header-language i { height: 40px } → oval */
.main-header-language i.flag,
.main-header-language .nav-link i.flag,
.main-header-language .dropdown-item i.flag,
.main-header-language button.dropdown-item i.flag {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    line-height: 1 !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center !important;
    display: block !important;
    flex-shrink: 0 !important;
    vertical-align: middle !important;
}

.main-header-language .nav-link i.flag {
    margin: 0 !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.main-header-language .dropdown-item i.flag,
.main-header-language button.dropdown-item i.flag {
    margin: 0 !important;
    margin-inline-end: 0.65rem !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.main-profile-menu .profile-user img {
    width: 37px !important;
    height: 37px !important;
    min-width: 37px !important;
    min-height: 37px !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
}

.login-page .login-lang-dropdown .flag,
.login-page .login-lang-dropdown .flag-lg {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center !important;
    flex-shrink: 0 !important;
}

/* Category tree (Sortiment) */
.category-tree-shell {
    border: 1px solid #e8e8f0;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #fff;
}

.category-tree-shell.has-reorder {
    --cat-tree-cols: 1.35rem 1.35rem minmax(0, 1fr) 4.25rem 5.75rem 9rem;
}

.category-tree-shell:not(.has-reorder) {
    --cat-tree-cols: 1.35rem minmax(0, 1fr) 4.25rem 5.75rem 9rem;
}

.category-tree-head,
.category-tree-row {
    display: grid;
    grid-template-columns: var(--cat-tree-cols);
    align-items: center;
    column-gap: 0.65rem;
    padding: 0.35rem 0.85rem;
}

.category-tree-head {
    background: #f5f6fa;
    border-bottom: 1px solid #e8e8f0;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #7b7b9a;
    min-height: 2rem;
}

.category-tree-head .category-tree-col-actions {
    text-align: right;
}

#category-tree-root,
#category-tree-root ul,
#category-tree-root li {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.category-tree-item {
    margin: 0;
}

.category-tree-row {
    min-height: 2.1rem;
    border-bottom: 1px solid #eef0f6;
    background: #fff;
    transition: background-color 0.12s ease;
}

.category-tree-item:last-child > .category-tree-row {
    border-bottom: 0;
}

.category-tree-row:hover {
    background: #f8f9fd;
}

.category-tree-row.is-inactive {
    opacity: 0.72;
}

.category-tree-row.is-inactive .category-tree-title {
    color: #8a8aa0;
}

.category-tree-cell {
    min-width: 0;
}

.category-tree-col-name {
    padding-inline-start: calc(var(--depth, 0) * 1.15rem);
}

.category-tree-title {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    color: #2d2d44;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-tree-meta {
    display: block;
    margin-top: 0.05rem;
    font-size: 0.68rem;
    line-height: 1.2;
    color: #9a9ab0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-tree-col-id code {
    font-size: 0.72rem;
    color: #7b7b9a;
    background: transparent;
    padding: 0;
}

.category-tree-col-status .badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.45rem;
}

.category-tree-col-actions {
    display: flex;
    justify-content: flex-end;
}

.category-tree-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.category-tree-row:hover .category-tree-actions,
.category-tree-row:focus-within .category-tree-actions {
    opacity: 1;
}

.category-tree-actions .btn {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.category-tree-actions .btn i {
    font-size: 0.78rem;
}

.category-tree-toggle {
    border: 0;
    background: transparent;
    color: #6f42c1;
    padding: 0;
    width: 1.2rem;
    height: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.category-tree-toggle:hover {
    color: #5936a0;
}

.category-drag-handle {
    cursor: grab;
    color: #b0b0c5;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.category-drag-handle:active {
    cursor: grabbing;
}

.category-tree-children {
    margin: 0;
    padding: 0;
    border: 0;
}

.category-tree-children.is-collapsed {
    display: none;
}

.category-tree-children > .category-tree-list > .category-tree-item > .category-tree-row {
    background: #fcfcff;
}

.sortable-ghost > .category-tree-row {
    background: rgba(111, 66, 193, 0.1) !important;
}

.sortable-chosen > .category-tree-row {
    background: rgba(111, 66, 193, 0.06);
}

.category-tree-search {
    min-width: 14rem;
    max-width: 24rem;
}

@media (max-width: 991.98px) {
    .category-tree-shell.has-reorder {
        --cat-tree-cols: 1.2rem 1.2rem minmax(0, 1fr) 3.5rem 5rem;
    }

    .category-tree-shell:not(.has-reorder) {
        --cat-tree-cols: 1.2rem minmax(0, 1fr) 3.5rem 5rem;
    }

    .category-tree-col-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-top: 0.1rem;
        padding-bottom: 0.15rem;
        padding-inline-start: calc(var(--depth, 0) * 1.15rem + 2.5rem);
    }

    .category-tree-actions {
        opacity: 1;
    }

    .category-tree-head .category-tree-col-actions {
        display: none;
    }
}

/* Locale editor tabs (category/product translations) */
.locale-editor-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.locale-editor-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid #dfe0ea;
    border-radius: 999px;
    background: #fff;
    color: #5c5c7a;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.locale-editor-tab:hover {
    border-color: #c9b8ef;
    background: #faf8ff;
    color: #4a3d6b;
}

.locale-editor-tab.is-active {
    background: #6f42c1;
    border-color: #6f42c1;
    color: #fff;
    box-shadow: 0 2px 10px rgba(111, 66, 193, 0.28);
}

.locale-editor-tab i.flag {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center !important;
    flex-shrink: 0 !important;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.locale-editor-tab.is-active i.flag {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.locale-editor-tab-code {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

.locale-editor-tab.is-active .locale-editor-tab-code {
    opacity: 0.9;
}

.locale-editor-tab-required {
    color: #e55353;
    font-weight: 700;
    line-height: 1;
}

.locale-editor-tab.is-active .locale-editor-tab-required {
    color: #ffd0d0;
}

.locale-editor-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    background: linear-gradient(90deg, #f7f2ff 0%, #faf8ff 100%);
    border: 1px solid #e8dcff;
    border-radius: 0.375rem;
}

.locale-editor-banner i.flag-lg {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 50% !important;
    background-size: cover !important;
    background-position: center !important;
    flex-shrink: 0 !important;
    box-shadow: 0 0 0 1px rgba(111, 66, 193, 0.15);
}

.locale-editor-banner-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #3d2d5c;
    line-height: 1.3;
}

.locale-editor-banner-subtitle {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: #8a7aa8;
    line-height: 1.3;
}

/* Admin: frontend template picker */
.frontend-template-picker {
    margin-top: 0.25rem;
}

.frontend-template-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    width: 100%;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid #dfe0ea;
    border-radius: 0.65rem;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    position: relative;
}

.frontend-template-option:hover {
    border-color: #c9b8ef;
    background: #fcfbff;
}

.frontend-template-option.is-selected {
    border-color: #6f42c1;
    background: linear-gradient(180deg, #faf7ff 0%, #fff 100%);
    box-shadow: 0 4px 16px rgba(111, 66, 193, 0.12);
}

.frontend-template-option.is-readonly {
    cursor: default;
}

.frontend-template-option.is-readonly:hover {
    border-color: #dfe0ea;
    background: #fff;
}

.frontend-template-option.is-readonly.is-selected:hover {
    border-color: #6f42c1;
    background: linear-gradient(180deg, #faf7ff 0%, #fff 100%);
}

.frontend-template-option-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.frontend-template-option-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.55rem;
    background: #f5f0ff;
    color: #6f42c1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.frontend-template-option-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.frontend-template-option-title {
    font-weight: 700;
    color: #2d2d44;
}

.frontend-template-option-desc {
    font-size: 0.8125rem;
    color: #7b7b9a;
    line-height: 1.4;
}

.frontend-template-option-check {
    margin-left: auto;
    color: #6f42c1;
    font-size: 1rem;
    line-height: 1;
}

button.two-factor-method-btn {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    text-align: left;
    background: #fff;
}

button.two-factor-method-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.two-factor-method-action {
    display: inline-block;
    margin-top: 0.65rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #6f42c1;
}

.two-factor-qr svg {
    max-width: 220px;
    height: auto;
}
