/* ============================================================
   PRD STUDIO - COMPONENTS (BUTTONS, CARDS, MODALS, INPUTS)
   ============================================================ */

/* Icons helper */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn-sm {
  height: 34px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
}

.btn-lg {
  height: 44px;
  padding: 0 1.5rem;
  font-size: 0.95rem;
}

.btn-icon-sm {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-primary {
  background: var(--primary);
  color: #052e16;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 12px var(--primary-glow);
}
.btn-primary:hover:not(:disabled) {
  background: #34d399;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  background: var(--bg-accent);
  color: var(--text-main);
}

/* Flow Selector (Proyek Baru vs Proyek Eksisting) */
.flow-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  max-width: 650px;
  margin: 1.8rem auto 0;
  padding: 0 1rem;
}

.flow-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-normal);
}
.flow-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-1px);
}
.flow-btn.active {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.08), rgba(18, 18, 23, 0.9));
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.1);
}

.flow-icon {
  font-size: 1.4rem;
  width: 38px;
  height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
}
.flow-text small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Hero Section (Step 1) */
.hero-container {
  max-width: 860px;
  width: 100%;
  margin: 2.2rem auto 3rem;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-header {
  text-align: center;
  margin-bottom: 2rem;
  max-width: 640px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.sparkle-badge {
  width: 44px;
  height: 44px;
  background: rgba(16, 185, 129, 0.12);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.sparkle-badge svg {
  width: 24px;
  height: 24px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Prompt Card */
.prompt-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.prompt-card:focus-within {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.prompt-textarea {
  width: 100%;
  min-height: 150px;
  max-height: 380px;
  background: transparent;
  border: none;
  outline: none;
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-main);
  resize: vertical;
}
.prompt-textarea::placeholder {
  color: rgba(148, 148, 168, 0.45);
}

/* Attachments container */
.attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem 0;
}
.attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 4px 10px;
  background: var(--bg-accent);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.attachment-remove {
  cursor: pointer;
  font-weight: bold;
  color: var(--rose);
  margin-left: 3px;
}

/* Prompt Toolbar */
.prompt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  background: rgba(14, 14, 20, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 32px;
  padding: 0 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.tool-btn:hover {
  background: var(--bg-accent);
  color: var(--text-main);
  border-color: var(--border-accent);
}

.template-btn {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
  color: var(--primary);
  font-weight: 600;
}
.template-btn:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--primary);
}

.mic-btn.listening {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose);
  border-color: var(--rose);
  animation: pulseMic 1.2s infinite;
}
@keyframes pulseMic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(244, 63, 94, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.lang-selector {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.5rem;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}
.lang-select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.char-counter {
  font-size: 0.76rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  margin-left: 0.2rem;
}
.char-counter.error {
  color: var(--rose);
}

.btn-submit {
  height: 36px;
  padding: 0 1.25rem;
}

/* Clarification Card (Step 1.5) */
.clarify-card {
  width: 100%;
  margin-top: 1.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  box-shadow: var(--shadow-md);
  animation: fadeIn 300ms var(--transition-smooth);
}

.card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.4rem;
}
.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
}

.form-group {
  margin-bottom: 1.4rem;
}
.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.6rem;
}

.chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.chip {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.chip:hover {
  background: var(--bg-accent);
  color: var(--text-main);
  border-color: var(--border-accent);
}
.chip.active {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tech-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tech-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-select, .form-input {
  width: 100%;
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0 0.85rem;
  color: var(--text-main);
  font-size: 0.88rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.form-select:focus, .form-input:focus {
  border-color: var(--primary);
}

.clarify-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Codebase Guide Card */
.codebase-guide-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.guide-step {
  display: flex;
  gap: 1.2rem;
}
.step-badge-num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--sky-subtle);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: var(--sky);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-content {
  flex: 1;
}
.step-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.step-content p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.code-preview-box {
  position: relative;
  background: #060608;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
}
.code-preview-box pre {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.agent-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.agent-pill {
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Modals & Backdrop */
.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 200ms ease;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-dialog.modal-lg {
  max-width: 820px;
}

.modal-header {
  padding: 1.4rem 1.6rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}
.modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}
.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.4rem 1.6rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.6rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Drawer */
.drawer-backdrop {
  justify-content: flex-end;
  padding: 0;
}
.drawer-panel {
  background: var(--bg-card);
  border-left: 1px solid var(--border-subtle);
  width: 380px;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slideDrawer 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDrawer {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}
.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.drawer-body {
  padding: 1.2rem 1.5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  color: var(--text-main);
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: slideToast 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success {
  border-color: rgba(16, 185, 129, 0.4);
}
.toast.error {
  border-color: rgba(244, 63, 94, 0.4);
  color: var(--rose);
}
@keyframes slideToast {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 2.1rem;
  }
  .tech-grid {
    grid-template-columns: 1fr;
  }
  .prompt-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }
}
