/* ─── Dashboard — dark design system (matches BUILD_GUIDE) ─── */

/* ── Root layout ── */
.dashboard-layout-root {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  background: #080B10;
  position: relative;
  font-family: 'DM Sans', sans-serif;
}

/* Subtle radial glow top-left */
.dashboard-layout-root::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  background: rgba(107, 97, 231, 0.08);
  top: -100px;
  left: -80px;
}

/* ── Sidebar ── */
.dashboard-sidebar {
  background: #0D1018 !important;
  border-right: 1px solid #1E2838 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 10;
}

/* Sidebar links */
.sidebar-link {
  transition: background-color 0.15s ease, color 0.15s ease !important;
}
.sidebar-link:hover {
  background: rgba(107, 97, 231, 0.1) !important;
  transform: none !important;
}

/* Show delete button on recent item hover */
.recent-item-wrapper:hover .sidebar-link + button,
.recent-item-wrapper:hover button {
  opacity: 1 !important;
}

/* ── Main content ── */
.dashboard-main {
  z-index: 5;
  position: relative;
  background: transparent !important;
}

/* ── Cards ── */
.glass-card {
  background: #111D2C;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: 16px;
  border: 1px solid #1E2E42;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.glass-card-hoverable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(107, 97, 231, 0.1);
  border-color: rgba(107, 97, 231, 0.3);
}

/* ── Chat input ── */
.chat-input-pill-wrapper {
  background: #0D1018 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #1E2838 !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  width: 100% !important;
  max-width: 100% !important;
}

.chat-input-pill-wrapper:focus-within {
  border-color: #6b61e7 !important;
  box-shadow: 0 0 0 3px rgba(107, 97, 231, 0.15) !important;
  background: #0D1018 !important;
}

.chat-input-pill-wrapper textarea {
  background: transparent !important;
  color: #F0F0F5 !important;
}

