/* ================================================================
   DASHBOARD DESIGN SYSTEM — "Bold Intelligence" Layout
   Sidebar + Main Content app shell matching reference design.
   Loaded AFTER variables.css and Tailwind to override inline styles.
================================================================ */

/* ----------------------------------------------------------------
   APP SHELL — Sidebar + Main layout
---------------------------------------------------------------- */
body.dashboard-page {
  background: var(--bg-primary) !important;
  font-family: var(--font-body) !important;
  color: var(--text-primary) !important;
  overflow-x: hidden;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--nav-height);
}

/* ----------------------------------------------------------------
   SCROLLBAR
---------------------------------------------------------------- */
body.dashboard-page::-webkit-scrollbar { width: 8px; }
body.dashboard-page::-webkit-scrollbar-track { background: var(--bg-deep); }
body.dashboard-page::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
body.dashboard-page::-webkit-scrollbar-thumb:hover { background: rgba(11,61,86,0.8); }

/* ----------------------------------------------------------------
   NAVBAR — App navbar style
---------------------------------------------------------------- */
body.dashboard-page .glass-nav,
body.dashboard-page nav.fixed {
  background: var(--bg-deep) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-bottom: 1px solid var(--border-dark) !important;
}

body.dashboard-page nav .flex.items-center.h-20 {
  height: var(--nav-height) !important;
}

/* Usage bar in navbar */
.usage-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
}
.usage-nav .usage-label {
  font-weight: 600;
  color: var(--accent);
}

/* Avatar button — dashboard overrides (base styles in variables.css) */
body.dashboard-page .avatar-btn {
  width: auto !important;
  height: auto !important;
  box-shadow: none !important;
}

body.dashboard-page #signin-link {
  color: var(--text-muted) !important;
}
body.dashboard-page #signin-link:hover {
  color: var(--text-primary) !important;
}

/* ----------------------------------------------------------------
   SIDEBAR
---------------------------------------------------------------- */
.dashboard-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-deep);
  border-right: 1px solid var(--border-dark);
  height: calc(100vh - var(--nav-height));
  position: sticky;
  top: var(--nav-height);
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.sidebar-plan {
  margin: 0 12px 20px;
  padding: 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
}

.plan-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.plan-name-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.plan-free-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-upgrade-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--cta);
  text-decoration: none;
}
.plan-upgrade-link:hover {
  text-decoration: underline;
}

.plan-usage-bar {
  margin-top: 10px;
}

.plan-usage-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.sidebar-usage-progress {
  width: 100%;
  height: 4px;
  background: var(--bg-deeper);
  border-radius: 2px;
  overflow: hidden;
}

.sidebar-usage-bar {
  height: 100%;
  background: var(--cta);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 24px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--ease);
  text-decoration: none;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: var(--cta-subtle);
  color: var(--cta);
  font-weight: 600;
  border-left: 3px solid var(--cta);
  padding-left: 9px;
}

.sidebar-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

/* ----------------------------------------------------------------
   MAIN CONTENT
---------------------------------------------------------------- */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  background: var(--bg-primary);
  min-width: 0;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ----------------------------------------------------------------
   STATS GRID — 4 cards
---------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: var(--ease);
}

.stat-card:hover {
  border-color: rgba(11,61,86,0.8);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-unit {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-change {
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
  margin-top: 2px;
}

/* ----------------------------------------------------------------
   COMPOSER CARD — Wraps the prompt form
---------------------------------------------------------------- */
.composer-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.composer-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----------------------------------------------------------------
   PROMPT INPUT (Radiant Wrapper) — Inside composer
---------------------------------------------------------------- */
body.dashboard-page .radiant-prompt-wrapper {
  background: var(--bg-deeper) !important;
  border-radius: var(--radius-lg) !important;
  max-width: 100% !important;
}

body.dashboard-page .radiant-prompt-wrapper textarea {
  font-family: var(--font-body) !important;
  color: var(--text-primary) !important;
  line-height: 1.65 !important;
}

body.dashboard-page .radiant-prompt-wrapper textarea::placeholder {
  color: var(--text-muted) !important;
}

body.dashboard-page .radiant-prompt-wrapper .text-xs.text-zinc-500 {
  color: var(--text-muted) !important;
}
body.dashboard-page .radiant-prompt-wrapper .text-zinc-300 {
  color: var(--accent) !important;
}

/* ----------------------------------------------------------------
   FRAMEWORK TOOLBAR — Chip-style
---------------------------------------------------------------- */
.fw-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  margin: 12px 0;
}

.fw-toolbar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-right: 4px;
}

