/* =============================================================================
   APP CSS UNIFICATO - STILE CLIKKI
   Contiene: Comparatore Polizze + Chatbot AI
   Palette: #332830 (dark), #294b78 (navy), #2F4F4F (text), white (bg)
   Font: Baloo 2 (body), Fjalla One (titoli/bottoni), Prompt (h1/special)
   ============================================================================= */

/* =============================================================================
   LAYOUT BASE - STILI GLOBALI
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600&family=Fjalla+One&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Baloo 2', sans-serif;
  font-weight: normal;
  font-size: 16px;
  min-height: 100vh;
  background-color: #FFFFFF;
  color: #2F4F4F;
}

a:link, a:visited {
  color: slateblue;
  text-decoration: none;
  font-weight: normal;
}

a:hover, a:active {
  color: red;
}

/* =============================================================================
   NAVBAR - NAVIGAZIONE PRINCIPALE
   ============================================================================= */

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: white;
  padding: 4px 16px;
  position: sticky;
  top: 0;
  z-index: 1000;
  overflow: hidden;
}

.nav-brand {
  color: #332830;
  font-family: 'Fjalla One', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-brand:hover {
  color: red;
}

.nav-links {
  display: flex;
  gap: 0;
}

.nav-links a {
  color: #332830;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 10px;
  transition: all 0.2s;
}

.nav-links a:hover {
  color: white;
  background-color: #555;
}

@media (max-width: 600px) {
  .top-nav {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }

  .nav-links {
    gap: 0;
  }

  .nav-links a {
    font-size: 14px;
    padding: 8px 10px;
  }
}

/* =============================================================================
   COMPARATORE POLIZZE - STILI
   ============================================================================= */

/* Layout generale */
.comparatore-container,
.comparatore-risultati {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

.section.centerx {
  text-align: center;
  margin-bottom: 30px;
}

.section.centerx h2 {
  font-family: 'Fjalla One', sans-serif;
  font-size: 28px;
  color: darkslategrey;
  margin-bottom: 10px;
}

.subtitle {
  color: #2F4F4F;
  font-size: 14px;
}

/* Alert */
.alert {
  padding: 15px 20px;
  margin-bottom: 20px;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-error a {
  color: #991b1b;
  text-decoration: underline;
}

/* Form */
.comparatore-form {
  background: white;
  padding: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: darkslategrey;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 16px;
  border: 1px solid gainsboro;
  font-size: 16px;
  font-family: 'Baloo 2', sans-serif;
  transition: background-color 0.2s;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  background-color: lavender;
}

.form-section-title {
  font-family: 'Fjalla One', sans-serif;
  font-size: 16px;
  color: darkslategrey;
  margin: 30px 0 15px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid gainsboro;
}

.form-row {
  display: flex;
  gap: 20px;
}

.pax-row .pax-group {
  flex: 1;
}

.pax-total {
  text-align: right;
  font-weight: 600;
  color: #294b78;
  margin: 10px 0 20px 0;
  font-size: 16px;
}

.hint {
  display: block;
  font-size: 12px;
  color: darkslategray;
  margin-top: 5px;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid gainsboro;
}

/* Buttons - stile Clikki (outlined) */
.btn-primary {
  font-family: 'Fjalla One', sans-serif;
  font-size: 18px;
  padding: 14px 40px;
  background-color: white;
  color: #332830;
  border: 2px solid #332830;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background-color: #332830;
  color: white;
}

.btn-primary:disabled {
  background-color: #cccccc;
  border-color: #cccccc;
  color: #999;
  cursor: not-allowed;
}

.btn-secondary {
  font-family: 'Fjalla One', sans-serif;
  font-size: 18px;
  padding: 14px 40px;
  background-color: white;
  color: #332830;
  border: 2px solid #332830;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background-color: #332830;
  color: white;
}

.btn-link {
  color: slateblue;
  text-decoration: underline;
}

.btn-link:hover {
  color: red;
}

/* Info Viaggio */
.info-viaggio {
  background-color: #294b78;
  color: white;
  padding: 25px 30px;
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.info-row {
  display: flex;
  flex-direction: column;
}

.info-label {
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 4px;
}

.info-value {
  font-size: 16px;
  font-weight: 600;
}

.info-value.highlight {
  color: #ffd93d;
}

/* Tabella Comparativa */
.comparatore-table {
  background: white;
  overflow: hidden;
}

.table-row {
  display: flex;
  border-bottom: 1px solid gainsboro;
}

.table-row:last-child {
  border-bottom: none;
}

.table-cell {
  flex: 1;
  padding: 12px 15px;
  text-align: center;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.label-cell {
  flex: 0 0 200px;
  text-align: left;
  justify-content: flex-start;
  font-weight: 500;
  color: darkslategrey;
  background-color: #f8f9fa;
}

/* Header prodotti */
.header-row {
  background-color: #154A98;
}

.header-row .label-cell {
  background-color: #154A98;
}

.prodotto-header {
  font-family: 'Fjalla One', sans-serif;
  font-size: 14px;
  color: white;
}

.prodotto-link {
  color: white;
  text-decoration: none;
  transition: color 0.2s;
}

.prodotto-link:hover {
  color: red;
}

.prodotto-nome {
  color: white;
}

/* Premio */
.premio-row {
  background-color: #fef9e7;
}

.premio-row .label-cell {
  background-color: #fef3c7;
}

.premio {
  font-family: 'Fjalla One', sans-serif;
  font-size: 20px;
  color: #c0392b;
}

.da-calcolare {
  font-size: 12px;
  color: darkslategray;
  font-style: italic;
}

/* Pulsanti selezione */
.button-row {
  padding: 15px 0;
}

.btn-select {
  font-family: 'Fjalla One', sans-serif;
  font-size: 14px;
  padding: 8px 20px;
  background-color: white;
  color: #332830;
  border: 2px solid #332830;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-select:hover {
  background-color: #332830;
  color: white;
}

/* Accordion - stile Clikki (collapsible) */
.accordion {
  font-family: 'Baloo 2', sans-serif;
  background-color: white;
  color: darkslategrey;
  cursor: pointer;
  padding: 18px 20px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 15px;
  transition: 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion:hover,
.accordion.active {
  background-color: steelblue;
  color: white;
}

.accordion:after {
  content: '\25BC';
  font-size: 12px;
  transition: transform 0.2s;
}

.accordion.active:after {
  content: '\25B2';
}

.panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background-color: white;
}

.panel.show {
  max-height: 2000px;
}

.garanzia-row:nth-child(odd) {
  background-color: #f8f9fa;
}

.garanzia-row:nth-child(odd) .label-cell {
  background-color: #f1f3f4;
}

/* Valori celle */
.checkmark {
  color: seagreen;
  font-size: 18px;
}

.crossmark {
  color: orangered;
  font-size: 18px;
}

.na-mark {
  color: darkslategray;
  font-size: 14px;
}

.valore-importo {
  font-weight: 600;
  color: #2F4F4F;
}

.valore-testo {
  font-size: 11px;
  color: darkslategray;
}

.no-garanzie {
  padding: 40px;
  text-align: center;
  color: darkslategray;
}

/* Responsive Comparatore */
@media (max-width: 768px) {
  .comparatore-container,
  .comparatore-risultati {
    padding: 15px;
  }

  .comparatore-form {
    padding: 20px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .info-viaggio {
    grid-template-columns: 1fr;
  }

  .table-row {
    flex-wrap: wrap;
  }

  .label-cell {
    flex: 0 0 100%;
    background-color: #e8e8e8 !important;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
  }

  .table-cell {
    flex: 1;
    min-width: 80px;
    font-size: 12px;
    padding: 10px 8px;
  }

  .prodotto-header {
    font-size: 12px;
  }

  .premio {
    font-size: 16px;
  }

  .btn-select {
    font-size: 11px;
    padding: 8px 12px;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}


/* =============================================================================
   CHATBOT AI - STILI (Bootstrap-based /chatbot page)
   ============================================================================= */

/* Container principale Chatbot */
.chatbot-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    background-color: #FFFFFF;
    font-family: 'Baloo 2', sans-serif;
    position: relative;
}

/* Header Chatbot */
.chatbot-header {
    background-color: #294b78;
    color: white;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

.chatbot-header h5 {
    font-family: 'Fjalla One', sans-serif;
    font-weight: 500;
    margin: 0;
}

.chatbot-header .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.chatbot-header .btn-outline-secondary {
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.chatbot-header .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: white;
}

/* Indicatore stato */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.online {
    background-color: seagreen;
}

.status-dot.offline {
    background-color: orangered;
}

/* Area Messaggi */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Scrollbar personalizzata */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: silver;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: darkslategray;
}

/* Messaggi (Bubble Style) */
.chatbot-container .message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

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

/* Messaggio utente - allineato a destra */
.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-message .message-content {
    background-color: #294b78;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

/* Messaggio bot - allineato a sinistra */
.bot-message {
    align-self: flex-start;
}

.bot-message .message-content {
    background: white;
    color: #2F4F4F;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid gainsboro;
}

/* Contenuto messaggio */
.chatbot-container .message-content {
    padding: 0.875rem 1.25rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-container .message-content p {
    margin-bottom: 0.5rem;
}

.chatbot-container .message-content p:last-child {
    margin-bottom: 0;
}

.chatbot-container .message-content ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

/* Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.user-message .message-avatar {
    background-color: #294b78;
    color: white;
}

.bot-message .message-avatar {
    background-color: gainsboro;
    color: #294b78;
}

/* Blocco SQL */
.sql-block {
    margin-top: 1rem;
    border: 1px solid gainsboro;
    overflow: hidden;
    background: #f1f1f1;
}

.sql-header {
    background: gainsboro;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: darkslategrey;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sql-header .copy-sql {
    padding: 0;
    color: darkslategray;
    text-decoration: none;
}

.sql-header .copy-sql:hover {
    color: #332830;
}

.sql-block pre {
    margin: 0;
    padding: 1rem;
    background: #002F6C;
    overflow-x: auto;
}

.sql-block code {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #e0e0e0;
    white-space: pre-wrap;
}

/* Blocco Errore */
.error-block {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    color: orangered;
    font-size: 0.9rem;
}

/* Area Risultati Tabella */
.chatbot-results {
    background: white;
    border-top: 1px solid gainsboro;
    max-height: 40vh;
    display: flex;
    flex-direction: column;
}

.chatbot-results .results-header {
    padding: 0.75rem 1rem;
    background: #f1f1f1;
    border-bottom: 1px solid gainsboro;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: darkslategrey;
}

.results-footer {
    padding: 0.75rem 1rem;
    background: #f1f1f1;
    border-top: 1px solid gainsboro;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: darkslategray;
}

.table-responsive {
    flex: 1;
    overflow: auto;
}

.chatbot-results .table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.chatbot-results .table th {
    position: sticky;
    top: 0;
    background: #154A98;
    color: white;
    white-space: nowrap;
    font-weight: 600;
}

.chatbot-results .table td {
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Area Input Chatbot */
.chatbot-input {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid gainsboro;
    flex-shrink: 0;
}

.chatbot-input .input-group {
    overflow: hidden;
}

.chatbot-input .form-control {
    border: 1px solid gainsboro;
    border-right: none;
    padding: 0.875rem 1.25rem;
    font-size: 16px;
    font-family: 'Baloo 2', sans-serif;
}

.chatbot-input .form-control:focus {
    background-color: lavender;
    border-color: gainsboro;
    box-shadow: none;
}

.chatbot-input .btn-primary {
    background-color: #332830;
    color: white;
    border: 2px solid #332830;
    padding: 0.875rem 1.5rem;
}

.chatbot-input .btn-primary:hover {
    background-color: #555;
    border-color: #555;
}

.input-hint {
    text-align: center;
    margin-top: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    gap: 1rem;
}

.loading-text {
    color: #294b78;
    font-weight: 500;
}

/* Dropdown Menu */
.dropdown-menu {
    min-width: 220px;
    border: 1px solid gainsboro;
    padding: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 0.75rem;
}

.dropdown-item:hover {
    background-color: gainsboro;
}

.dropdown-item-text {
    padding: 0.5rem 0.75rem;
}

/* AI Response Markdown */
.ai-response {
    line-height: 1.6;
}

.ai-response h1,
.ai-response h2,
.ai-response h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-family: 'Fjalla One', sans-serif;
    font-weight: 500;
}

.ai-response h1 { font-size: 1.25rem; }
.ai-response h2 { font-size: 1.1rem; }
.ai-response h3 { font-size: 1rem; }

.ai-response code {
    background: #f1f1f1;
    padding: 0.15rem 0.4rem;
    font-size: 0.85em;
    color: orangered;
}

.ai-response pre {
    background: #002F6C;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.ai-response pre code {
    background: transparent;
    color: #e0e0e0;
    padding: 0;
}

.ai-response blockquote {
    border-left: 4px solid steelblue;
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: darkslategrey;
}

.ai-response table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.875rem;
}

.ai-response th,
.ai-response td {
    border: 1px solid gainsboro;
    padding: 0.5rem;
    text-align: left;
}

.ai-response th {
    background: #f1f1f1;
    font-weight: 600;
}

/* Utility Classes */
.text-muted {
    color: darkslategray !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Chatbot */
@media (max-width: 768px) {
    .chatbot-container {
        height: 100vh;
        height: -webkit-fill-available;
    }

    .chatbot-container .message {
        max-width: 95%;
    }

    .chatbot-messages {
        padding: 1rem;
    }

    .chatbot-input {
        padding: 0.75rem 1rem;
    }

    .chatbot-results {
        max-height: 50vh;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .chatbot-header {
        padding: 0.75rem 1rem;
    }

    .chatbot-header h5 {
        font-size: 1rem;
    }

    .chatbot-container .message-content {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .sql-block code {
        font-size: 0.75rem;
    }
}


/* =============================================================================
   INDEX PAGE - LAYOUT CHATBOT + RISULTATI
   ============================================================================= */

.container {
  display: flex;
  height: calc(100vh - 52px);
}

/* Sezione Chatbot (a sinistra) */
.chatbot-section {
  width: 35%;
  background-color: #fff;
  border-right: 1px solid gainsboro;
  display: flex;
  flex-direction: column;
  order: 1;
}

.chatbot-section .chatbot-header {
  padding: 0 20px;
  height: 48px;
  background-color: #294b78;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chatbot-section .chatbot-header h2 {
  font-family: 'Fjalla One', sans-serif;
  font-size: 1.2rem;
}

.model-select {
  padding: 6px 12px;
  border: none;
  background-color: rgba(255,255,255,0.2);
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.model-select option {
  color: #333;
}

.clear-btn,
.examples-btn {
  padding: 6px 12px;
  border: none;
  background-color: rgba(255,255,255,0.2);
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.clear-btn:hover,
.examples-btn:hover {
  background-color: rgba(255,255,255,0.3);
}

.examples-panel {
  background-color: #f1f1f1;
  border-bottom: 1px solid gainsboro;
  padding: 15px 20px;
}

.examples-title {
  font-size: 12px;
  color: #294b78;
  font-weight: 600;
  margin-bottom: 10px;
}

.example-item {
  background-color: white;
  border: 1px solid gainsboro;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #2F4F4F;
  cursor: pointer;
  transition: all 0.2s;
}

.example-item:last-child {
  margin-bottom: 0;
}

.example-item:hover {
  background-color: steelblue;
  border-color: steelblue;
  color: white;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.message {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
}

.message.user {
  background-color: #294b78;
  color: white;
  margin-left: auto;
}

.message.bot {
  background-color: #f1f1f1;
  color: #2F4F4F;
}

.message.loading {
  opacity: 0.7;
  font-style: italic;
}

/* Formattazione messaggi bot */
.message.bot code {
  background-color: rgba(0,0,0,0.08);
  padding: 2px 6px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
}

.message.bot strong {
  font-weight: 600;
  color: #332830;
}

.message.bot ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message.bot li {
  margin: 4px 0;
  line-height: 1.5;
}

.message.bot .sql-block {
  background: #002F6C;
  margin: 10px 0;
  overflow: hidden;
}

.message.bot .sql-block .sql-header {
  background-color: rgba(0,0,0,0.2);
  color: #81d4fa;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message.bot .sql-block pre {
  color: #e0e0e0;
  padding: 12px;
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.bot .code-block {
  background-color: #002F6C;
  color: #e0e0e0;
  padding: 12px;
  margin: 10px 0;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Stili Markdown per i messaggi bot */
.message.bot h3 {
  font-size: 15px;
  font-family: 'Fjalla One', sans-serif;
  font-weight: 500;
  color: #294b78;
  margin: 16px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 2px solid gainsboro;
}

.message.bot h4 {
  font-size: 14px;
  font-family: 'Fjalla One', sans-serif;
  font-weight: 500;
  color: #294b78;
  margin: 12px 0 6px 0;
}

.message.bot p {
  margin: 8px 0;
  line-height: 1.6;
}

.message.bot ol {
  margin: 8px 0;
  padding-left: 24px;
}

.message.bot ol li {
  margin: 6px 0;
  line-height: 1.5;
}

/* Blocco SQL collapsabile */
.message.bot.sql-message {
  background-color: #e8f5e9;
  border-left: 4px solid seagreen;
}

.sql-details {
  cursor: pointer;
}

.sql-details summary {
  font-weight: 600;
  color: seagreen;
  padding: 4px 0;
  outline: none;
  user-select: none;
}

.sql-details summary:hover {
  color: darkgreen;
}

.sql-icon {
  font-style: normal;
  margin-right: 6px;
}

.sql-code {
  background: #002F6C;
  color: #e0e0e0;
  padding: 12px;
  margin: 10px 0;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.copy-sql-btn {
  background-color: white;
  color: #332830;
  border: 2px solid #332830;
  padding: 6px 12px;
  font-family: 'Fjalla One', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-sql-btn:hover {
  background-color: #332830;
  color: white;
}

/* Risposta AI nel blocco SQL */
.ai-reasoning {
  background-color: #f1f1f1;
  border-bottom: 1px solid gainsboro;
  padding: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #2F4F4F;
}

.ai-reasoning p {
  margin: 0 0 8px 0;
}

.ai-reasoning p:last-child {
  margin-bottom: 0;
}

.ai-reasoning strong {
  color: #332830;
}

.ai-reasoning code {
  background-color: rgba(0,0,0,0.08);
  padding: 1px 5px;
  font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 12px;
}

.chat-input-container {
  padding: 20px;
  border-top: 1px solid gainsboro;
  display: flex;
  gap: 10px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid gainsboro;
  font-size: 16px;
  font-family: 'Baloo 2', sans-serif;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.4;
}

.chat-input:focus {
  background-color: lavender;
}

.send-btn {
  padding: 12px 24px;
  background-color: white;
  color: #332830;
  border: 2px solid #332830;
  cursor: pointer;
  font-family: 'Fjalla One', sans-serif;
  font-size: 14px;
  transition: all 0.2s;
}

.send-btn:hover {
  background-color: #332830;
  color: white;
}

/* Sezione Risultati (a destra) */
.results-section {
  width: 65%;
  display: flex;
  flex-direction: column;
  order: 2;
}

.results-section .results-header {
  padding: 0 20px;
  height: 48px;
  background-color: steelblue;
  color: white;
  display: flex;
  align-items: center;
}

.results-section .results-header h2 {
  font-family: 'Fjalla One', sans-serif;
  font-size: 1.2rem;
}

.results-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.result-card {
  background-color: #fff;
  padding: 20px;
  margin-bottom: 15px;
  border: 1px solid gainsboro;
}

.result-card h3 {
  color: #332830;
  margin-bottom: 10px;
}

.result-card p {
  color: #2F4F4F;
  line-height: 1.5;
}

.no-results {
  text-align: center;
  color: darkslategray;
  padding: 40px;
}

/* Tabella Comparativa Risultati */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  overflow: hidden;
}

.comparison-table thead {
  background-color: #154A98;
  color: white;
}

.comparison-table th {
  padding: 15px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

.comparison-table th:first-child {
  text-align: left;
  background: rgba(0,0,0,0.1);
}

.comparison-table td {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid gainsboro;
  font-size: 13px;
}

.comparison-table tr:not(.section-header) td:first-child {
  text-align: left;
  font-weight: 500;
  color: darkslategrey;
  background-color: #f8f9fa;
}

.comparison-table tbody tr:nth-child(odd):not(.section-header) {
  background-color: #fafafa;
}

.comparison-table tbody tr:nth-child(odd):not(.section-header) td:first-child {
  background-color: #f1f3f4;
}

.comparison-table tbody tr:hover:not(.section-header) {
  background-color: #ddd;
}

.comparison-table .check {
  color: seagreen;
  font-size: 18px;
}

.comparison-table .cross {
  color: orangered;
  font-size: 18px;
}

.comparison-table .amount {
  font-weight: 600;
  color: #2F4F4F;
}

.comparison-table .section-header td {
  background-color: steelblue;
  color: white;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sezioni collassabili */
.comparison-table .section-toggle {
  cursor: pointer;
  user-select: none;
}

.comparison-table .section-toggle:hover td {
  background-color: #3a7cc5;
}

.comparison-table .section-arrow {
  display: inline-block;
  font-size: 10px;
  margin-right: 4px;
  transition: transform 0.2s;
}

.comparison-table .section-toggle.collapsed td {
  background-color: #4682b4;
  opacity: 0.85;
}

.results-intro {
  background-color: #294b78;
  color: white;
  padding: 20px;
  margin-bottom: 20px;
}

.results-intro h3 {
  font-family: 'Fjalla One', sans-serif;
  margin-bottom: 10px;
  font-size: 16px;
}

.results-intro p {
  font-size: 14px;
  opacity: 0.9;
}

.results-note {
  margin-top: 20px;
  padding: 15px;
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  font-size: 13px;
  color: #856404;
}

/* Card Preventivo Clikki */
.preventivo-card {
  background: white;
  border: 1px solid gainsboro;
  margin-bottom: 20px;
  overflow: hidden;
}

.preventivo-card .preventivo-header {
  background-color: #294b78;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preventivo-card .preventivo-header h3 {
  font-family: 'Fjalla One', sans-serif;
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.preventivo-card .preventivo-header .preventivo-status {
  font-size: 12px;
  padding: 3px 10px;
  background-color: seagreen;
  color: white;
  font-weight: 600;
}

.preventivo-body {
  padding: 20px;
}

.preventivo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid gainsboro;
}

.preventivo-row:last-child {
  border-bottom: none;
}

.preventivo-row.total {
  border-top: 2px solid #332830;
  border-bottom: none;
  margin-top: 5px;
  padding-top: 15px;
}

.preventivo-label {
  font-size: 14px;
  color: #2F4F4F;
  font-weight: 500;
}

.preventivo-value {
  font-size: 14px;
  font-weight: 600;
  color: #2F4F4F;
}

.preventivo-value.total {
  font-size: 22px;
  color: #c0392b;
}

.preventivo-value.netto {
  font-size: 16px;
  color: seagreen;
}

.preventivo-info {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 15px 20px;
  background-color: #f8f9fa;
  border-top: 1px solid gainsboro;
  font-size: 12px;
  color: #2F4F4F;
}

.preventivo-info-item {
  display: flex;
  gap: 4px;
}

.preventivo-info-item strong {
  color: #332830;
}

/* Responsive Layout */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    height: calc(100vh - 80px);
  }

  .chatbot-section,
  .results-section {
    width: 100%;
    height: calc(50vh - 40px);
  }

  .chatbot-section {
    order: 1;
    border-right: none;
    border-bottom: 1px solid gainsboro;
  }

  .results-section {
    order: 2;
  }

  .comparison-table th,
  .comparison-table td {
    padding: 8px 6px;
    font-size: 11px;
  }
}


/* =============================================================================
   WORKFLOW / DOCUMENTAZIONE - STILI
   ============================================================================= */

.wf-wrap {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
}

.wf-wrap .container {
    max-width: 1200px;
    margin: 0 auto;
    display: block;
    height: auto;
}

.wf-wrap header {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid rgba(255,255,255,0.1);
}

.wf-wrap header h1 {
    font-size: 2.5em;
    color: #4fc3f7;
    margin-bottom: 10px;
}

.wf-wrap header p {
    font-size: 1.2em;
    color: #90caf9;
}

.wf-wrap .section {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.1);
}

.wf-wrap .section h2 {
    color: #4fc3f7;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(79, 195, 247, 0.3);
    font-size: 1.5em;
}

.wf-wrap .section h3 {
    color: #81d4fa;
    margin: 20px 0 10px 0;
    font-size: 1.2em;
}

.wf-wrap .workflow-diagram {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
    overflow-x: auto;
}

.wf-wrap .workflow-step {
    display: flex;
    align-items: center;
    margin: 10px 0;
    flex-wrap: wrap;
}

.wf-wrap .step-number {
    background: #4fc3f7;
    color: #1a1a2e;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.wf-wrap .step-content {
    flex: 1;
    min-width: 200px;
}

.wf-wrap .step-arrow {
    color: #4fc3f7;
    font-size: 1.5em;
    margin: 5px 0;
    text-align: center;
}

.wf-wrap .links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.wf-wrap .link-card {
    background: linear-gradient(145deg, rgba(79, 195, 247, 0.1), rgba(79, 195, 247, 0.05));
    border: 1px solid rgba(79, 195, 247, 0.3);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.wf-wrap .link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(79, 195, 247, 0.2);
    border-color: #4fc3f7;
}

.wf-wrap .link-card h4 {
    color: #4fc3f7;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.wf-wrap .link-card p {
    color: #b0bec5;
    font-size: 0.95em;
    line-height: 1.5;
}

.wf-wrap .link-card .url {
    color: #81d4fa;
    font-size: 0.85em;
    margin-top: 10px;
    word-break: break-all;
}

.wf-wrap .api-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.wf-wrap .api-table th,
.wf-wrap .api-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.wf-wrap .api-table th {
    background: rgba(79, 195, 247, 0.2);
    color: #4fc3f7;
}

.wf-wrap .api-table tr:hover {
    background: rgba(255,255,255,0.05);
}

.wf-wrap .method {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}

.wf-wrap .method.get {
    background: #4caf50;
    color: white;
}

.wf-wrap .method.post {
    background: #ff9800;
    color: white;
}

.wf-wrap code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #81d4fa;
}

.wf-wrap pre {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.wf-wrap pre code {
    background: none;
    padding: 0;
}

.wf-wrap .tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
}

.wf-wrap .tech-badge {
    background: rgba(79, 195, 247, 0.2);
    color: #4fc3f7;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    border: 1px solid rgba(79, 195, 247, 0.3);
}

.wf-wrap .note {
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
}

.wf-wrap .note strong {
    color: #ffc107;
}

.wf-wrap ul {
    padding-left: 25px;
    margin: 10px 0;
}

.wf-wrap li {
    margin: 8px 0;
    line-height: 1.6;
}

.wf-wrap .wf-mt {
    margin-top: 10px;
}

.wf-wrap footer {
    text-align: center;
    padding: 30px;
    color: #78909c;
    font-size: 0.9em;
}
