/* app.css — Custom styles for CORSISTI platform */

/* ── Typography tweaks ────────────────────────────── */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── HTMX loading indicator ───────────────────────── */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline;
}

/* ── Global loading bar (top) ─────────────────────── */
#htmx-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  z-index: 9999;
  display: none;
  animation: loading-shimmer 1.5s infinite;
}
#htmx-loading.htmx-request {
  display: block;
}

@keyframes loading-shimmer {
  0%   { opacity: 0.6; }
  50%  { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ── Prose styles (Markdown rendering) ───────────── */

/* Base */
.prose {
  color: #374151;
  line-height: 1.75;
  font-size: 1rem;
}

/* Headings */
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}
.prose h1 { font-size: 2em; }
.prose h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.3em;
}
.prose h3 { font-size: 1.25em; }
.prose h4 { font-size: 1.1em; }
.prose h5, .prose h6 { font-size: 1em; }

/* Primo heading senza margine superiore */
.prose > h1:first-child,
.prose > h2:first-child,
.prose > h3:first-child {
  margin-top: 0;
}

/* Paragrafi */
.prose p {
  margin-bottom: 1.1em;
}

/* Link */
.prose a {
  color: #6366f1;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prose a:hover {
  color: #4338ca;
}

/* Bold / italic */
.prose strong { font-weight: 700; color: #111827; }
.prose em     { font-style: italic; }

/* Liste */
.prose ul {
  list-style-type: disc;
  padding-left: 1.625em;
  margin-bottom: 1em;
}
.prose ol {
  list-style-type: decimal;
  padding-left: 1.625em;
  margin-bottom: 1em;
}
.prose li {
  margin-bottom: 0.35em;
  line-height: 1.65;
}
.prose ul ul, .prose ol ol,
.prose ul ol, .prose ol ul {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

/* Task list (GFM) */
.prose li input[type="checkbox"] {
  margin-right: 0.4em;
  accent-color: #6366f1;
}

/* Separatore orizzontale */
.prose hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 2em 0;
}

/* Blockquote */
.prose blockquote {
  border-left: 4px solid #6366f1;
  padding: 0.5em 1em;
  margin: 1.2em 0;
  color: #64748b;
  font-style: italic;
  background-color: #f8faff;
  border-radius: 0 0.375rem 0.375rem 0;
}
.prose blockquote p { margin-bottom: 0; }

/* Codice inline */
.prose code:not(pre code) {
  background-color: #f1f5f9;
  color: #6366f1;
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}

/* Blocco codice */
.prose pre {
  background-color: #1e1e2e;
  color: #cdd6f4;
  border-radius: 0.5rem;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.875em;
  line-height: 1.6;
  margin: 1.25em 0;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
}
.prose pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Immagini */
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1.25em auto;
  display: block;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Tabelle (GFM) */
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  font-size: 0.95em;
}
.prose th,
.prose td {
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.prose th {
  background-color: #f8fafc;
  font-weight: 600;
  color: #1e293b;
}
.prose tr:nth-child(even) td {
  background-color: #f9fafb;
}

/* Strikethrough (GFM) */
.prose del { text-decoration: line-through; color: #94a3b8; }

/* ── Custom scrollbar ─────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── Quiz options ─────────────────────────────────── */
.quiz-option:disabled {
  cursor: default;
}

/* ── Sidebar navigation active state ─────────────── */
.nav-active {
  background-color: #eef2ff;
  color: #4338ca;
  font-weight: 600;
}

/* ── File input styling ───────────────────────────── */
input[type="file"]::file-selector-button {
  cursor: pointer;
}

/* ── Flash message animation ──────────────────────── */
@keyframes slide-in-top {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.flash-message {
  animation: slide-in-top 0.3s ease-out;
}

/* ── Responsive table ─────────────────────────────── */
@media (max-width: 640px) {
  .responsive-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