.fw-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
  cursor: pointer;
  transition: var(--ease);
}
.fw-chip.active, .fw-chip:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent-border);
}

.fw-auto-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
}

/* ----------------------------------------------------------------
   ENHANCE BUTTON — CTA
---------------------------------------------------------------- */
body.dashboard-page #magicWandBtn {
  background: var(--cta) !important;
  color: #fff !important;
  font-family: var(--font-body) !important;
  font-weight: 600 !important;
  border-radius: var(--radius-md) !important;
  transition: var(--ease) !important;
}

body.dashboard-page #magicWandBtn:hover:not(:disabled) {
  background: var(--cta-hover) !important;
  box-shadow: var(--shadow-cta) !important;
  transform: translateY(-1px) !important;
}

body.dashboard-page #magicWandBtn:active:not(:disabled) {
  transform: translateY(0) !important;
}

/* ----------------------------------------------------------------
   TOOLBAR BUTTONS — Framework, Advanced, History
---------------------------------------------------------------- */
body.dashboard-page [role="toolbar"] button,
body.dashboard-page #toolbarFrameworkBtn,
body.dashboard-page #toolbarAdvancedBtn,
body.dashboard-page #toolbarHistoryBtn {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-body) !important;
  border-radius: var(--radius-md) !important;
  transition: var(--ease) !important;
}

body.dashboard-page [role="toolbar"] button:hover,
body.dashboard-page #toolbarFrameworkBtn:hover,
body.dashboard-page #toolbarAdvancedBtn:hover,
body.dashboard-page #toolbarHistoryBtn:hover {
  background: rgba(11,61,86,0.5) !important;
  border-color: var(--cta-border) !important;
}

body.dashboard-page #currentFrameworkBadge {
  background: var(--cta-subtle) !important;
  color: var(--cta) !important;
  border: 1px solid var(--cta-border) !important;
  border-radius: var(--radius-md) !important;
  font-weight: 700 !important;
}

/* ----------------------------------------------------------------
   EXPANDED SECTIONS — Framework, Advanced, History panels
---------------------------------------------------------------- */
body.dashboard-page .glass-card,
body.dashboard-page #frameworkSectionContainer .glass-card,
body.dashboard-page #advancedSectionContainer .glass-card,
body.dashboard-page #historySectionContainer .glass-card {
  background: var(--bg-deep) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-sm) !important;
}

body.dashboard-page #frameworkAccordion button {
  color: var(--text-primary) !important;
  font-family: var(--font-body) !important;
}

body.dashboard-page #frameworkAccordion button:hover {
  background: rgba(11,61,86,0.3) !important;
}

body.dashboard-page #quickStartBtn {
  background: var(--cta-subtle) !important;
  color: var(--cta) !important;
  border: 1px solid var(--cta-border) !important;
  font-weight: 600 !important;
}
body.dashboard-page #quickStartBtn:hover {
  background: rgba(247,127,0,0.2) !important;
}

/* Advanced settings inputs */
body.dashboard-page #advancedSectionContainer input,
body.dashboard-page #advancedSectionContainer select {
  background: var(--bg-deeper) !important;
  border: 1.5px solid var(--border-dark) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
}

body.dashboard-page #advancedSectionContainer input:focus,
body.dashboard-page #advancedSectionContainer select:focus {
  border-color: var(--cta) !important;
  box-shadow: 0 0 0 3px rgba(247,127,0,0.12) !important;
}

body.dashboard-page #advancedSectionContainer label {
  color: var(--text-muted) !important;
  font-weight: 600 !important;
}

/* Industry tags */
body.dashboard-page #industryTags button {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  color: var(--text-muted) !important;
  border-radius: var(--radius-pill) !important;
}

body.dashboard-page #industryTags button:hover,
body.dashboard-page #industryTags button.active {
  background: var(--accent-subtle) !important;
  border-color: var(--accent-border) !important;
  color: var(--accent) !important;
}

