/* ============================================
   AskOracle — Global Styles
   Black background + animated white stars theme
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #000000;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --surface-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f0;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.3);
  --accent: #a78bfa;
  --accent-glow: rgba(167, 139, 250, 0.35);
  --accent-secondary: #818cf8;
  --gradient-start: #c084fc;
  --gradient-end: #60a5fa;
  --success: #34d399;
  --danger: #f87171;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --shadow-glow: 0 0 40px rgba(167, 139, 250, 0.12);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Starfield Canvas --- */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* --- Header --- */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid var(--surface-border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: transform var(--transition);
}

.logo:hover { transform: scale(1.03); }

.logo-icon {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: icon-pulse 3s ease-in-out infinite;
}

@keyframes icon-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.15); }
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo-highlight {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--success);
  background: rgba(52, 211, 153, 0.08);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid rgba(52, 211, 153, 0.15);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: dot-blink 2s ease-in-out infinite;
}

@keyframes dot-blink {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
  50% { opacity: 0.4; box-shadow: none; }
}

/* --- Main Layout --- */
#main-content {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
  padding-top: 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 50px 0 30px;
  animation: fadeUp 0.8s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.15);
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: dot-blink 2s ease-in-out infinite;
}

#hero-title {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
  font-weight: 400;
}

/* --- Chat Container --- */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 40px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-glow);
  animation: fadeUp 0.8s ease-out 0.15s both;
  position: relative;
}

/* --- Drag & Drop Overlay --- */
.drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.85);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.drop-overlay.active {
  display: flex;
}

.drop-overlay-content {
  text-align: center;
  color: var(--text-primary);
  animation: fadeUp 0.3s ease-out;
}

.drop-overlay-content svg {
  color: var(--accent);
  margin-bottom: 16px;
}

.drop-overlay-content p {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.drop-overlay-content span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* --- Messages Area --- */
.messages-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 50vh;
  min-height: 250px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.messages-area::-webkit-scrollbar { width: 5px; }
.messages-area::-webkit-scrollbar-track { background: transparent; }
.messages-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* --- Message Bubbles --- */
.message {
  display: flex;
  gap: 14px;
  animation: msgSlide 0.4s ease-out;
}

@keyframes msgSlide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.ai-message .message-avatar {
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.2), rgba(96, 165, 250, 0.2));
  border: 1px solid rgba(192, 132, 252, 0.2);
}

.user-message .message-avatar {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.message-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.message-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.message-body {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.7;
}

.message-body p { margin-bottom: 10px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body strong { color: var(--text-primary); font-weight: 600; }

.message-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-body pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 12px 0;
}

.message-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* --- Message Attachments (inline in message) --- */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.message-attachment-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.message-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.message-file-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* --- Suggestion Chips --- */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.chip:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translateY(-1px);
}

.chip:active { transform: scale(0.97); }

/* --- Attachment Preview (before sending) --- */
.attachment-preview {
  padding: 10px 20px 0;
  border-top: 1px solid var(--surface-border);
  background: rgba(0, 0, 0, 0.2);
}

.attachment-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  animation: fadeUp 0.3s ease-out;
}

.attachment-item.image-item {
  padding: 4px;
}

.attachment-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
}

.attachment-item .file-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
}

.attachment-item .file-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--bg);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition);
  line-height: 1;
}

.attachment-item .remove-btn:hover {
  transform: scale(1.15);
}

/* --- Input Area --- */
.input-area {
  padding: 12px 16px 10px;
  border-top: 1px solid var(--surface-border);
  background: rgba(0, 0, 0, 0.3);
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.action-btn:hover {
  color: var(--accent);
  background: rgba(167, 139, 250, 0.1);
}

.action-btn:active {
  transform: scale(0.92);
}

#user-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  padding: 8px 4px;
  max-height: 140px;
  line-height: 1.5;
  min-width: 0;
}

#user-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.send-btn:not(:disabled) {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.send-btn:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px var(--accent-glow);
}

.send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.input-hint {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.input-hint kbd {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2px 5px;
  border-radius: 4px;
}

/* --- Typing Indicator --- */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

/* --- Camera Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  overflow: hidden;
  animation: fadeUp 0.3s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.camera-body {
  position: relative;
  background: #000;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.camera-body video,
.camera-body .camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000;
}

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
}

.camera-control-btn {
  border: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.camera-control-btn.secondary {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.camera-control-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.camera-control-btn.primary {
  width: 64px;
  height: 64px;
  background: transparent;
  border: 3px solid rgba(255, 255, 255, 0.7);
  padding: 4px;
}

.camera-control-btn.primary:hover {
  border-color: #fff;
}

.camera-control-btn.primary:active .capture-ring {
  transform: scale(0.85);
}

.capture-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.camera-actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px 16px;
  justify-content: flex-end;
}

.modal-btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.modal-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.modal-btn.primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: #fff;
}

.modal-btn.primary:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.modal-btn.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Footer --- */
#site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-heart {
  color: var(--danger);
  animation: heartbeat 1.5s ease-in-out infinite;
  display: inline-block;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
}

/* --- Error Message --- */
.error-body { color: var(--danger) !important; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .header-inner { padding: 12px 16px; }
  .hero { padding: 32px 0 20px; }
  #hero-title { font-size: 2rem; }
  .hero-subtitle { font-size: 0.92rem; }
  .messages-area { padding: 16px; max-height: 45vh; }
  .suggestion-chips { gap: 6px; }
  .chip { font-size: 0.75rem; padding: 6px 12px; }
  .message-avatar { width: 32px; height: 32px; font-size: 0.85rem; }
  .action-btn { width: 32px; height: 32px; }
  .modal { max-width: 100%; }
}
