/* ==== Base components (Tailwind @apply via inline classes is avoided since we use CDN) ==== */

/* Cards */
.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #eef1f5;
  background: #fafbfc;
}
.card-title { font-size: 0.95rem; font-weight: 600; color: #1f1f1f; }
.card-sub   { font-size: 0.78rem; color: #6b7280; margin-top: 2px; }
.card-body  { padding: 16px 18px; }

/* Form */
.label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  background: #fff;
  color: #1f1f1f;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: #ffa300;
  box-shadow: 0 0 0 3px rgba(255,163,0,0.18);
}
textarea.input { resize: vertical; min-height: 70px; font-family: inherit; }
select.input { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20'><path fill='%236b7280' d='M5.3 7.3a1 1 0 011.4 0L10 10.6l3.3-3.3a1 1 0 111.4 1.4l-4 4a1 1 0 01-1.4 0l-4-4a1 1 0 010-1.4z'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffa300; color: #fff;
  font-weight: 600; font-size: 0.88rem;
  padding: 10px 16px; border-radius: 8px;
  border: 1px solid transparent;
  transition: background .15s, transform .08s;
}
.btn-primary:hover { background: #e69300; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: #333;
  font-weight: 500; font-size: 0.82rem;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid #d1d5db;
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: #f9fafb; border-color: #ffa300; color: #b86f00; }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* Nav tabs */
.nav-tab {
  font-size: 0.85rem;
  font-weight: 500;
  color: #4b5563;
  padding: 7px 12px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.nav-tab:hover { background: #fff7e6; color: #b86f00; }
.nav-tab-active {
  background: #ffa300;
  color: #fff !important;
}

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  transition: border-color .15s, background .15s;
  background: #fafbfc;
}
.dropzone:hover { border-color: #ffa300; background: #fff7e6; }

/* Color chips */
.color-chip {
  position: relative;
  display: inline-flex; align-items: center;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 4px 8px 4px 4px;
  gap: 6px;
}
.color-chip .swatch {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.06);
  cursor: pointer;
  position: relative;
}
.color-chip .swatch input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.color-chip .hex { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem; color: #4b5563; }
.color-chip .remove {
  font-size: 0.7rem; color: #9ca3af;
  background: transparent; border: 0; padding: 2px 4px; cursor: pointer;
}
.color-chip .remove:hover { color: #ef4444; }

/* Attachment list */
.attach-item {
  display: flex; flex-direction: column; gap: 6px;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 10px 12px;
}
.attach-item .top { display: flex; align-items: center; gap: 10px; }
.attach-item .name { font-size: 0.85rem; color: #1f1f1f; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-item .size { font-size: 0.7rem; color: #6b7280; }
.attach-item .remove { background: none; border: 0; color: #9ca3af; cursor: pointer; }
.attach-item .remove:hover { color: #ef4444; }
.attach-item .desc { width: 100%; font-size: 0.8rem; padding: 6px 8px; border: 1px solid #e5e7eb; border-radius: 6px; }

/* Slide list items */
.slide-li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.slide-li:hover { background: #f9fafb; }
.slide-li.active { background: #fff7e6; border-color: #ffd98a; }
.slide-li .idx { font-size: 0.72rem; color: #9ca3af; width: 22px; font-family: ui-monospace, monospace; }
.slide-li .t   { flex: 1; font-size: 0.82rem; color: #1f1f1f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide-li .st  { width: 10px; height: 10px; border-radius: 50%; }
.st-pending   { background: #d1d5db; }
.st-progress  { background: #ffa300; box-shadow: 0 0 0 3px rgba(255,163,0,0.25); animation: pulse 1.2s ease-in-out infinite; }
.st-done      { background: #22c55e; }
.st-error     { background: #ef4444; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Status chip */
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; padding: 4px 9px; border-radius: 999px;
  border: 1px solid #e5e7eb; background: #fff; color: #4b5563;
}
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; }
.status-notrendered { background: #f3f4f6; }
.status-inprogress  { background: #fff7e6; color: #b86f00; border-color: #ffd98a; }
.status-inprogress .dot { background: #ffa300; animation: pulse 1.2s infinite; }
.status-rendered    { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.status-rendered .dot { background: #22c55e; }
.status-error       { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.status-error .dot  { background: #ef4444; }

/* Loader visible */
#loader.show { display: flex !important; }

/* Toasts */
.toast {
  background: #1f1f1f; color: #fff;
  padding: 10px 14px; border-radius: 8px;
  font-size: 0.85rem; max-width: 340px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  border-left: 3px solid #ffa300;
  animation: slidein .25s ease-out;
}
.toast.error { border-left-color: #ef4444; }
.toast.success { border-left-color: #22c55e; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Section */
.section-panel { animation: fadein .2s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* Slide canvas iframe */
#slide-canvas-wrap iframe,
#template-preview iframe {
  border: 0;
  display: block;
  background: #fff;
}

/* Summary */
#summary-block .row { display: flex; justify-content: space-between; gap: 10px; }
#summary-block .row .k { color: #6b7280; }
#summary-block .row .v { color: #1f1f1f; font-weight: 500; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Provider helper links */
.btn-link {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  font-size: 0.75rem; font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #333;
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-link:hover { border-color: #ffa300; color: #b86f00; background: #fff7e6; }

/* ========== Render layout — fill viewport ========== */
/* Header is ~60px, nav pad + usage bar ~24px+48px */
.render-layout {
  height: calc(100vh - 140px);
  min-height: 520px;
}
.render-aside { height: 100%; overflow: hidden; }
.render-main  { height: 100%; overflow: hidden; }

/* Make the slide canvas fill its area */
#slide-canvas-wrap { max-width: 100%; max-height: 100%; }

/* ========== Editor toolbar ========== */
.edit-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 28px; padding: 0 8px;
  background: #fff; border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px; color: #333;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.edit-btn:hover { background: #fff7e6; border-color: #ffa300; color: #b86f00; }
.edit-btn:active { transform: translateY(1px); }
.edit-btn.on { background: #ffa300; color: #fff; border-color: #ffa300; }
.edit-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.edit-sep {
  display: inline-block; width: 1px; height: 20px;
  background: #e5e7eb; margin: 0 4px;
}
.edit-color {
  width: 28px; height: 28px; padding: 2px;
  border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer;
  background: #fff;
}

/* Selection outline (applied inside iframe via injected css) */
.ai-ppt-selected-outline {
  outline: 2px solid #ffa300 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(255,163,0,0.18) !important;
}
.ai-ppt-hover-outline {
  outline: 1px dashed rgba(255,163,0,0.7) !important;
  outline-offset: 1px !important;
  cursor: pointer !important;
}
/* Selection handles drawn on overlay (parent doc) */
.ed-handles {
  position: absolute;
  pointer-events: none;
  z-index: 30;
}
.ed-handle {
  position: absolute;
  width: 10px; height: 10px;
  background: #fff;
  border: 2px solid #ffa300;
  border-radius: 50%;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}
.ed-handle.move {
  background: #ffa300;
  border-color: #fff;
  width: 22px; height: 22px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: grab;
}
.ed-handle.move:active { cursor: grabbing; }
.ed-handle[data-dir="nw"], .ed-handle[data-dir="se"] { cursor: nwse-resize; }
.ed-handle[data-dir="ne"], .ed-handle[data-dir="sw"] { cursor: nesw-resize; }
.ed-handle[data-dir="n"],  .ed-handle[data-dir="s"]  { cursor: ns-resize; }
.ed-handle[data-dir="e"],  .ed-handle[data-dir="w"]  { cursor: ew-resize; }

/* Usage bar */
#usage-bar code { background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 4px; }

/* Ensure nav header doesn't break on small widths */
@media (max-width: 900px) {
  .render-layout { height: auto; grid-template-columns: 1fr !important; }
  .render-aside, .render-main { height: auto; min-height: 400px; }
}