/* ----------------------------------------------------------------
   AI SUGGESTIONS
---------------------------------------------------------------- */
body.dashboard-page #aiSuggestionsContainer {
  background: var(--bg-deep) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-xl) !important;
}

body.dashboard-page #aiSuggestionsContainer h3 {
  color: var(--text-primary) !important;
  font-family: var(--font-heading) !important;
}

body.dashboard-page #aiSuggestionsContainer .fa-bolt {
  color: var(--cta) !important;
}

body.dashboard-page #aiSuggestionsChips button {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  color: var(--text-muted) !important;
  border-radius: var(--radius-pill) !important;
  font-family: var(--font-body) !important;
}

body.dashboard-page #aiSuggestionsChips button:hover {
  border-color: var(--cta-border) !important;
  color: var(--cta) !important;
  background: var(--cta-subtle) !important;
}

/* ----------------------------------------------------------------
   OUTPUT SECTION
---------------------------------------------------------------- */
body.dashboard-page #outputSection {
  background: var(--bg-deep) !important;
  border: 1px solid var(--border-dark) !important;
  border-left: 3px solid var(--cta) !important;
  border-radius: var(--radius-xl) !important;
}

body.dashboard-page #metrics > div {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-md) !important;
}
body.dashboard-page #metrics > div:hover {
  border-color: var(--cta-border) !important;
}

body.dashboard-page #outputContent {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-lg) !important;
}

body.dashboard-page #frameworkBadge {
  background: var(--accent-subtle) !important;
  color: var(--accent) !important;
  border: 1px solid var(--accent-border) !important;
  border-radius: var(--radius-pill) !important;
  font-weight: 700 !important;
}

body.dashboard-page #copyBtn {
  background: var(--success) !important;
  color: #fff !important;
  border-radius: var(--radius-md) !important;
}
body.dashboard-page #copyBtn:hover {
  background: #0e9f6e !important;
}

body.dashboard-page #downloadBtn {
  background: var(--bg-deeper) !important;
  border: 1.5px solid var(--border-dark) !important;
  color: var(--text-muted) !important;
  border-radius: var(--radius-md) !important;
}
body.dashboard-page #downloadBtn:hover {
  border-color: var(--cta-border) !important;
  color: var(--text-primary) !important;
}

/* Empty state */
body.dashboard-page #emptyState h3 {
  font-family: var(--font-heading) !important;
  color: var(--text-primary) !important;
}
body.dashboard-page #emptyState p { color: var(--text-muted) !important; }
body.dashboard-page #emptyState .fa-bolt { color: var(--cta) !important; }

body.dashboard-page #emptyState button {
  background: var(--bg-deep) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-lg) !important;
}
body.dashboard-page #emptyState button:hover {
  border-color: var(--cta-border) !important;
  background: rgba(11,61,86,0.3) !important;
}
body.dashboard-page #emptyState button:hover p { color: var(--cta) !important; }

/* ----------------------------------------------------------------
   GENERATED CONTENT
---------------------------------------------------------------- */
body.dashboard-page #generatedContent {
  font-family: var(--font-mono) !important;
  color: var(--text-secondary) !important;
  line-height: 1.75 !important;
}

/* ----------------------------------------------------------------
   RECENT PROMPTS TABLE
---------------------------------------------------------------- */
.table-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 24px;
}

.table-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border-dark);
}

.table-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
}

.table-card th {
  text-align: left;
  padding: 10px 22px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-dark);
}

.table-card td {
  padding: 13px 22px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(11,61,86,0.4);
  vertical-align: middle;
}
.table-card tr:last-child td { border-bottom: none; }
.table-card tr:hover td { background: rgba(255,255,255,0.015); }

.td-prompt {
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 22px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
}
.score-pill.good { background: var(--success-subtle); color: var(--success); }
.score-pill.avg { background: var(--accent-subtle); color: var(--accent); }
.score-pill.low { background: var(--danger-subtle); color: var(--danger); }

.badge-framework {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.table-card .btn-ghost-sm {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-dark);
  cursor: pointer;
  transition: var(--ease);
}
.table-card .btn-ghost-sm:hover {
  border-color: var(--cta-border);
  color: var(--cta);
  background: var(--cta-subtle);
}

