/* Imported slide renderer ------------------------------------------ */

html, body { margin: 0; padding: 0; height: 100%; background: #0b1020; }

.imported-slide-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

.imported-slide-stage {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Slide is a fixed 1920x1080 canvas that we scale to fit. */
.imported-slide-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 1920px;
    height: 1080px;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    transform-origin: top left;
    overflow: hidden;
}

.imported-slide-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.imported-slide-shapes svg {
    width: 100%;
    height: 100%;
    display: block;
}

.imported-slide-text {
    position: absolute;
    inset: 0;
}

.imported-slide-text-el {
    position: absolute;
    line-height: 1.1;
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
    cursor: default;
    box-sizing: border-box;
    padding: 2px;
    border: 1px dashed transparent;
    transition: border-color 0.12s, background 0.12s;
}

/* Editable hover/focus affordances */
.imported-slide-frame[data-editable="1"] .imported-slide-text-el {
    cursor: text;
}
.imported-slide-frame[data-editable="1"] .imported-slide-text-el:hover {
    border-color: rgba(79, 82, 189, 0.4);
}
.imported-slide-frame[data-editable="1"] .imported-slide-text-el:focus {
    border-color: #4F52BD;
    background: rgba(79, 82, 189, 0.04);
}

/* Drag handle for the whole element (shown on hover while editable) */
.imported-slide-frame[data-editable="1"] .imported-slide-text-el::before {
    content: "";
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 10px;
    background: #4F52BD;
    border-radius: 3px;
    opacity: 0;
    cursor: grab;
    transition: opacity 0.12s;
    pointer-events: auto;
}
.imported-slide-frame[data-editable="1"] .imported-slide-text-el:hover::before {
    opacity: 0.6;
}
.imported-slide-frame[data-editable="1"] .imported-slide-text-el.dragging::before {
    opacity: 1;
    cursor: grabbing;
}

/* Import modal ----------------------------------------------------- */

.pptx-import-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.pptx-import-dialog {
    width: min(1100px, 92vw);
    max-height: 88vh;
    background: #ffffff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

.pptx-import-header {
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pptx-import-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
}

.pptx-import-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.pptx-import-footer {
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

.pptx-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 48px 24px;
    text-align: center;
    color: #64748b;
    transition: background 0.12s, border-color 0.12s;
}
.pptx-drop-zone.dragging {
    background: rgba(79, 82, 189, 0.06);
    border-color: #4F52BD;
    color: #1e293b;
}
.pptx-drop-zone input[type="file"] { display: none; }
.pptx-drop-zone button {
    margin-top: 12px;
    padding: 8px 16px;
    background: #4F52BD;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}
.pptx-drop-zone button:hover { background: #3f42a3; }

.pptx-progress {
    padding: 40px 20px;
    text-align: center;
    color: #475569;
}
.pptx-progress-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid #e2e8f0;
    border-top-color: #4F52BD;
    border-radius: 50%;
    animation: pptx-spin 0.8s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}
@keyframes pptx-spin { to { transform: rotate(360deg); } }

.pptx-review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.pptx-review-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}
.pptx-review-card.excluded {
    opacity: 0.45;
}

.pptx-review-thumb {
    aspect-ratio: 16 / 9;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
}
.pptx-review-thumb iframe {
    border: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.pptx-review-thumb .pptx-review-num {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.pptx-review-meta {
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pptx-review-meta input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
}

.pptx-scope-row {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #475569;
    align-items: center;
    flex-wrap: wrap;
}
.pptx-scope-row label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}
.pptx-scope-row input[type="radio"] { accent-color: #4F52BD; }

.pptx-import-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.pptx-import-btn.primary {
    background: #4F52BD;
    color: #fff;
}
.pptx-import-btn.primary:hover { background: #3f42a3; }
.pptx-import-btn.primary:disabled { background: #a5a8d6; cursor: not-allowed; }
.pptx-import-btn.secondary {
    background: #fff;
    color: #475569;
    border-color: #cbd5e1;
}
.pptx-import-btn.secondary:hover { background: #f1f5f9; }

.pptx-error {
    padding: 12px 16px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 13px;
}

/* Presentation builder — Import PPTX button in the sources panel */
.pres-sources-actions {
    margin-bottom: 10px;
}
.pres-import-btn {
    width: 100%;
    padding: 8px 10px;
    background: #4F52BD;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.pres-import-btn:hover { background: #3f42a3; }
