/* ========================================================
   IT-TIDY MULTI-THEME STYLES (DARK, WHITE, WARM YELLOW)
   Uniform coverage for all informational cards and containers
   ======================================================== */

:root {
  --tidy-yellow: #ffbc28;
  --tidy-charcoal: #4b4b4d;
}

/* Universal smooth transition on all theme-affected elements */
*, *::before, *::after {
  transition: background-color 0.28s ease, border-color 0.28s ease, color 0.28s ease, box-shadow 0.28s ease;
}

/* ========================================================
   1. THEME: WHITE (Corporate Clean & High Contrast)
   ======================================================== */
html.theme-white body {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

/* Header & Nav */
html.theme-white header {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-bottom-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.theme-white nav a {
  color: #475569 !important;
}

html.theme-white nav a:hover,
html.theme-white nav a.text-tidy-yellow {
  color: #d97706 !important;
}

/* TUTTI I RIQUADRI INFORMATIVI ESTERNI E CARD */
html.theme-white [class*="bg-tidy-surface"],
html.theme-white [class*="bg-tidy-card"],
html.theme-white .bg-gradient-to-br,
html.theme-white .bg-gradient-to-b {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

/* Riquadri in evidenza (es. piano Enterprise) */
html.theme-white .border-tidy-yellow {
  border-color: #f59e0b !important;
}

/* TUTTI I RIQUADRI INTERNI, INPUT, TEXTAREA E BOX ANNIDATI */
html.theme-white [class*="bg-tidy-dark"],
html.theme-white textarea,
html.theme-white .prompt-chip {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.theme-white textarea {
  color: #0f172a !important;
}

html.theme-white textarea::placeholder {
  color: #64748b !important;
}

html.theme-white .prompt-chip:hover {
  background-color: #e2e8f0 !important;
  border-color: #d97706 !important;
  color: #b45309 !important;
}

/* Box di errore / warning all'interno delle card */
html.theme-white [class*="bg-red-950"] {
  background-color: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #991b1b !important;
}
html.theme-white [class*="bg-red-950"] .text-red-400 {
  color: #dc2626 !important;
}

/* Box accento giallo interno */
html.theme-white [class*="bg-tidy-yellow/10"],
html.theme-white [class*="bg-tidy-yellow/15"] {
  background-color: #fffbeb !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

/* Testi e tipografia */
html.theme-white h1,
html.theme-white h2,
html.theme-white h3,
html.theme-white h4,
html.theme-white .text-white {
  color: #0f172a !important;
}

html.theme-white p,
html.theme-white .text-slate-300,
html.theme-white .text-slate-400,
html.theme-white .text-slate-200 {
  color: #334155 !important;
}

html.theme-white .text-slate-500 {
  color: #64748b !important;
}

/* Bordi universali in white mode */
html.theme-white [class*="border-tidy-border"] {
  border-color: #e2e8f0 !important;
}

/* Markdown risposta AI */
html.theme-white #response-box {
  border-top-color: #e2e8f0 !important;
}

html.theme-white #response-content p,
html.theme-white #response-content li {
  color: #334155 !important;
}

html.theme-white #response-content code {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #b45309 !important;
}

html.theme-white #response-content pre {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

html.theme-white #response-content pre code {
  color: #0f172a !important;
}

/* Footer */
html.theme-white footer {
  background-color: #f1f5f9 !important;
  border-top-color: #e2e8f0 !important;
  color: #64748b !important;
}


/* ========================================================
   2. THEME: WARM YELLOW / AMBER ("Sul Giallino")
   ======================================================== */
html.theme-yellow body {
  background-color: #fefcf3 !important;
  color: #292524 !important;
}

/* Header & Nav */
html.theme-yellow header {
  background-color: rgba(254, 252, 232, 0.96) !important;
  border-bottom-color: #fde047 !important;
  box-shadow: 0 1px 4px rgba(253, 224, 71, 0.2);
}

html.theme-yellow nav a {
  color: #57534e !important;
}

html.theme-yellow nav a:hover,
html.theme-yellow nav a.text-tidy-yellow {
  color: #b45309 !important;
}

/* TUTTI I RIQUADRI INFORMATIVI ESTERNI E CARD */
html.theme-yellow [class*="bg-tidy-surface"],
html.theme-yellow [class*="bg-tidy-card"],
html.theme-yellow .bg-gradient-to-br,
html.theme-yellow .bg-gradient-to-b {
  background: #fffbeb !important;
  background-color: #fffbeb !important;
  border-color: #fde047 !important;
  color: #292524 !important;
  box-shadow: 0 4px 14px rgba(254, 240, 138, 0.35) !important;
}

html.theme-yellow .border-tidy-yellow {
  border-color: #f59e0b !important;
}

/* TUTTI I RIQUADRI INTERNI, INPUT, TEXTAREA E BOX ANNIDATI */
html.theme-yellow [class*="bg-tidy-dark"],
html.theme-yellow textarea,
html.theme-yellow .prompt-chip {
  background-color: #fef9c3 !important;
  border-color: #facc15 !important;
  color: #292524 !important;
}

html.theme-yellow textarea {
  color: #292524 !important;
}

html.theme-yellow textarea::placeholder {
  color: #78716c !important;
}

html.theme-yellow .prompt-chip:hover {
  background-color: #fef08a !important;
  border-color: #ca8a04 !important;
  color: #854d0e !important;
}

/* Box di errore / warning interni */
html.theme-yellow [class*="bg-red-950"] {
  background-color: #fff1f2 !important;
  border-color: #fecdd3 !important;
  color: #9f1239 !important;
}
html.theme-yellow [class*="bg-red-950"] .text-red-400 {
  color: #e11d48 !important;
}

/* Box accento giallo interno */
html.theme-yellow [class*="bg-tidy-yellow/10"],
html.theme-yellow [class*="bg-tidy-yellow/15"] {
  background-color: #fef08a !important;
  border-color: #eab308 !important;
  color: #854d0e !important;
}

/* Testi e tipografia */
html.theme-yellow h1,
html.theme-yellow h2,
html.theme-yellow h3,
html.theme-yellow h4,
html.theme-yellow .text-white {
  color: #292524 !important;
}

html.theme-yellow p,
html.theme-yellow .text-slate-300,
html.theme-yellow .text-slate-400,
html.theme-yellow .text-slate-200 {
  color: #44403c !important;
}

html.theme-yellow .text-slate-500 {
  color: #78716c !important;
}

/* Bordi universali in warm yellow mode */
html.theme-yellow [class*="border-tidy-border"] {
  border-color: #fde047 !important;
}

/* Markdown risposta AI */
html.theme-yellow #response-box {
  border-top-color: #fde047 !important;
}

