/* Creative Studio — vanilla UI, dark-mode compatible, mobile-usable. */

.creative-studio { padding: 16px; max-width: 1040px; margin: 0 auto; }
.cs-header { margin-bottom: 16px; }
.cs-header-title { display: flex; align-items: center; gap: 12px; }
.cs-header-title h2 { margin: 0; font-size: 20px; font-weight: 800; }
.cs-subtitle { margin: 4px 0 0; font-size: 13px; color: var(--text-muted, #64748b); }

.cs-badge-agent {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary, #2563eb);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Tabs */
.cs-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.cs-tab {
  padding: 10px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all .15s ease;
}
.cs-tab:hover { color: var(--text, #0f172a); }
.cs-tab.active {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
}

/* Quick Action Chips */
.cs-quick-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 12px;
}
.cs-chip-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted, #64748b);
  white-space: nowrap;
}
.cs-chip {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text, #1e293b);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s ease;
}
.cs-chip:hover {
  background: var(--primary, #2563eb);
  color: #ffffff;
  border-color: var(--primary, #2563eb);
}

/* Chat Layout */
.cs-chat-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 480px;
}
.cs-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
  background: var(--surface-subtle, #fafafa);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
[data-theme="dark"] .cs-chat-messages {
  background: rgba(255, 255, 255, 0.02);
}

.cs-chat-bubble {
  display: flex;
  gap: 10px;
  max-width: 88%;
}
.cs-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.cs-bubble-ai .cs-bubble-avatar {
  background: #2563eb;
  color: #fff;
}
.cs-bubble-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.cs-bubble-user .cs-bubble-avatar {
  background: #64748b;
  color: #fff;
}
.cs-bubble-body {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}
.cs-bubble-user .cs-bubble-body {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.cs-bubble-body strong {
  display: block;
  font-size: 11px;
  margin-bottom: 4px;
  opacity: 0.8;
}
.cs-bubble-content { word-break: break-word; }
.cs-bubble-actions { margin-top: 8px; border-top: 1px dashed var(--border-subtle, #e2e8f0); padding-top: 8px; }
.cs-btn-prefill {
  background: none;
  border: none;
  color: var(--primary, #2563eb);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cs-btn-prefill:hover { text-decoration: underline; }

/* Chat Input */
.cs-chat-form { margin-top: 12px; }
.cs-chat-input-wrap {
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--surface, #ffffff);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cs-chat-input-wrap textarea {
  border: none;
  resize: none;
  outline: none;
  font-size: 13px;
  background: transparent;
  color: inherit;
  font-family: inherit;
}
.cs-chat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Modal Bedah Link */
.cs-modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.cs-modal-content {
  background: var(--surface, #ffffff);
  border-radius: 14px;
  max-width: 580px;
  width: 100%;
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.cs-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.cs-modal-header h3 { margin: 0; font-size: 16px; font-weight: 800; }
.cs-modal-close {
  background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted, #64748b);
}
.cs-analysis-box {
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
}

/* Forms & Inputs */
.cs-form {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}
.cs-form-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 16px;
  color: var(--primary, #2563eb);
}
.cs-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.cs-field span { font-size: 12px; font-weight: 700; color: var(--text-muted, #475569); }
.cs-field input, .cs-field select, .cs-field textarea {
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: var(--surface, #ffffff);
  color: inherit;
}
.cs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Buttons */
.cs-actions { display: flex; gap: 10px; align-items: center; }
.cs-btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s ease;
}
.cs-btn-sm { padding: 6px 12px; font-size: 12px; }
.cs-btn-primary { background: #2563eb; color: #ffffff; }
.cs-btn-primary:hover { background: #1d4ed8; }
.cs-btn-secondary { background: var(--surface-2, #e2e8f0); color: var(--text, #1e293b); }
.cs-btn-secondary:hover { background: #cbd5e1; }

/* Playbook Grid */
.cs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 12px; }
.cs-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}
.cs-card-badge {
  align-self: flex-start;
  padding: 2px 8px;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.cs-card h4 { margin: 2px 0 4px; font-size: 14px; font-weight: 800; }

/* Slide Preview */
.cs-slides-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.cs-slide-card {
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
}
.cs-slide-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; }
.cs-slide-tag { font-size: 11px; font-weight: 800; padding: 6px 8px; color: var(--text-muted, #64748b); }
.cs-btn-download {
  margin: 0 8px 8px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2, #f1f5f9);
  text-align: center;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}

/* Spinner & States */
.cs-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: cs-spin 0.6s linear infinite;
  margin-right: 6px;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }
.cs-loading { font-size: 13px; color: var(--primary, #2563eb); font-weight: 600; }
.cs-error { font-size: 13px; color: #dc2626; font-weight: 600; }
.cs-empty { padding: 30px; text-align: center; font-size: 13px; color: var(--text-muted, #94a3b8); }

/* Model & Product Studio UI */
.cs-mode-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}
.cs-mode-btn {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #1e293b);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .2s ease;
}
.cs-mode-btn:hover {
  background: var(--surface-3, #f1f5f9);
}
.cs-mode-btn.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}
.cs-pill-badge {
  background: #10b981;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.cs-upload-zone {
  border: 2px dashed var(--border-subtle, #cbd5e1);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  background: var(--surface-2, #f8fafc);
  cursor: pointer;
  transition: border-color .2s ease;
}
.cs-upload-zone:hover {
  border-color: var(--primary, #2563eb);
}
.cs-upload-icon {
  font-size: 32px;
  color: var(--primary, #2563eb);
  margin-bottom: 8px;
}
.cs-upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.cs-upload-preview img {
  max-height: 120px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.cs-badge-locked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}

.cs-draft-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.cs-draft-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-subtle, #e2e8f0);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.cs-draft-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 12px;
  color: var(--primary, #2563eb);
}
.cs-draft-card input, .cs-draft-card textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle, #cbd5e1);
  border-radius: 6px;
  background: var(--surface, #fff);
  color: var(--text, #1e293b);
}

.cs-step-progress {
  padding: 18px;
  border-radius: 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border-subtle, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cs-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
}
.cs-step-item.active {
  color: var(--primary, #2563eb);
  font-weight: 700;
}
.cs-step-item.done {
  color: #059669;
}

@media (max-width: 640px) {
  .cs-row { grid-template-columns: 1fr; }
  .cs-chat-layout { height: calc(100vh - 220px); }
  .cs-chat-bubble { max-width: 95%; }
  .cs-mode-selector { flex-direction: column; }
  .cs-draft-cards { grid-template-columns: 1fr; }
}
