/* ===================== ASPPY AI Builder — UI ===================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0b1120;
  --bg-soft: #101827;
  --panel: #151e2e;
  --panel-2: #1a2438;
  --border: #223047;
  --border-hi: #2e415f;
  --text: #e6edf7;
  --text-dim: #8fa3bd;
  --text-mute: #5c718f;
  --accent: #f97316;
  --accent-2: #fb923c;
  --blue: #3b82f6;
  --danger: #ef4444;
  --ok: #10b981;
  --radius: 14px;
  --radius-sm: 10px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(249, 115, 22, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(59, 130, 246, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

#root { min-height: 100vh; }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3d557a; }

/* ---------- Header ---------- */
.gradient-header {
  background: rgba(16, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.35);
  flex-shrink: 0;
}

/* ---------- Buttons ---------- */
.gradient-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 10px rgba(249, 115, 22, 0.25);
}
.gradient-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.4);
}
.gradient-btn:active:not(:disabled) { transform: translateY(0); }

.gradient-btn-secondary {
  background: linear-gradient(135deg, var(--blue) 0%, #2563eb 100%);
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}
.gradient-btn-secondary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-hi);
  background: rgba(46, 65, 95, 0.25);
}

/* ---------- Inputs ---------- */
input, textarea, select {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border) !important;
  color: var(--text);
  border-radius: var(--radius-sm) !important;
  padding: 14px 18px !important;
  font-size: 15px;
  line-height: 1.4;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input[type="checkbox"] {
  padding: 0 !important;
  border-radius: 4px !important;
}
select {
  padding: 10px 14px !important;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}
input::placeholder, textarea::placeholder { color: var(--text-mute); }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: var(--border-hi); }

.card-interactive { cursor: pointer; }
.card-interactive:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  border-color: rgba(249, 115, 22, 0.45);
}

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slide-up { animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.badge-admin { background: rgba(249, 115, 22, 0.16); color: var(--accent-2); border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-user { background: rgba(59, 130, 246, 0.14); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }

/* ---------- Code preview ---------- */
.code-preview {
  background: #0a0f1c;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-family: 'Cascadia Code', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c9d6e8;
}

/* ---------- Preview iframe ---------- */
.site-preview {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
  border-radius: var(--radius-sm);
}
.preview-wrap {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 10px 8px;
}
.preview-dot { width: 10px; height: 10px; border-radius: 50%; }
.preview-url {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-dim);
  font-family: 'Consolas', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Chat ---------- */
.chat-bubble {
  max-width: 90%;
  padding: 11px 15px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-bubble-user {
  background: linear-gradient(135deg, var(--accent) 0%, #ea580c 100%);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.25);
}
.chat-bubble-ai {
  background: var(--panel-2);
  border: 1px solid var(--border);
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

/* Reasoning block inside AI bubble — small & unobtrusive */
.reasoning-block {
  background: rgba(92, 113, 143, 0.08);
  border: 1px solid rgba(92, 113, 143, 0.18);
  border-radius: 7px;
  padding: 6px 9px;
  margin-bottom: 8px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-mute);
  max-height: 88px;
  overflow-y: auto;
  font-style: italic;
}
.reasoning-block::-webkit-scrollbar { width: 4px; }
.reasoning-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-mute);
  display: block;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}
.reasoning-label:hover { opacity: 1; color: var(--text-dim); }

/* ---------- Spinner ---------- */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.spinner-sm { width: 15px; height: 15px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  z-index: 100;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}
.toast-success { background: rgba(6, 78, 59, 0.92); color: #6ee7b7; border: 1px solid #059669; }
.toast-error { background: rgba(127, 29, 29, 0.92); color: #fca5a5; border: 1px solid #dc2626; }

/* ---------- Tabs ---------- */
.file-tab {
  padding: 9px 18px;
  border-radius: 9px 9px 0 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-mute);
}
.file-tab-active {
  background: var(--panel);
  border-color: var(--border);
  color: var(--accent-2);
  font-weight: 600;
}
.file-tab-inactive:hover { color: var(--text); background: rgba(34, 48, 71, 0.4); }

.tab-preview { display: flex; align-items: center; gap: 6px; }

/* ---------- Image gallery ---------- */
.img-thumb {
  position: relative;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: visible;
}
.img-thumb img {
  height: 62px; width: 62px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--border);
  transition: all 0.15s ease;
  display: block;
}
.img-thumb:hover img { border-color: var(--accent); transform: scale(1.04); }
.img-del {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: var(--danger);
  border: 2px solid var(--bg);
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.img-thumb:hover .img-del { opacity: 1; }
.img-del:hover { transform: scale(1.15); }

/* ---------- Section labels ---------- */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-mute);
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
}
.empty-state .icon { font-size: 44px; margin-bottom: 14px; opacity: 0.75; }

/* ---------- History panel ---------- */
.history-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-sm);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  z-index: 60;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.history-row:last-child { border-bottom: none; }
.history-row:hover { background: rgba(34, 48, 71, 0.35); }

/* ---------- Table ---------- */
table { border-collapse: collapse; }
th { font-weight: 600; }
tbody tr { transition: background 0.12s ease; }
