
#edit-mode-switch {
    position: fixed;
    bottom: 12px;
    inset-inline-start: 12px;
    z-index: 99999;

    display: flex;
    align-items: center;
    gap: 10px;

    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    padding: 10px 14px;
    border-radius: 14px;

    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);

    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;

    transition: all .25s ease;
}

/* Label */
#edit-mode-switch label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

/* Checkbox reset */
#edit-mode-switch input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;

    width: 44px;
    height: 24px;
    background: #d1d1d1;
    border-radius: 999px;
    position: relative;
    outline: none;
    cursor: pointer;

    transition: background .25s ease;
}

/* Toggle knob */
#edit-mode-switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;

    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);

    transition: transform .25s ease;
}

/* ✅ ON state */
#edit-mode-switch input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #e53935, #ff6b6b);
}

#edit-mode-switch input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

/* Text */
#edit-mode-switch span {
    font-weight: 600;
    color: #333;
}

/* 🔴 Emphasis ring when edit mode is active */
#edit-mode-switch:has(input:checked) {
    box-shadow: 0 12px 35px rgba(229, 57, 53, 0.45),
    inset 0 0 0 1px rgba(229, 57, 53, 0.25);
}


#edit-mode-switch input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #e53935, #ff6b6b);
}

#edit-mode-switch input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}


.edit-mode-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    font-weight: 400;
}

.edit-mode-title {
    font-weight: 600;
    color: #222;
}

.edit-mode-help {
    font-size: 11px;
    color: #666;
    margin-top: 2px;

}

#edit-mode-switch label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
    font-size: 14px;
}

html[dir="ltr"] #edit-mode-switch label {
    flex-direction: row; /* toggle → text */
    text-align: left;
}


html[dir="rtl"] #edit-mode-switch label {
    flex-direction: row-reverse; /* text ← toggle */
    text-align: right;
}


html[dir="ltr"] .edit-mode-text {
    align-items: flex-start;
}


html[dir="rtl"] #edit-mode-switch {
    font-family: 'YekanBakhFaNum' !important;
}


.admin-section-wrapper {
    position: relative;
}

.admin-section-btn {
    position: absolute;
    bottom: 12px;
    inset-inline-end: 12px;
    z-index: 20;

    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 16px;
    text-decoration: none;
    backdrop-filter: blur(4px);
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.admin-section-btn:hover {
    opacity: 1;
}


/* ========== Admin Section Wrapper ========== */
.admin-section-wrapper {
    position: relative;
}

/* ========== Floating Admin Button ========== */
.admin-section-btn {
    position: absolute;
    inset-inline-end: 12px; /* RTL/LTR aware */
    bottom: 0;

    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;

    color: #fff;
    background: rgba(244, 67, 54, 1);

    border: 1px dashed rgba(244, 67, 54, 0.5);
    border-radius: 999px;

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);

    transition: opacity 0.25s ease,
    transform 0.25s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

/* Show only on section hover */
.admin-section-wrapper:hover .admin-section-btn {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Hover state */
.admin-section-btn:hover {
    background: rgba(244, 67, 54, 0.15);
    border-color: #e53935;
    color: #c62828;
}

/* Optional icon animation */
.admin-section-btn:hover {
    box-shadow: 0 6px 18px rgba(229, 57, 53, 0.25);
}

/* Mobile tweak */
@media (max-width: 768px) {
    .admin-section-btn {
        font-size: 12px;
        padding: 7px 12px;
    }
}

.edit-mode-lang select {
    background: transparent !important;
}


/* ==========================================================
   EDIT MODE WINDOW UI – ISOLATED & SAFE
   ========================================================== */

.edit-window-ui {
    position: fixed;
    bottom: 16px;
    inset-inline-start: 16px;
    z-index: 100000;
    width: 340px;
}

/* === WINDOW SHELL === */
.edit-window-ui #edit-mode-switch {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    border-radius: 18px;
    overflow: hidden;

    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);

    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* === HEADER === */
.edit-window-ui .edit-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 10px 14px;
    /*background: linear-gradient(135deg, #e53935, #ff6b6b);*/
    color: #fff;
    cursor: pointer;
}

.edit-window-ui .edit-window-title {
    font-size: 13px;
    font-weight: 600;
}

/* === CHEVRON BUTTON === */
.edit-window-ui .edit-window-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: rgba(244, 67, 54, 1);
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    transition: background .2s ease, transform .25s ease;
}

.edit-window-ui.collapsed .edit-window-btn {
    transform: rotate(180deg);
}

/* === BODY === */
.edit-window-ui .edit-window-body {
    padding: 14px 16px 16px;
    transition: max-height .35s ease, opacity .25s ease;
}

.edit-window-ui.collapsed .edit-window-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* === CONTENT === */
.edit-window-ui .edit-mode-main {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.edit-window-ui .edit-mode-text {
    display: flex;
    flex-direction: column;
}

.edit-window-ui .edit-mode-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.edit-window-ui .edit-mode-help {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

/* === SUB OPTIONS === */
.edit-window-ui .edit-mode-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-top: 8px;
}

/* === LANGUAGE SELECT === */
.edit-window-ui .edit-mode-lang {
    margin-top: 14px;
}

.edit-window-ui .edit-mode-lang select {
    width: 100%;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.9);
}

/* === RTL SUPPORT === */
html[dir="rtl"] .edit-window-ui {
    font-family: 'YekanBakhFaNum', system-ui, sans-serif;
}

html[dir="rtl"] .edit-window-ui .edit-mode-main,
html[dir="rtl"] .edit-window-ui .edit-mode-options label {
    flex-direction: row-reverse;
    text-align: right;
}

/* === ACTIVE EMPHASIS === */
.edit-window-ui:has(#edit-mode-toggle:checked) #edit-mode-switch {
    box-shadow: 0 20px 55px rgba(229, 57, 53, 0.45),
    inset 0 0 0 1px rgba(229, 57, 53, 0.25);
}

.edit-window-ui {
    width: 340px;
}

.edit-window-ui .edit-window-header-inner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.edit-window-ui.collapsed {
    width: auto;
}

/* Shrink wrap to header */
.edit-window-ui.collapsed #edit-mode-switch {
    width: fit-content;
}

/* Prevent body from affecting width */
.edit-window-ui.collapsed .edit-window-body {
    display: none;
}

.edit-window-ui {
    transition: width .25s ease;
}

.edit-window-ui #edit-mode-switch {
    transition: width .25s ease;
}
