
/* --- 4. Layer List & Folders --- */
.layer-list {
    /* ارتفاع قابل للتخصيص عبر المتغير --layer-list-height.
       الشريط الموجود أسفل اللوحة يقوم بتحديث هذا المتغير. */
    height: var(--layer-list-height, 250px);
    max-height: 70vh;
    min-height: 120px;
    overflow-y: auto;
    background: transparent;
    border-bottom: 1px solid var(--border);
    resize: none;
}

/* شريط صغير أسفل قائمة الطبقات والوسائط يُستخدم لتمديد الارتفاع */
.layers-resize-handle {
    height: 6px;
    cursor: ns-resize;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.04) 0%,
        rgba(255,255,255,0.10) 50%,
        rgba(255,255,255,0.04) 100%
    );
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 3px;
    margin-top: 6px;
    position: relative;
    transition: background 0.15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.layers-resize-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 2px;
    background: rgba(255,255,255,0.28);
    border-radius: 2px;
    box-shadow: 0 3px 0 rgba(255,255,255,0.16);
}
.layers-resize-handle:hover {
    background: linear-gradient(
        to bottom,
        rgba(59,130,246,0.10) 0%,
        rgba(59,130,246,0.28) 50%,
        rgba(59,130,246,0.10) 100%
    );
}
.layers-resize-handle.active {
    background: linear-gradient(
        to bottom,
        rgba(59,130,246,0.15) 0%,
        rgba(59,130,246,0.45) 50%,
        rgba(59,130,246,0.15) 100%
    );
}
body.layers-resizing,
body.layers-resizing * {
    cursor: ns-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}
.layer-list::-webkit-scrollbar { width: 5px; }
.layer-list::-webkit-scrollbar-track { background: transparent; }
.layer-list::-webkit-scrollbar-thumb { background: #3a3d46; border-radius: 3px; }

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    position: relative;
    transition: background 0.1s;
}
.layer-item:hover {
    background: var(--bg-hover);
}
.layer-item.active {
    background: var(--bg-active);
    border-right: 3px solid var(--accent);
}
.layer-item.selected {
    background: rgba(99, 102, 241, 0.18) !important;
    border-right: 3px solid rgba(99, 102, 241, 0.5);
}
.layer-item.selected.active {
    background: rgba(99, 102, 241, 0.25) !important;
    border-right: 3px solid var(--accent);
}
.layer-item.media-item {
    border-left: 2px solid var(--media-bg);
}

.layer-item.folder-item {
    background: var(--bg-panel-alt);
    border-left: 3px solid var(--folder-bg);
}
.layer-item.folder-item.selected {
    background: rgba(59, 130, 246, 0.18) !important;
    border-right: 3px solid rgba(59, 130, 246, 0.5);
}
.layer-item.folder-item.active,
.layer-item.folder-item.selected.active {
    background: rgba(59, 130, 246, 0.25) !important;
    border-right: 3px solid var(--accent);
}
/* FIX v249: Persistent highlight for the active drawing page / layer,
   visible across all frames so the user always knows where strokes go. */
.layer-item.active-draw-page {
    background: rgba(34, 197, 94, 0.22) !important;
    border-right: 3px solid #22c55e !important;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.35);
}
.layer-item.active-draw-page::after {
    content: "✏";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #22c55e;
    pointer-events: none;
    opacity: 0.9;
}
.layer-item.active-draw-layer.folder-item {
    border-left: 3px solid #22c55e !important;
    background: rgba(34, 197, 94, 0.10) !important;
}
.layer-item.active-draw-layer.folder-item.selected {
    background: rgba(34, 197, 94, 0.22) !important;
}
.layer-indent { display: inline-block; width: 0; }
.folder-toggle {
    cursor: pointer;
    width: 15px;
    text-align: center;
    color: var(--text-dim);
    font-size: 10px;
}
.folder-toggle:hover { color: var(--text-bright); }
.drag-over-folder {
    border: 2px dashed var(--accent) !important;
    background: var(--accent-dim) !important;
}
.root-drop-zone {
    height: 32px;
    margin: 5px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 10px;
    cursor: default;
    transition: background 0.15s, border-color 0.15s;
}
.root-drop-zone.active-drop {
    background: var(--bg-hover);
    color: var(--text-bright);
    border-color: var(--accent);
}

.layer-vis {
    cursor: pointer;
    color: var(--text-dim);
    width: 20px;
    text-align: center;
    font-size: 14px;
    padding: 4px;
}
.layer-vis:hover { color: var(--text-bright); }

/* ── Layer Lock Button ── */
.layer-lock {
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 12px;
    flex-shrink: 0;
    color: var(--text-dim);
    opacity: 0.35;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    user-select: none;
}
.layer-lock:hover {
    opacity: 1;
    background: rgba(255,255,255,0.07);
    color: var(--text-bright);
}
.layer-lock.is-locked {
    opacity: 1;
    color: #f59e0b;
}
.layer-item.layer-is-locked {
    opacity: 0.7;
}
.layer-item.layer-is-locked .layer-name {
    text-decoration: line-through;
    text-decoration-color: rgba(245,158,11,0.45);
}

.layer-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
    font-size: 11px;
}
.layer-tag {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    pointer-events: none;
}

.layer-id-badge {
    flex-shrink: 0;
    font-size: 10px;
    line-height: 1.2;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 4px;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    direction: ltr;
}
.layer-id-badge.is-clone {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.08);
}

.layer-tag input {
    display: none;
}
.is-masked {
    border-left: 3px solid var(--mask-color);
    padding-left: 5px;
}

