/* styles/creator.css Версия 23.0: Fix Scrolling Issue */

:root {
    --primary: #6c5ce7;       /* Основной фиолетовый */
    --primary-hover: #5b4cc4;
    --accent: #00b894;        /* Зеленый для действий */
    --bg-app: #dfe6e9;        /* Фон приложения */
    --bg-panel: #ffffff;      /* Фон панелей */
    --text-dark: #2d3436;
    --text-light: #636e72;
    --border: #b2bec3;
    --shadow: 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --danger-color: #e74c3c;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-dark);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === HEADER === */
header {
    background: var(--primary);
    color: white;
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.button-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.button-outline:hover {
    background: rgba(255,255,255,0.1);
}

/* === LAYOUT === */
.dashboard-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid #dcdde1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    justify-content: space-between;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f2f6;
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: 1rem;
    margin: 0;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 10px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.nav-back-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: bold;
}

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.space-item {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
    color: var(--text-dark);
}

.space-item:hover {
    background-color: #f1f2f6;
}

.space-item.active {
    background-color: #e3f2fd;
    color: #2980b9;
    font-weight: 500;
}

.folder-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary);
    padding: 5px;
    border-radius: 4px;
}
.icon-btn:hover { background: #eee; }

/* Сайдбар Футер */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fdfdfd;
    margin-top: auto;
    flex-shrink: 0;
}

/* Форма в сайдбаре */
.sidebar-form {
    padding: 15px;
    background: #f1f2f6;
    border-top: 1px solid #dcdde1;
    flex-shrink: 0;
}

.sidebar-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

.form-actions { display: flex; gap: 5px; }

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    background-color: #f4f6f8;
    overflow: hidden;
    padding: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* WELCOME SCREEN */
.welcome-screen {
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.welcome-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    max-width: 800px;
    width: 100%;
    text-align: center;
}

.welcome-card h2 { margin-top: 0; color: var(--primary); font-size: 2rem; }
.subtitle { font-size: 1.1rem; color: var(--text-light); margin-bottom: 40px; }

/* Guided onboarding tour */
.creator-tour-active .creator-tour-highlight {
    position: relative;
    z-index: 3301 !important;
    outline: 4px solid rgba(253, 219, 58, 0.95);
    box-shadow: 0 0 0 10px rgba(253, 219, 58, 0.28), 0 14px 34px rgba(0, 0, 0, 0.24) !important;
    border-radius: 14px;
}

.creator-tour-tooltip {
    position: fixed;
    z-index: 3302;
    width: min(360px, calc(100vw - 28px));
    padding: 16px 18px;
    border-radius: 18px;
    background: #ffffff;
    color: var(--text-dark);
    box-shadow: 0 20px 48px rgba(20, 28, 45, 0.28);
    border: 1px solid rgba(108, 92, 231, 0.18);
}

.creator-tour-tooltip h3 {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 1.05rem;
}

.creator-tour-tooltip p {
    margin: 0;
    color: var(--text-light);
    line-height: 1.45;
    font-size: 0.95rem;
}

.creator-tour-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 14px;
}

.creator-tour-actions .button {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    text-align: left;
}

.instruction-item .icon { font-size: 2.5rem; margin-bottom: 10px; }
.instruction-item h3 { margin: 0 0 10px 0; color: var(--text-dark); }
.instruction-item p { margin: 0; color: var(--text-light); font-size: 0.95rem; line-height: 1.5; }

/* GRID VIEW */
#sets-grid-view { 
    display: flex; 
    flex-direction: column; 
    height: 100%; 
    width: 100%; 
    overflow: hidden; /* Предотвращаем скролл на уровне view */
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
}
.grid-header h2 { margin: 0; font-size: 1.5rem; }
.grid-actions { display: flex; gap: 10px; }
.search-input { padding: 8px 15px; border-radius: 20px; border: 1px solid #ccc; width: 250px; }

/* ИСПРАВЛЕНИЕ СКРОЛЛА: Добавляем стили для контейнера #word-sets-list */
#word-sets-list {
    flex: 1;                /* Занимаем всё оставшееся место */
    overflow-y: auto;       /* Включаем вертикальный скролл */
    min-height: 0;          /* Фикс для Flexbox, чтобы скролл работал */
    padding-bottom: 40px;   /* Отступ снизу */
}

