/* =====================
   IMPORT / EXPORT
   ===================== */
.io-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
    margin-bottom: 1rem; width: 100%;
}

.io-label {
    font-size: 0.70rem; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--muted); opacity: 0.7;
    padding: 16px 20px 16px;
    display: flex; align-items: center; min-height: 48px;
    border-bottom: 1px solid var(--border);
}

.io-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 20px; cursor: pointer; border-top: 1px solid var(--border);
    transition: background 0.15s; gap: 16px;
}

.io-row:first-of-type { border-top: none; }
.io-row:hover         { background: rgba(61,92,46,0.04); }
.io-row-left          { display: flex; flex-direction: column; gap: 2px; }
.io-row-title         { font-family: var(--font-title); font-size: 0.95rem; font-weight: 700; color: var(--text); }
.io-row-desc          { font-size: 0.68rem; font-style: italic; color: var(--muted); }
.io-icon              { font-size: 1.1rem; flex-shrink: 0; opacity: 0.7; }
.io-message           { font-size: 0.72rem; font-style: italic; padding: 0 20px 12px; min-height: 1.2rem; transition: color 0.2s; }
.io-message.success   { color: var(--green); }
.io-message.error     { color: var(--red); }

/* =====================
   CATEGORY EDITOR
   ===================== */
.editor-section { width: 100%; margin-bottom: 1.25rem; }

.editor-section-label {
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 0.5rem;
}

.editor-section-desc { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.5rem; }
.editor-section-desc code { background: rgba(61,92,46,0.08); padding: 1px 5px; border-radius: 4px; font-size: 0.75rem; }

.editor-input {
    width: 100%; padding: 0.7rem 0.9rem; border-radius: 0.75rem;
    border: 1px solid var(--border); background: var(--card);
    color: var(--text); font-size: 0.95rem; font-family: inherit;
    outline: none; transition: border-color 0.15s;
}

.editor-input:focus { border-color: var(--green); }

.editor-pair { display: flex; gap: 8px; }

.editor-textarea {
    width: 100%; min-height: 120px; padding: 0.7rem 0.9rem;
    border-radius: 0.75rem; border: 1px solid var(--border);
    background: var(--card); color: var(--text);
    font-size: 0.88rem; font-family: inherit; resize: vertical;
    outline: none; transition: border-color 0.15s; line-height: 1.6;
}

.editor-textarea:focus { border-color: var(--green); }

.editor-delete-btn {
    width: 100%; padding: 0.85rem; border-radius: 1rem;
    border: 1px solid rgba(184,92,40,0.3); background: none;
    color: var(--red); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: 0.2s;
}

.editor-delete-btn:hover { background: rgba(184,92,40,0.06); }

/* =====================
   EDITOR — WORD ROWS
   (first block — display & alignment)
   ===================== */
.editor-word-list {
    display: flex; flex-direction: column;
    border: 1px solid var(--border); border-radius: 0.75rem; overflow: hidden;
}

.editor-word-row {
    display: flex; align-items: center;
    padding: 0.6rem 0.9rem; gap: 8px;
    border-top: 1px solid var(--border);
}

.editor-word-row:first-child { border-top: none; }

.editor-word-en { flex: 1; font-size: 0.9rem; }
.editor-word-ar { flex: 1; font-size: 1rem; text-align: right; direction: rtl; }

.editor-word-del {
    width: 28px; height: 28px; display: flex;
    align-items: center; justify-content: center;
    border-radius: 50%; font-size: 0.75rem; color: var(--muted);
    background: none; border: none; cursor: pointer; transition: 0.15s; flex-shrink: 0;
}

.editor-word-del:hover { background: rgba(184,92,40,0.1); color: var(--red); }

/* =====================
   EDITOR — ICON BUTTONS & EXTENDED WORD ROWS
   (second block — overrides and additions for icon-button pattern)
   ===================== */
.editor-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    flex-shrink: 0;
}

.editor-icon-btn:disabled { opacity: 0.2; cursor: not-allowed; }

.editor-icon-btn.confirm { background: var(--green); color: white; border-color: var(--green); }
.editor-icon-btn.cancel  { background: var(--red); color: white; border-color: var(--red); }
.editor-icon-btn.delete  { color: var(--red); }
.editor-icon-btn.move    { font-size: 0.72rem; color: var(--muted); }

/* Extended word-row overrides */
.editor-word-row {
    padding: 10px 12px;
    border-top: none;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.editor-word-row:last-child { border-bottom: none; }

.editor-word-row.editing {
    background: var(--bg);
    padding: 12px;
    align-items: flex-start;
}

.editor-word-list {
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.editor-word-en { font-weight: 600; color: var(--text); }
.editor-word-ar { color: var(--muted); }

/* Icon palette */
.editor-icon-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.editor-icon-option {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--card);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.editor-icon-option:hover {
    border-color: var(--fern);
    background: rgba(141,184,122,0.1);
}

.editor-icon-option.active {
    border-color: var(--green);
    border-width: 2px;
    background: rgba(61,92,46,0.1);
}

/* =====================
   CATEGORY REORDERING
   ===================== */

/* Dragging state */
.lesson-card.custom.dragging {
    opacity: 0.4;
    transform: scale(0.97);
    transition: opacity 0.15s, transform 0.15s;
}

/* Drop target indicator */
.lesson-card.custom.drag-over {
    border-color: var(--green) !important;
    box-shadow: 0 0 0 2px rgba(61,92,46,0.2);
    transform: translateY(2px);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

/* ▲/▼ reorder arrow buttons */
.reorder-arrow-btn {
    width: 24px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--muted);
    font-size: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s;
    padding: 0;
    line-height: 1;
}

.reorder-arrow-btn:hover:not(:disabled) {
    border-color: var(--green);
    color: var(--green);
    background: rgba(61,92,46,0.06);
}

.reorder-arrow-btn:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

/* Reorder action button */
.btn-reorder {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 16px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-reorder:hover {
    border-color: var(--green);
    color: var(--green);
    background: rgba(61,92,46,0.06);
}

.btn-reorder.done {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.btn-reorder.done:hover {
    background: rgba(61,92,46,0.85);
    border-color: rgba(61,92,46,0.85);
    color: white;
}

/* Drag handle cursor on the whole card when not in reorder mode */
.lesson-card.custom[draggable="true"] {
    cursor: grab;
}

.lesson-card.custom[draggable="true"]:active {
    cursor: grabbing;
}