/* ===== tool-wrapper (base) ===== */
.tool-wrapper.slides-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2d3748;
}

/* ===== Upload Area (shared pattern) ===== */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 0.9rem;
    padding: 2.4rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: #fafbfc;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 1.5rem;
}
.upload-area:hover, .upload-area.dragover { border-color: #3182ce; background: #ebf8ff; }
.upload-icon { font-size: 2.6rem; color: #cbd5e0; margin-bottom: 0.6rem; }
.upload-text { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.3rem; }
.upload-hint { color: #718096; font-size: 0.85rem; margin-bottom: 1rem; }
.upload-btn {
    background: #3182ce; color: #fff; border: none; padding: 0.55rem 1.4rem;
    border-radius: 2rem; font-weight: 600; cursor: pointer; display: inline-flex;
    align-items: center; gap: 0.4rem;
}
.upload-btn:hover { background: #2b6cb0; }

/* ===== Progress / analyzing state ===== */
.progress-area {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.6rem; padding: 3rem 1.5rem; background: #fafbfc; border: 1px solid #e2e8f0;
    border-radius: 0.9rem; margin-bottom: 1.5rem;
}
.progress-spinner { font-size: 1.8rem; color: #3182ce; }
.progress-text { font-weight: 600; color: #4a5568; }
.progress-bar-track {
    width: 100%; max-width: 360px; height: 8px; border-radius: 999px;
    background: #e2e8f0; overflow: hidden; margin-top: 0.4rem;
}
.progress-bar-fill {
    height: 100%; width: 0%; background: linear-gradient(90deg,#3182ce,#38bdf8);
    border-radius: 999px; transition: width 0.2s ease;
}

/* ===================================================== */
/* Slides App shell                                       */
/* ===================================================== */
.slides-app {
    border: 1px solid #d7dde5;
    border-radius: 0.6rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}

/* ===== Top Toolbar ===== */
.app-toolbar {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    background: #f7f8fa;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.7rem;
    position: relative;
    z-index: 5;
}
.toolbar-group { display: flex; align-items: center; gap: 0.25rem; }
.toolbar-sep { width: 1px; height: 1.5rem; background: #e2e8f0; margin: 0 0.35rem; flex: 0 0 auto; }
.toolbar-sep-push { margin-left: auto; }

.icon-btn {
    height: 2.1rem; min-width: 2.1rem; padding: 0 0.55rem; border-radius: 0.4rem;
    border: 1px solid transparent; background: transparent; color: #4a5568;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    transition: background 0.15s, border-color 0.15s; flex: 0 0 auto; font-size: 0.95rem;
}
.icon-btn:hover { background: #edf2f7; border-color: #e2e8f0; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; background: transparent; }
.icon-btn.active { background: #3182ce; color: #fff; border-color: #3182ce; }
.icon-btn.active:hover { background: #2b6cb0; }
.icon-btn.btn-danger-icon:hover { background: #fff5f5; color: #c53030; border-color: #feb2b2; }
.icon-btn-primary { background: #3182ce; color: #fff; border-color: #3182ce; }
.icon-btn-primary:hover { background: #2b6cb0; color: #fff; }
.icon-btn-wide { padding: 0 0.75rem; }
.icon-btn-label { font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.icon-btn-caret { font-size: 0.65rem; opacity: 0.7; margin-inline-start: 0.1rem; }

/* ===== Mode switch (Smart Summary / Exact Pages) ===== */
.mode-switch-group { background: #edf2f7; border-radius: 0.5rem; padding: 0.15rem; }
.mode-toggle-btn { border-radius: 0.35rem; color: #4a5568; }
.mode-toggle-btn.active { background: #fff; color: #3182ce; box-shadow: 0 1px 2px rgba(0,0,0,0.12); border-color: transparent; }
.mode-toggle-btn.active:hover { background: #fff; }

/* ===== Dropdowns (theme / density) ===== */
.dropdown-wrap { position: relative; }
.dropdown-panel {
    position: absolute; top: calc(100% + 6px); left: 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 0.6rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14); padding: 0.8rem 0.9rem;
    min-width: 230px; z-index: 40;
}
.dropdown-panel label {
    font-size: 0.8rem; font-weight: 600; color: #4a5568;
    display: block; margin-bottom: 0.55rem;
}

.theme-swatch-dot {
    width: 1.05rem; height: 1.05rem; border-radius: 50%;
    background: linear-gradient(135deg,#0f2544,#38bdf8);
    border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e0; display: inline-block; flex: 0 0 auto;
}
.theme-options { display: flex; flex-direction: column; gap: 0.35rem; }
.theme-option {
    display: flex; align-items: center; gap: 0.6rem; width: 100%;
    padding: 0.4rem 0.5rem; border-radius: 0.4rem; border: 1px solid transparent;
    background: transparent; cursor: pointer; font-size: 0.85rem; font-weight: 600; color: #4a5568;
    text-align: left;
}
.theme-option:hover { background: #f7fafc; }
.theme-option.active { background: #ebf8ff; border-color: #90cdf4; color: #2b6cb0; }
.theme-preview {
    width: 2.1rem; height: 1.4rem; border-radius: 0.3rem; flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.theme-preview-professional-blue { background: linear-gradient(135deg,#0f2544,#38bdf8); }
.theme-preview-modern-dark { background: linear-gradient(135deg,#111827,#7c3aed); }
.theme-preview-minimal-light { background: linear-gradient(135deg,#f7fafc,#a0aec0); }
.theme-preview-warm-sunset { background: linear-gradient(135deg,#7c2d12,#f97316); }
.theme-preview-corporate-green { background: linear-gradient(135deg,#064e3b,#34d399); }

.density-options { display: flex; flex-direction: column; gap: 0.3rem; }
.density-option {
    padding: 0.4rem 0.6rem; border-radius: 0.4rem; border: 1px solid #e2e8f0;
    background: #fff; cursor: pointer; font-size: 0.82rem; font-weight: 600; color: #4a5568; text-align: left;
}
.density-option:hover { background: #f7fafc; }
.density-option.active { background: #3182ce; color: #fff; border-color: #3182ce; }
.density-hint { font-size: 0.72rem; color: #a0aec0; margin: 0.6rem 0 0; line-height: 1.4; }

/* ===== Drag-to-reorder hint bar ===== */
.drag-hint {
    display: flex; align-items: center; gap: 0.55rem;
    background: #ebf8ff; color: #2c5282; border-bottom: 1px solid #bee3f8;
    padding: 0.55rem 0.9rem; font-size: 0.82rem; font-weight: 500;
}
.drag-hint > i:first-child { color: #3182ce; flex: 0 0 auto; }
.drag-hint span { flex: 1; line-height: 1.4; }
.drag-hint-icon { font-size: 0.72rem; vertical-align: middle; margin: 0 0.1rem; }
.drag-hint-close {
    border: none; background: transparent; color: #4a89b8; cursor: pointer;
    width: 1.6rem; height: 1.6rem; border-radius: 0.35rem; display: inline-flex;
    align-items: center; justify-content: center; flex: 0 0 auto; font-size: 0.8rem;
}
.drag-hint-close:hover { background: rgba(49,130,206,0.15); color: #2c5282; }

/* ===== Slides viewport / grid ===== */
.slides-viewport {
    background: #eef1f5;
    min-height: 420px;
    max-height: 78vh;
    overflow: auto;
    padding: 1.4rem;
}
.slides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.4rem;
}

/* ===== Slide card ===== */
.slide-card {
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.slide-card-toolbar {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.55rem; background: #f7f8fa; border-bottom: 1px solid #e9edf2;
}
.slide-index {
    font-size: 0.72rem; font-weight: 700; color: #718096;
    background: #edf2f7; border-radius: 999px; padding: 0.1rem 0.55rem;
}
.slide-type-badge {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
    color: #3182ce; background: #ebf8ff; border-radius: 999px; padding: 0.1rem 0.5rem;
}
.slide-drag-handle {
    width: 2.1rem; height: 2.1rem; border-radius: 0.35rem; display: inline-flex;
    align-items: center; justify-content: center; color: #a0aec0; cursor: grab; font-size: 0.9rem;
    flex: 0 0 auto; touch-action: none; user-select: none; -webkit-user-select: none;
    margin: -0.2rem; /* enlarges the touch/click target without shifting layout */
}
.slide-drag-handle:hover { background: #edf2f7; color: #4a5568; }
.slide-drag-handle:active { cursor: grabbing; }

/* Dragged card: lifted out of the grid flow and follows the pointer via
   left/top (position:fixed), while a placeholder below marks the drop slot. */
.slide-card.drag-floating {
    position: fixed;
    z-index: 1000;
    margin: 0;
    pointer-events: none;
    box-shadow: 0 12px 28px rgba(0,0,0,0.28);
    transform: scale(1.03) rotate(-1deg);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.slide-card-placeholder {
    border-radius: 0.6rem;
    border: 2px dashed #a0c4e8;
    background: rgba(66,153,225,0.08);
}
.slide-card-actions { display: flex; align-items: center; gap: 0.15rem; margin-inline-start: auto; }
.slide-card-actions button {
    width: 1.7rem; height: 1.7rem; border-radius: 0.35rem; border: 1px solid transparent;
    background: transparent; color: #718096; cursor: pointer; display: inline-flex;
    align-items: center; justify-content: center; font-size: 0.78rem;
}
.slide-card-actions button:hover { background: #edf2f7; }
.slide-card-actions button:disabled { opacity: 0.35; cursor: not-allowed; }
.slide-card-actions button.action-delete:hover { background: #fff5f5; color: #c53030; }

/* Slide preview surface: emulates a 16:9 exported slide */
.slide-preview {
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    background: var(--slide-bg, #0f2544);
    color: var(--slide-text, #ffffff);
}
.slide-preview-inner { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* --- Title slide layout --- */
.slide-preview.is-title .slide-preview-inner {
    justify-content: center;
    padding: 8% 9%;
}
.slide-title-accent {
    width: 15%; height: 5px; background: var(--slide-accent, #38bdf8);
    border-radius: 3px; margin-bottom: 0.7rem;
}
.slide-title-input {
    background: transparent; border: none; outline: none; color: var(--slide-text, #fff);
    font-size: 1.35rem; font-weight: 800; line-height: 1.25; padding: 0.15rem 0; width: 100%;
    font-family: inherit;
}
.slide-title-input::placeholder { color: rgba(255,255,255,0.45); }
.slide-subtitle-input {
    background: transparent; border: none; outline: none; color: var(--slide-accent, #38bdf8);
    font-size: 0.85rem; font-weight: 600; padding: 0.25rem 0 0; width: 100%; font-family: inherit;
}
.slide-subtitle-input::placeholder { color: rgba(255,255,255,0.4); }

/* --- Content slide layout --- */
.slide-preview.is-content { background: var(--slide-body-bg, #ffffff); }
.slide-preview.is-content .slide-preview-inner { flex-direction: row; }
.slide-content-accent-bar { width: 5px; flex: 0 0 auto; background: var(--slide-accent, #38bdf8); }
.slide-content-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.slide-content-header {
    background: var(--slide-bg2, #13315c); padding: 6% 6% 4%;
    flex: 0 0 auto;
}
.slide-heading-input {
    background: transparent; border: none; outline: none; color: var(--slide-text, #fff);
    font-size: 1.05rem; font-weight: 800; width: 100%; font-family: inherit;
}
.slide-heading-input::placeholder { color: rgba(255,255,255,0.45); }
.slide-bullets-body {
    flex: 1; padding: 5% 6%; overflow: auto; color: var(--slide-body-text, #1a202c);
}
.slide-bullets-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.slide-bullet-row { display: flex; align-items: flex-start; gap: 0.4rem; }
.slide-bullet-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--slide-accent, #38bdf8);
    margin-top: 0.5rem; flex: 0 0 auto;
}
.slide-bullet-input {
    flex: 1; border: none; outline: none; background: transparent; resize: none;
    font-size: 0.78rem; line-height: 1.4; color: var(--slide-body-text, #1a202c);
    font-family: inherit; padding: 0.05rem 0;
}
.slide-bullet-remove {
    border: none; background: transparent; color: #cbd5e0; cursor: pointer;
    font-size: 0.7rem; flex: 0 0 auto; padding: 0.1rem 0.15rem;
}
.slide-bullet-remove:hover { color: #c53030; }
.slide-add-bullet-btn {
    align-self: flex-start; margin-top: 0.4rem; border: 1px dashed #cbd5e0; background: transparent;
    color: #718096; font-size: 0.7rem; font-weight: 600; border-radius: 0.4rem;
    padding: 0.2rem 0.5rem; cursor: pointer;
}
.slide-add-bullet-btn:hover { border-color: #3182ce; color: #3182ce; }
.slide-page-number {
    position: absolute; bottom: 4%; inset-inline-end: 4%;
    font-size: 0.6rem; font-weight: 700; color: var(--slide-accent, #38bdf8); opacity: 0.85;
}

/* --- Exact-page slide layout (1:1 rendered PDF page) --- */
.slide-preview.is-page-image {
    aspect-ratio: unset; /* overridden inline per-page to match the original page ratio */
    background: #2b2b2b;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slide-page-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.slide-source-label {
    position: absolute; top: 8px; inset-inline-start: 8px;
    background: rgba(17, 24, 39, 0.78); color: #fff; font-size: 0.65rem; font-weight: 700;
    padding: 0.2rem 0.5rem; border-radius: 0.3rem; display: inline-flex; align-items: center; gap: 0.3rem;
    max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* RTL documents: flexbox row axis already mirrors under dir="rtl",
   so no manual `order` overrides are needed here. */
.slide-preview[dir="rtl"] .slide-title-input,
.slide-preview[dir="rtl"] .slide-subtitle-input,
.slide-preview[dir="rtl"] .slide-heading-input,
.slide-preview[dir="rtl"] .slide-bullet-input { text-align: right; }

/* ===== Theme color variables ===== */
.slide-card[data-theme="professional-blue"] {
    --slide-bg: #0f2544; --slide-bg2: #13315c; --slide-accent: #38bdf8;
    --slide-text: #ffffff; --slide-body-bg: #ffffff; --slide-body-text: #1a202c;
}
.slide-card[data-theme="modern-dark"] {
    --slide-bg: #111827; --slide-bg2: #1f2937; --slide-accent: #a78bfa;
    --slide-text: #ffffff; --slide-body-bg: #1f2937; --slide-body-text: #e5e7eb;
}
.slide-card[data-theme="minimal-light"] {
    --slide-bg: #f7fafc; --slide-bg2: #edf2f7; --slide-accent: #3182ce;
    --slide-text: #1a202c; --slide-body-bg: #ffffff; --slide-body-text: #2d3748;
}
.slide-card[data-theme="warm-sunset"] {
    --slide-bg: #7c2d12; --slide-bg2: #9a3412; --slide-accent: #fb923c;
    --slide-text: #ffffff; --slide-body-bg: #fffaf5; --slide-body-text: #431407;
}
.slide-card[data-theme="corporate-green"] {
    --slide-bg: #064e3b; --slide-bg2: #065f46; --slide-accent: #34d399;
    --slide-text: #ffffff; --slide-body-bg: #ffffff; --slide-body-text: #064e3b;
}
/* minimal-light title text is dark, so its input placeholder needs a darker tint */
.slide-card[data-theme="minimal-light"] .slide-title-input::placeholder,
.slide-card[data-theme="minimal-light"] .slide-subtitle-input::placeholder { color: rgba(26,32,44,0.4); }

/* ===== Status text (shared) ===== */
.compression-stats {
    background: #f7fafc; padding: 0.5rem 1rem; border-radius: 0.5rem;
    margin-bottom: 1rem; font-size: 0.95rem; color: #4a5568;
}

/* ===== Hidden ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
    .app-toolbar { justify-content: center; }
    .toolbar-sep-push { margin-left: 0; }
    .slides-viewport { padding: 0.8rem; min-height: 320px; }
    .slides-grid { grid-template-columns: 1fr; }
    .icon-btn-label { display: none; }
}