.table-empty-state {
  padding: 40px 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ----------------------------------------------------------------
   MISC ELEMENTS
---------------------------------------------------------------- */
body.dashboard-page #helpText { color: var(--text-muted) !important; }
body.dashboard-page #helpText strong { color: var(--text-primary) !important; }
body.dashboard-page #charCount { color: var(--text-muted) !important; }

body.dashboard-page #frameworkHintPill > div {
  background: var(--cta-subtle) !important;
  color: var(--cta) !important;
  border: 1px solid var(--cta-border) !important;
  border-radius: var(--radius-pill) !important;
}

body.dashboard-page #taskValidationError { color: var(--danger) !important; }

body.dashboard-page kbd {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-muted) !important;
}

body.dashboard-page #suggestions {
  background: var(--cta-subtle) !important;
  border: 1px solid var(--cta-border) !important;
  border-radius: var(--radius-lg) !important;
}
body.dashboard-page #suggestions h4 {
  color: var(--cta) !important;
  font-family: var(--font-heading) !important;
}

/* ----------------------------------------------------------------
   FOOTER
---------------------------------------------------------------- */
body.dashboard-page footer {
  background: transparent !important;
  border-top: 1px solid var(--border-dark) !important;
  color: var(--text-muted) !important;
  padding: 16px 36px !important;
  margin-left: 240px; /* Match sidebar width */
}
body.dashboard-page footer a { color: var(--text-muted) !important; }
body.dashboard-page footer a:hover { color: var(--cta) !important; }

/* ----------------------------------------------------------------
   MOBILE MENU
---------------------------------------------------------------- */
body.dashboard-page #mobile-menu {
  background: var(--bg-deep) !important;
  border-top: 1px solid var(--border-dark) !important;
}
body.dashboard-page #mobile-menu a { color: var(--text-muted) !important; }
body.dashboard-page #mobile-menu a:hover {
  color: var(--text-primary) !important;
  background: rgba(11,61,86,0.3) !important;
}
body.dashboard-page #mobile-signin-link {
  background: var(--cta-subtle) !important;
  color: var(--cta) !important;
  border: 1px solid var(--cta-border) !important;
}

/* History section */
body.dashboard-page #historyTimeline > * {
  background: var(--bg-deeper) !important;
  border: 1px solid var(--border-dark) !important;
  border-radius: var(--radius-md) !important;
}
body.dashboard-page #historyTimeline > *:hover { border-color: var(--cta-border) !important; }
body.dashboard-page #historyEmpty { color: var(--text-muted) !important; }

/* Typography */
body.dashboard-page h2,
body.dashboard-page h3 {
  font-family: var(--font-heading) !important;
  letter-spacing: -0.02em !important;
}

/* Focus */
body.dashboard-page *:focus-visible {
  outline: 2px solid var(--cta) !important;
  outline-offset: 2px !important;
}

/* ----------------------------------------------------------------
   RESPONSIVE — Mobile
---------------------------------------------------------------- */
@media (max-width: 900px) {
  .dashboard-sidebar {
    display: none;
  }
  .main-content {
    padding: 20px 16px !important;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  body.dashboard-page footer {
    margin-left: 0 !important;
  }
}

@media (max-width: 768px) {
  body.dashboard-page .glass-card {
    background: var(--bg-deep) !important;
    border-radius: var(--radius-xl) !important;
    border: 1px solid var(--border-dark) !important;
  }

  body.dashboard-page #magicWandBtn {
    background: linear-gradient(135deg, var(--cta) 0%, var(--accent) 100%) !important;
  }

  body.dashboard-page [role="toolbar"] {
    background: var(--bg-deeper) !important;
    border-radius: var(--radius-lg) !important;
  }

  body.dashboard-page [role="toolbar"] button {
    background: transparent !important;
    border: none !important;
    color: var(--text-muted) !important;
  }

  body.dashboard-page [role="toolbar"] button[aria-expanded="true"],
  body.dashboard-page [role="toolbar"] button.ios-active {
    background: var(--bg-deep) !important;
    color: var(--text-primary) !important;
  }

  .composer-card {
    padding: 16px !important;
    border-radius: var(--radius-lg) !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-value { font-size: 22px; }

  .table-card { display: none; }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stat-card { padding: 14px 16px; }
}