/* Search input */
.search-input-container {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input-container:focus-within {
  border-color: #6b61e7 !important;
  box-shadow: 0 0 0 2px rgba(107, 97, 231, 0.15) !important;
}

/* ── Message bubbles ── */
.user-msg-bubble {
  background: rgba(107, 97, 231, 0.12) !important;
  border: 1px solid rgba(107, 97, 231, 0.25) !important;
  border-radius: 16px 16px 4px 16px !important;
  color: #F0F0F5 !important;
}

.ai-msg-bubble {
  background: #0D1018 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 1px solid #1E2838 !important;
  border-radius: 16px 16px 16px 4px !important;
  box-shadow: none !important;
  color: #F0F0F5 !important;
}

/* ── Primary button ── */
.btn-gradient {
  background: #6b61e7 !important;
  color: #ffffff !important;
  border-radius: 10px !important;
  border: none !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease !important;
  box-shadow: 0 2px 12px rgba(107, 97, 231, 0.3) !important;
}
.btn-gradient:hover:not(:disabled) {
  background: #4338ca !important;
  box-shadow: 0 6px 20px rgba(107, 97, 231, 0.4) !important;
  transform: translateY(-1px) !important;
}
.btn-gradient:active:not(:disabled) {
  transform: translateY(0) !important;
}
.btn-gradient:disabled {
  background: #1E2838 !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  color: #3D5068 !important;
}

/* ── Platform cards & tone chips ── */
.platform-card,
.tone-chip {
  transition: border-color 0.2s ease, background-color 0.2s ease !important;
  background: #151C28 !important;
  border-color: #1E2838 !important;
}
.platform-card:hover:not(.selected),
.tone-chip:hover:not(.selected) {
  background: #172030 !important;
  border-color: rgba(107, 97, 231, 0.4) !important;
}
.platform-card.selected,
.tone-chip.selected {
  border-color: #6b61e7 !important;
  background: rgba(107, 97, 231, 0.12) !important;
  box-shadow: 0 0 0 1px #6b61e7 !important;
  color: #a5a0ff !important;
}

/* ── Generated content tabs ── */
.generated-content-tabs {
  background: #151C28 !important;
  border-radius: 10px !important;
  padding: 4px !important;
}
.generated-content-tab {
  border-radius: 7px !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
  color: #8A9BB5 !important;
}
.generated-content-tab.active {
  background: #1E2838 !important;
  box-shadow: none !important;
  color: #6b61e7 !important;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .chat-avatar {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
  }

  .chat-input-area-container {
    padding: 10px 12px max(20px, env(safe-area-inset-bottom)) !important;
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, #080B10 20%, rgba(10,10,15,0.9) 60%, transparent) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .welcome-content-container {
    padding: 32px 16px 140px !important;
    justify-content: flex-start !important;
    gap: 20px !important;
  }

  .chat-input-pill-wrapper {
    width: 100% !important;
    margin: 0 auto;
    padding: 10px 14px !important;
    border-radius: 14px !important;
    background: #0D1018 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
    border: 1px solid #1E2838 !important;
  }

  .chat-input-pill-wrapper textarea {
    font-size: 16px !important;
    line-height: 1.5 !important;
  }

  .chat-input-helper-text { display: none !important; }

  .glass-card { border-radius: 14px !important; }

  .quick-suggestions {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .suggestions-card {
    padding: 14px 16px !important;
    min-height: 56px !important;
    font-size: 0.9rem !important;
    border-radius: 12px !important;
  }

  .suggestions-card-title {
    font-size: 1.6rem !important;
    text-align: center;
  }

  .btn-gradient {
    min-width: unset !important;
    width: 100% !important;
    min-height: 50px !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
  }

  .ai-msg-bubble { padding: 16px 14px !important; }

  .user-msg-bubble,
  .ai-msg-bubble {
    max-width: 100% !important;
    font-size: 0.9rem !important;
  }

  .platform-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  .platform-card {
    padding: 10px 8px !important;
    min-height: 64px !important;
    font-size: 0.78rem !important;
    border-radius: 10px !important;
  }

  .tone-chip {
    padding: 9px 12px !important;
    font-size: 0.82rem !important;
    min-height: 38px !important;
    border-radius: 8px !important;
  }

  .generated-content-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
    padding-bottom: 2px !important;
  }
  .generated-content-tabs::-webkit-scrollbar { display: none !important; }

  .generated-content-tab {
    white-space: nowrap !important;
    min-height: 36px !important;
    padding: 8px 14px !important;
    font-size: 0.82rem !important;
    flex-shrink: 0 !important;
  }

  .generated-content-display {
    padding: 14px !important;
    min-height: 200px !important;
    max-height: 50vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    font-size: 0.9rem !important;
    line-height: 1.6 !important;
  }

  .regeneration-options {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .regeneration-option {
    min-height: 42px !important;
    padding: 9px 14px !important;
    font-size: 0.82rem !important;
    flex: 1 1 calc(33% - 8px) !important;
    justify-content: center !important;
  }
}

/* ── Very small phones ── */
@media (max-width: 375px) {
  .chat-input-pill-wrapper {
    padding: 8px 10px !important;
    border-radius: 12px !important;
  }
  .chat-input-area-container {
    padding: 8px 10px max(16px, env(safe-area-inset-bottom)) !important;
  }
  .welcome-content-container {
    padding: 16px 12px 120px !important;
  }
  .glass-card { border-radius: 12px !important; }
  .platform-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .platform-card { min-height: 58px !important; font-size: 0.72rem !important; }
  .suggestions-card-title { font-size: 1.35rem !important; }
  .quick-suggestions { padding: 0 !important; }
  button, .btn-gradient, [class*="btn"] { min-height: 44px !important; }
  .generated-content-display { padding: 10px !important; font-size: 0.88rem !important; }
  .regeneration-option { flex: 1 1 calc(50% - 8px) !important; }
}

/* ── Tablet ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .chat-input-pill-wrapper { max-width: 700px !important; }
  .quick-suggestions { grid-template-columns: repeat(2, 1fr) !important; }
  .platform-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; }
}

/* ── Utilities ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(107, 97, 231, 0.2) transparent; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: rgba(107, 97, 231, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(107, 97, 231, 0.4); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