.sets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    /* overflow-y: auto;  <-- УБРАНО: Скроллить должен родитель #word-sets-list */
    padding-bottom: 20px;
}

.grid-section-title {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    margin-top: 10px;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
}

/* CARDS */
.folder-card, .set-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    overflow: visible;
    position: relative;
}

.folder-card {
    display: flex;
    align-items: center;
    padding: 15px;
    height: 80px;
}
.folder-card:hover, .set-card:hover { transform: translateY(-3px); border-color: var(--primary); }

.folder-card-icon { font-size: 2rem; margin-right: 15px; color: #f39c12; }
.folder-card-info { flex: 1; min-width: 0; }
.folder-card-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-card-subtitle { font-size: 0.8rem; color: #999; }

.set-card {
    display: flex;
    flex-direction: column;
    height: 220px;
}

.card-color-strip { height: 6px; width: 100%; border-radius: 12px 12px 0 0; }
.card-content { padding: 15px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-desc {
    font-size: 0.85rem;
    color: #95a5a6;
    margin-bottom: 12px;
    height: 2.4em;
    line-height: 1.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-preview-box {
    flex: 1;
    background: #f9f9f9;
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    overflow: hidden;
    min-height: 80px;
}

.mini-thumb {
    width: 100%;
    height: 100%;
    background-color: #eee;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.mini-thumb.empty { background-color: #f1f2f6; }

/* === DROPDOWN MENUS === */
.card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.menu-btn {
    background: rgba(255,255,255,0.9);
    border: 1px solid #eee;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    color: #666;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background 0.2s;
}
.menu-btn:hover { background: #fff; color: var(--primary); }

.dropdown-menu {
    position: absolute;
    top: 35px;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    min-width: 180px;
    display: none;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    border: 1px solid #eee;
}

.dropdown-menu.show { display: flex; }

.dropdown-item {
    padding: 10px 15px;
    font-size: 0.9rem;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.1s;
}
.dropdown-item:hover { background: #f4f6f8; color: var(--primary); }
.dropdown-item.danger { color: var(--danger-color); border-top: 1px solid #eee; }
.dropdown-item.danger:hover { background: #fff0f0; }

/* EDITOR PANEL */
.editor-panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.editor-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 20px;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

.header-inputs { display: flex; flex: 1; gap: 20px; }
.input-group { display: flex; flex-direction: column; flex: 1; }
.input-group label { font-size: 0.75rem; color: #95a5a6; text-transform: uppercase; font-weight: 700; margin-bottom: 4px; letter-spacing: 0.5px; }

.editor-title-input, .editor-desc-input {
    border: 1px solid #eee;
    padding: 8px 10px;
    border-radius: 6px;
    width: 100%;
    background: #fdfdfd;
    box-sizing: border-box;
}
.editor-title-input { font-size: 1.2rem; font-weight: 600; }
.editor-desc-input { font-size: 0.95rem; color: #666; }
.editor-title-input:focus, .editor-desc-input:focus { border-color: var(--primary); outline: none; background: #fff; }

.launch-set-cta {
    margin: 12px 20px 0;
    padding: 12px 14px;
    border: 1px solid #d8f2e9;
    border-radius: 12px;
    background: #f2fffb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.launch-set-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.launch-set-copy strong {
    color: #17664f;
    font-size: 0.98rem;
}

.launch-set-copy span {
    color: #52665f;
    font-size: 0.88rem;
}

.editor-toolbar { padding: 10px 20px; background: #f8f9fa; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; gap: 10px; flex-wrap: wrap; }
.toolbar-left { display: flex; align-items: center; }
.toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.mini-search { padding: 6px 12px; border-radius: 15px; border: 1px solid #ccc; width: 200px; }
.display-switcher { display: flex; gap: 6px; align-items: center; }
.display-switcher .display-toggle { border: 1px solid #dfe3f0; background: #f8f9ff; color: #3c4560; padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease; }
.display-switcher .display-toggle.active { background: #1f5cc6; color: #fff; border-color: #1f5cc6; }
.selection-toolbar { display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: #fff; border: 1px solid #e6e9ee; border-radius: 999px; box-shadow: var(--shadow); flex-wrap: wrap; }
.selection-count { font-size: 0.85rem; color: #5f6b7a; min-width: 88px; text-align: center; }

/* TABLE */
.table-container { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.table-header { display: flex; padding: 10px 20px; background: #f1f1f1; font-weight: bold; color: #666; position: sticky; top: 0; z-index: 10; align-items: center; }
.col-select { width: 34px; text-align: center; }
.col-img { width: 60px; text-align: center; }
.col-text { flex: 1; padding-left: 15px; }
.col-actions { width: 420px; text-align: right; }

.word-item { display: flex; align-items: center; padding: 8px 20px; border-bottom: 1px solid #f9f9f9; gap: 10px; }
.word-item:hover { background-color: #f8fbff; }
.word-item.selected { background-color: #eef6ff; }
.word-item-select { width: 34px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.word-select-checkbox { width: 16px; height: 16px; cursor: pointer; }
.word-item-images { display: flex; gap: 6px; flex-shrink: 0; }
.word-item-image { width: 50px; height: 50px; border-radius: 6px; overflow: hidden; background: #eee; flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 1px solid #eee; position: relative; padding: 0; color: inherit; }
.word-item-image img { width: 100%; height: 100%; object-fit: cover; }
.word-image-badge { position: absolute; top: 2px; left: 2px; z-index: 2; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: rgba(17, 24, 39, 0.78); color: #fff; font-size: 0.62rem; font-weight: 800; line-height: 16px; }
.word-item-text { flex: 1; display: flex; gap: 10px; padding-left: 15px; }
.word-item-text input { border: 1px solid transparent; background: transparent; padding: 5px; font-size: 1rem; width: 100%; border-radius: 4px; }
.word-item-text input:focus { background: white; border-color: var(--primary); outline: none; }
.word-item-actions { width: 420px; text-align: right; display: flex; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.word-listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 108px;
    justify-content: center;
}
.word-record-btn,
.word-stop-btn,
.word-delete-audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}
.word-record-btn {
    min-width: 108px;
}
.word-stop-btn {
    min-width: 90px;
}
.word-delete-audio-btn {
    min-width: 42px;
    padding-left: 10px;
    padding-right: 10px;
}
.word-listen-btn.is-playing {
    opacity: 0.85;
}
.word-record-btn.is-recording,
.word-item.is-recording .word-record-btn {
    border-color: #cf5b5b;
    background: #fff0f0;
    color: #a43737;
}
.word-delete-audio-btn.is-hidden {
    display: none;
}
.word-item-actions .word-move-btn { font-size: 1rem; line-height: 1; }
.word-item.hide-text .word-item-text { display: none; padding-left: 0; }
.word-item.hide-image .word-item-images { display: none !important; width: 0; margin-right: 0; }

.editor-footer { padding: 15px 20px; border-top: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; background: #fff; }
.tags-wrapper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tags-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: min(56vw, 620px); }
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #38468b;
    font-size: 0.82rem;
    border: 1px solid #d7defb;
}
.tag-remove-btn {
    border: none;
    background: transparent;
    color: #8d3f3f;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0;
}
.tag-remove-btn:hover { color: #d63031; }
.tag-input { width: 120px; padding: 5px; border-radius: 4px; border: 1px solid #ccc; }
.text-link { background: none; border: none; color: #999; cursor: pointer; text-decoration: underline; font-size: 0.9rem; }

/* === UI ELEMENTS === */
.button { background: var(--primary); color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 500; transition: all 0.2s; font-size: 0.95rem; }
.button:hover { background: var(--primary-hover); transform: translateY(-1px); }
.button:disabled { background-color: #bdc3c7; cursor: not-allowed; transform: none; opacity: 0.7; }

.button-large { font-size: 1.1rem; padding: 15px 30px; border-radius: 30px; box-shadow: 0 5px 15px rgba(108, 92, 231, 0.3); }
.button-ghost { background: transparent; color: var(--text-light); border: 1px solid #ccc; }
.button-ghost:hover { background: #eee; color: var(--text-dark); }
.button-sm { padding: 5px 10px; font-size: 0.85rem; }
.button-accent { background: var(--accent); }
.button-accent:hover { background: #00a383; }
.button-danger { background: var(--danger-color); color: white; }
.button-w-full { width: 100%; text-align: center; justify-content: center; padding: 10px; font-size: 0.95rem; font-weight: 600; }

/* === MODALS === */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}
.image-modal-content {
    max-width: min(760px, calc(100vw - 32px));
    width: 760px;
}

.modal-header-custom { background: var(--primary); color: white; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; }
.modal-header-custom h2 { margin: 0; font-size: 1.2rem; color: white; }
.close-button { font-size: 24px; cursor: pointer; color: rgba(255,255,255,0.8); line-height: 1; }
.close-button:hover { color: white; }

.modal-tabs { display: flex; gap: 12px; padding: 0 20px; border-bottom: 1px solid #eee; background: #fff; flex-shrink: 0; overflow-x: auto; }
.tab-link { background: none; border: none; padding: 15px 5px; cursor: pointer; font-weight: 500; color: #95a5a6; border-bottom: 3px solid transparent; transition: all 0.2s; font-size: 1rem; }
.tab-link:hover { color: var(--primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

.modal-body-scroll { overflow-y: auto; padding: 20px; background: #fff; flex: 1; }
.modal-footer-custom { padding: 15px 20px; background: #fff; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* File Upload */
.file-upload-wrapper { display: flex; align-items: center; background: #f9f9f9; padding: 30px 20px; border-radius: 8px; border: 2px dashed #e0e0e0; flex-direction: column; gap: 15px; text-align: center; }
.file-btn-solid { background: var(--primary); color: white; padding: 10px 25px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 1rem; display: inline-block; transition: background 0.2s, transform 0.1s; box-shadow: 0 4px 6px rgba(108, 92, 231, 0.2); }
.file-btn-solid:hover { background: var(--primary-hover); transform: translateY(-1px); }
.upload-workflow {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(210px, 0.75fr);
    gap: 18px;
    align-items: stretch;
}
.upload-workflow__preview,
.upload-workflow__controls {
    padding: 14px;
    border: 1px solid #e4e8f0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff, #f2f5fb);
}
.upload-preview-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    height: min(42vh, 340px);
    min-height: 220px;
    overflow: hidden;
    border-radius: 10px;
    color: #7b8494;
    text-align: center;
    background:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-color: #fff;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}
.upload-preview-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.upload-workflow__controls {
    display: flex;
    align-items: center;
}
.upload-workflow__state {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 12px;
}
.upload-workflow__state p {
    margin: 0;
    color: #586276;
    line-height: 1.45;
}
.upload-workflow__state .button,
.upload-workflow__state .file-btn-solid {
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    text-align: center;
}
.upload-confirm-button {
    background: #28a745;
    color: #fff;
}
.upload-confirm-button:hover { background: #218838; }
.upload-file-name {
    overflow-wrap: anywhere;
    color: #333;
    font-size: 0.9rem;
    text-align: center;
}
.upload-choose-again {
    padding: 8px;
    color: var(--primary);
    font-weight: 700;
    text-align: center;
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 680px) {
    .upload-workflow { grid-template-columns: 1fr; }
    .upload-preview-frame {
        height: min(32vh, 260px);
        min-height: 180px;
    }
}

/* Image Grid */
.current-image-preview {
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid #e4e8f0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff, #f2f5fb);
}
.current-image-preview__label {
    margin-bottom: 8px;
    color: #586276;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.current-image-preview a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    max-height: 320px;
    border-radius: 10px;
    background:
        linear-gradient(45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eef2f7 75%),
        linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
    background-color: #fff;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
    overflow: hidden;
}
.current-image-preview img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
}
.image-results-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 15px;
}
.image-result-card {
    display: grid;
    grid-template-rows: auto minmax(0, auto) auto;
    gap: 5px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}
.search-result-img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    max-height: none;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    background: #eef2f7;
    transition: transform 0.1s, border-color 0.1s;
}
.image-result-card:hover .search-result-img, .search-result-img:hover { border-color: var(--primary); transform: scale(1.03); }
.image-result-caption { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #34495e; font-size: 0.78rem; font-weight: 700; }
.image-result-meta { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #8a8f9d; font-size: 0.7rem; }
.image-search-empty { grid-column: 1 / -1; color: #8a8f9d; font-size: 0.95rem; padding: 16px 0; text-align: center; }
.image-generate-panel {
    display: grid;
    gap: 10px;
}
.image-generate-label {
    color: #34495e;
    font-weight: 800;
    font-size: 0.82rem;
}
.image-generate-status {
    min-height: 22px;
    margin: 0;
    color: #687386;
    font-size: 0.9rem;
}
@media (max-width: 640px) {
    .image-modal-content {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
    }
    .image-results-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
    .image-result-caption,
    .image-result-meta {
        font-size: 0.66rem;
    }
}

/* === INFO & BATCH HELP === */
.input-with-icon { display: flex; align-items: center; gap: 10px; width: 100%; }
.input-with-icon input { flex: 1; }

.info-icon {
    background: white; border: 1px solid var(--danger-color); color: var(--danger-color);
    width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: bold; cursor: pointer; font-size: 0.9rem; transition: all 0.2s; flex-shrink: 0;
}
.info-icon:hover { background: var(--danger-color); color: white; }

.info-text-content { line-height: 1.6; color: #444; font-size: 0.95rem; }
.info-text-content strong { color: #2c3e50; }

/* Batch Info Box */
.batch-info-box { background-color: #f0f7ff; border: 1px solid #d0e3f0; border-radius: 8px; padding: 15px; font-size: 0.9rem; color: #34495e; margin-bottom: 10px; }
.batch-info-box h4 { margin: 0 0 8px 0; color: var(--primary); font-size: 1rem; }
.batch-info-box p { margin: 0 0 10px 0; line-height: 1.4; }
.batch-example { margin-bottom: 10px; }
.example-label { font-weight: 600; font-size: 0.8rem; color: #7f8c8d; display: block; margin-bottom: 2px; }
.code-block { background: #fff; border: 1px solid #e0e0e0; padding: 6px 10px; border-radius: 4px; font-family: 'Consolas', 'Monaco', monospace; font-size: 0.85rem; color: #e74c3c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-note { font-style: italic; color: #27ae60; font-weight: 500; margin-top: 5px !important; }

/* Batch Help Modal specific */
#batch-help-modal { z-index: 3200 !important; background: rgba(0, 0, 0, 0.3); }
.batch-help-content { line-height: 1.6; color: #333; font-size: 0.95rem; }
.code-box { background: #f4f6f8; border: 1px solid #dcdde1; border-radius: 6px; padding: 10px; font-family: monospace; color: #c0392b; margin: 5px 0 15px 0; white-space: pre-wrap; word-break: break-word; }

/* Help Modal z-index fix */
#field-info-modal { z-index: 3000 !important; background: rgba(0, 0, 0, 0.2); }
#field-info-modal .modal-content { box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 1px solid var(--primary); }

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 3900;
    display: none;
}
.sidebar-overlay.active { display: block; }

/* Select Folder Modal List */
.folder-selection-list { max-height: 300px; overflow-y: auto; text-align: left; }
.folder-selection-item { padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; display: flex; align-items: center; }
.folder-selection-item:hover { background: #f0f8ff; }
.folder-selection-item.selected { background: #e3f2fd; color: var(--primary); font-weight: bold; }

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    #mobile-menu-btn { display: block !important; border:none; background:none; font-size:1.5rem; cursor:pointer; }
    .mobile-sidebar-close { display: block !important; }
    
    .sidebar {
        position: fixed; top: 0; left: -100%; width: 85%; height: 100vh;
        z-index: 4000; transition: left 0.3s ease;
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
    }
    .sidebar.open { left: 0; }

    .sets-grid-container {
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow: hidden;
    }

    .folders-row {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px;
        background: #f4f6f8;
        border-bottom: 1px solid #eee;
        flex-shrink: 0;
        gap: 10px;
        -webkit-overflow-scrolling: touch;
        position: sticky; top:0; z-index: 10;
    }
    
    .folders-row .folder-card {
        min-width: 140px;
        width: 140px;
        height: 60px;
        display: inline-flex;
        margin: 0;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    
    .sets-row {
        padding: 15px;
        overflow-y: auto;
        flex: 1;
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .set-card {
        height: auto;
        min-height: 180px;
    }

    .main-content { padding: 8px; }
    .editor-panel { border-radius: 10px; }
    .editor-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; }
    .header-inputs { width: 100%; flex-direction: column; gap: 10px; }
    .launch-set-cta { flex-direction: column; align-items: stretch; margin: 8px; }
    .launch-set-cta .button { text-align: center; }
    .editor-toolbar { padding: 10px 8px; }
    .toolbar-left { width: 100%; min-width: 0; }
    .mini-search { width: auto; min-width: 0; flex: 1; box-sizing: border-box; }
    #set-stats { flex-shrink: 0; white-space: nowrap; }
    .toolbar-right { width: 100%; justify-content: flex-start; }
    .table-header { display: none; }
    .table-container { overflow-x: hidden; }
    #words-table-body { width: 100%; padding: 8px; box-sizing: border-box; }
    
    .word-item {
        display: grid;
        grid-template-columns: 28px minmax(0, 1fr);
        grid-template-areas:
            "select text"
            ". img"
            ". actions";
        gap: 10px 8px;
        width: 100%;
        margin-bottom: 10px;
        padding: 12px;
        align-items: start;
        box-sizing: border-box;
        overflow: hidden;
        border: 1px solid #e1e6ef;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(39, 50, 70, 0.05);
    }
    
    .word-item-select { grid-area: select; width: 28px; padding-top: 10px; }
    .word-select-checkbox { width: 20px; height: 20px; }
    .word-item-images { grid-area: img; gap: 10px; min-width: 0; }
    .word-item-image { width: 72px; height: 72px; }
    .word-item-text { grid-area: text; display: flex; min-width: 0; flex-direction: column; padding: 0; gap: 8px; }
    
    .word-item-text input {
        min-width: 0;
        box-sizing: border-box;
        padding: 10px 12px;
        border: 1px solid #dfe4ec;
        border-radius: 8px;
        background: #f9fbfd;
    }
    .native-input { font-weight: 600; font-size: 1rem; color: var(--text-dark); }
    .foreign-input { color: #4f5968; font-size: 1rem; }
    
    .word-item-actions {
        grid-area: actions;
        display: flex;
        min-width: 0;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: flex-start;
    }
    .word-item-actions .word-listen-btn,
    .word-item-actions .word-record-btn,
    .word-item-actions .word-stop-btn {
        flex: 1 1 120px;
        min-width: 0;
    }
    .word-item-actions .word-stop-btn:disabled { display: none; }
    .word-item-actions .icon-btn,
    .word-item-actions .word-delete-audio-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        min-width: 42px;
        height: 42px;
        padding: 0;
        box-sizing: border-box;
    }
    .word-item.hide-text {
        grid-template-areas:
            "select img"
            ". actions";
    }
    .word-item.hide-image {
        grid-template-areas:
            "select text"
            ". actions";
    }
    .word-item.hide-text.hide-image {
        grid-template-areas: "select actions";
    }

    .tags-list {
        max-width: 100%;
    }
    .editor-footer {
        padding: 12px;
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }
    .tags-wrapper { width: 100%; }
    .tag-input { min-width: 0; flex: 1; }
    .editor-footer .text-link { align-self: flex-start; }
    
    .mobile-add-btn-container { display: block !important; }
    #open-add-words-modal-btn { display: none; }
}