html.theme-yellow #response-content p,
html.theme-yellow #response-content li {
  color: #44403c !important;
}

html.theme-yellow #response-content code {
  background-color: #fef08a !important;
  border-color: #eab308 !important;
  color: #92400e !important;
}

html.theme-yellow #response-content pre {
  background-color: #fef9c3 !important;
  border-color: #fde047 !important;
}

html.theme-yellow #response-content pre code {
  color: #292524 !important;
}

/* Footer */
html.theme-yellow footer {
  background-color: #fef9c3 !important;
  border-top-color: #fde047 !important;
  color: #78716c !important;
}

/* ========================================================
   3. THEME: DARK MODE (When explicitly selected)
   ======================================================== */
html.theme-dark body {
  background-color: #0c0f17 !important;
  color: #f8fafc !important;
}

html.theme-dark header {
  background-color: rgba(12, 15, 23, 0.9) !important;
  border-bottom-color: #232d45 !important;
}

html.theme-dark nav a {
  color: #cbd5e1 !important;
}

html.theme-dark nav a:hover,
html.theme-dark nav a.text-tidy-yellow {
  color: #ffbc28 !important;
}

html.theme-dark [class*="bg-tidy-surface"] {
  background-color: #131826 !important;
  border-color: #232d45 !important;
  color: #f8fafc !important;
}

html.theme-dark [class*="bg-tidy-card"] {
  background-color: #182033 !important;
  border-color: #232d45 !important;
  color: #f8fafc !important;
}

html.theme-dark [class*="bg-tidy-dark"],
html.theme-dark textarea {
  background-color: #0c0f17 !important;
  border-color: #232d45 !important;
  color: #f8fafc !important;
}

html.theme-dark footer {
  background-color: #0c0f17 !important;
  border-top-color: #232d45 !important;
  color: #64748b !important;
}


/* ========================================================
   Common Utilities & Animations
   ======================================================== */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.mode-tab.active {
  background-color: var(--tidy-yellow);
  color: #0c0f17;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Markdown typography base */
#response-content h1,
#response-content h2,
#response-content h3 {
  font-weight: 700;
  margin-top: 0.8rem;
  margin-bottom: 0.4rem;
}

#response-content h1 { font-size: 1.25rem; color: var(--tidy-yellow); }
#response-content h2 { font-size: 1.1rem; }
#response-content h3 { font-size: 0.95rem; }

#response-content p {
  margin-bottom: 0.6rem;
  line-height: 1.6;
}

#response-content ul,
#response-content ol {
  margin-left: 1.25rem;
  margin-bottom: 0.6rem;
  list-style-type: disc;
}

#response-content li {
  margin-bottom: 0.25rem;
}

#response-content code {
  font-family: 'JetBrains Mono', monospace;
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-size: 0.85em;
  border: 1px solid rgba(255, 188, 40, 0.2);
}

#response-content pre {
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

#response-content pre code {
  background: transparent;
  border: none;
  padding: 0;
}

#response-content blockquote {
  border-left: 3px solid var(--tidy-yellow);
  padding-left: 0.75rem;
  margin: 0.75rem 0;
  font-style: italic;
  background: rgba(255, 188, 40, 0.05);
  border-radius: 0 0.375rem 0.375rem 0;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

/* Typing cursor */
.typing-cursor::after {
  content: '▋';
  display: inline-block;
  color: var(--tidy-yellow);
  animation: blink 1s step-start infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}
