/* ============================================================
   ArbiMaster - Shared Strategy Page Styles
   Usato da: strategies/simple-arbitrage.php, strategies/market-maker.php,
             strategies/spread-sniper.php
   ============================================================
   Le 3 pagine avevano ciascuna un blocco <style> quasi identico ma
   con piccole divergenze accumulate nel tempo:
     - il locale numerico di formatPrice era en-US in una pagina e
       it-IT nelle altre due (vedi strategy-utils.js)
     - i modal usavano palette di colori leggermente diverse (blu/
       ambra/verde/giallo in una, blu/viola/verde/rosso nell'altra)
     - market-maker.php aveva un dark mode meno completo delle altre
       due (mancavano gli override per i grigi generici Tailwind)
     - un bug isolato: .price-buy/.price-sell erano definite due
       volte in spread-sniper.php con valori diversi (la seconda
       vinceva silenziosamente, rendendo morta la prima)
     - .close-btn aveva "transition: colors" (proprietà CSS che non
       esiste) in due pagine su tre

   Questo file è la base comune. Ogni pagina mantiene nel proprio
   <style> SOLO le regole realmente specifiche a quella strategia
   (es. price-maker-uncertain di Market Maker, o strategy-btn di
   Spread Sniper).

   Sistema colori semantico unificato per i box nei modal:
     blu   = informazione neutra
     verde = buy / esito positivo
     rosso = sell / rischio
     ambra = avviso / attenzione
     viola = usato SOLO dove già serviva a distinguere qualcosa di
             specifico (es. intra-exchange vs cross-exchange in
             Spread Sniper) - non è stato rimosso, è intenzionale.
   ============================================================ */

[v-cloak] { display: none; }

/* ---- Filtri ---- */
.filters-container { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.filter-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; }
.filter-input { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d1d5db; border-radius: 0.5rem; background-color: #f9fafb; transition: all 0.2s ease-in-out; }
.filter-input:focus { outline: none; border-color: #667eea; background-color: #ffffff; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2); }

/* Dropdown multi-select exchange (si apre in hover, non al click) */
.dropdown { position: relative; }
.dropdown-content { display: none; position: absolute; top: 100%; left: 0; background-color: #ffffff; min-width: 240px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 10; border-radius: 0.75rem; padding: 0.5rem; margin-top: 0.5rem; border: 1px solid #e5e7eb; max-height: 250px; overflow-y: auto; }
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content label { display: flex; align-items: center; width: 100%; padding: 0.5rem 0.75rem; cursor: pointer; border-radius: 0.5rem; transition: background-color 0.2s ease; }
.dropdown-content label:hover { background-color: #f3f4f6; }

.exchange-preferred { background-color: #f0fdf4 !important; border: 1px solid #bbf7d0; }
.exchange-preferred:hover { background-color: #dcfce7 !important; }

.sortable-header { cursor: pointer; user-select: none; transition: background-color 0.2s ease; }
.sortable-header:hover { background-color: #f9fafb; }

.pause-resume-btn { display: inline-flex; align-items: center; padding: 0.5rem 1rem; background-color: #f97316; color: white; border: none; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: background-color 0.2s ease; }
.pause-resume-btn:hover { background-color: #ea580c; }

/* Switcher tra le 3 strategie (Simple Arbitrage / Market Maker /
   Spread Sniper), mostrato in cima a ciascuna pagina strategia per
   evitare di dover tornare all'hub arbitrage.php per cambiare. */
.strategy-switcher {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0 auto 1.75rem;
    max-width: fit-content;
    padding: 0.35rem;
    background: #f3f4f6;
    border-radius: 0.75rem;
}
.strategy-switcher-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    transition: all 0.15s ease;
}
.strategy-switcher-link:hover { color: #374151; background: rgba(255,255,255,0.6); }
.strategy-switcher-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 6px rgba(102,126,234,0.35);
}

/* ---- Modal dettagli ---- */
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid #e5e7eb; }
.modal-body { padding: 1.5rem; overflow-y: auto; max-height: calc(90vh - 120px); }
/* fix: "transition: colors" non è una proprietà CSS valida (era così
   in due pagine su tre) - qui corretto in "color" */
.close-btn { padding: 0.5rem; color: #6b7280; transition: color 0.2s ease; }
.close-btn:hover { color: #374151; }

.exchange-table-container { background-color: #f9fafb; border-radius: 0.75rem; padding: 1rem; }
.strategy-overview { background-color: #f9fafb; border-radius: 0.75rem; padding: 1rem; }
.chart-container { background-color: #f9fafb; border-radius: 0.75rem; padding: 1rem; }
.chart-wrapper { display: flex; justify-content: center; margin-bottom: 1rem; }
.chart-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem; }
.legend-item { display: flex; align-items: center; gap: 0.5rem; }
.legend-color { width: 1rem; height: 1rem; border-radius: 0.25rem; }

/* fix: definita due volte in spread-sniper.php con valori diversi
   (0.75rem/#16a34a vs colore pieno senza font-size); questa è la
   versione che di fatto "vinceva" già in 2 pagine su 3, qui unica */
.price-buy  { font-size: 0.75rem; color: #16a34a; margin-top: 0.25rem; font-weight: 500; }
.price-sell { font-size: 0.75rem; color: #dc2626; margin-top: 0.25rem; font-weight: 500; }
.price-up   { color: #10b981; font-weight: 600; }
.highlight-spread { background-color: #f0fdf4; }
.text-yellow-500 { color: #f59e0b; }

/* ============================================================
   DARK MODE (html.dark)
   ============================================================ */

/* Pagina e testi generali */
html.dark main { color: #f3f4f6; }
html.dark h1, html.dark h3, html.dark h4 { color: #f9fafb !important; }
html.dark header h1 { color: #f9fafb !important; }
html.dark header p  { color: #9ca3af !important; }
html.dark .text-gray-900 { color: #f9fafb !important; }
html.dark .text-gray-800 { color: #f3f4f6 !important; }
html.dark .text-gray-700 { color: #d1d5db !important; }
html.dark .text-gray-600 { color: #9ca3af !important; }
html.dark .text-gray-500 { color: #6b7280 !important; }
html.dark .text-gray-300 { color: #4b5563 !important; }

/* Avviso amber (nessun exchange configurato, ecc.) */
html.dark .notice-amber { background-color: #422006 !important; border-color: #92400e !important; }
html.dark .notice-title { color: #fcd34d !important; }
html.dark .notice-text  { color: #fbbf24 !important; }
html.dark .notice-text a { color: #fde68a !important; }

/* Switcher tra le 3 strategie */
html.dark .strategy-switcher { background: #1f2937 !important; }
html.dark .strategy-switcher-link { color: #9ca3af !important; }
html.dark .strategy-switcher-link:hover { color: #f3f4f6 !important; background: rgba(255,255,255,0.06) !important; }
html.dark .strategy-switcher-link.active { color: #ffffff !important; }

/* Card filtri e card principale */
html.dark .bg-white { background-color: #1f2937 !important; }
html.dark .bg-white.rounded-xl { background-color: #1f2937 !important; border-color: #374151 !important; }
html.dark .border-gray-100 { border-color: #374151 !important; }
html.dark .border-gray-200 { border-color: #374151 !important; }

/* Filtri */
html.dark .filter-input { background-color: #111827 !important; border-color: #4b5563 !important; color: #f3f4f6 !important; }
html.dark .filter-input:focus { background-color: #1a2438 !important; border-color: #667eea !important; }
html.dark label.font-semibold { color: #d1d5db !important; }

/* Dropdown exchange */
html.dark .dropdown-content { background-color: #111827 !important; border-color: #374151 !important; box-shadow: 0 10px 25px rgba(0,0,0,0.6) !important; color: #f3f4f6 !important; }
html.dark .dropdown-content label { color: #d1d5db !important; }
html.dark .dropdown-content label:hover { background-color: #1f2937 !important; }
html.dark .exchange-preferred { background-color: #064e3b !important; border-color: #166534 !important; color: #6ee7b7 !important; }
html.dark .exchange-preferred:hover { background-color: #065f46 !important; }
html.dark .text-green-700 { color: #6ee7b7 !important; }
html.dark .text-blue-700  { color: #93c5fd !important; }
html.dark .text-red-700   { color: #fca5a5 !important; }
html.dark .hover\:bg-green-50:hover { background-color: #064e3b !important; }
html.dark .hover\:bg-blue-50:hover  { background-color: #1e3a5f !important; }
html.dark .hover\:bg-red-50:hover   { background-color: #450a0a !important; }
html.dark .sortable-header:hover { background-color: #1f2937 !important; }

/* Tabella */
html.dark table.min-w-full { background-color: #1f2937 !important; }
html.dark thead.bg-gray-50 { background-color: #111827 !important; }
html.dark thead th { color: #9ca3af !important; border-color: #374151 !important; }
html.dark tbody.bg-white { background-color: #1f2937 !important; }
html.dark .divide-y.divide-gray-200 > * { border-color: #374151 !important; }
html.dark .bg-gray-50.sticky { background-color: #111827 !important; }
html.dark tbody tr { color: #f3f4f6 !important; }
html.dark tbody tr:hover { background-color: #273549 !important; }
html.dark tr.hover\:bg-indigo-50:hover { background-color: #1e2d4e !important; }
html.dark tbody td { color: #d1d5db; }
html.dark tbody td.font-medium { color: #f3f4f6 !important; }
html.dark .text-gray-900.font-medium { color: #f3f4f6 !important; }
html.dark .highlight-spread { background-color: #1e2d3d !important; }

/* Colori prezzi e spread */
html.dark .price-buy  { color: #34d399 !important; }
html.dark .price-sell { color: #f87171 !important; }
html.dark .price-up   { color: #4ade80 !important; }
html.dark .text-green-600 { color: #34d399 !important; }
html.dark .text-red-600   { color: #f87171 !important; }
html.dark .text-indigo-600 { color: #a5b4fc !important; }
html.dark .text-indigo-600:hover { color: #c7d2fe !important; }
html.dark .text-blue-600  { color: #93c5fd !important; }
html.dark .text-blue-600:hover { color: #bfdbfe !important; }
html.dark .text-green-500 { color: #4ade80 !important; }
html.dark .font-bold.text-indigo-600 { color: #818cf8 !important; }

/* Paginazione */
html.dark .bg-white.px-4 { background-color: #1f2937 !important; border-color: #374151 !important; }
html.dark .bg-white.px-4 button { background-color: #1f2937 !important; border-color: #374151 !important; color: #d1d5db !important; }
html.dark .bg-white.px-4 button:hover:not(:disabled) { background-color: #273549 !important; }
html.dark .bg-white.px-4 span.relative { background-color: #1f2937 !important; border-color: #374151 !important; color: #d1d5db !important; }
html.dark .bg-white.px-4.py-3 { background-color: #1f2937 !important; border-color: #374151 !important; }
html.dark .border-gray-300 { border-color: #4b5563 !important; }
html.dark .text-gray-700.bg-white { background-color: #1f2937 !important; color: #d1d5db !important; }
html.dark button.relative.inline-flex { background-color: #1f2937 !important; color: #9ca3af !important; border-color: #4b5563 !important; }
html.dark button.relative.inline-flex:hover:not(:disabled) { background-color: #273549 !important; }
html.dark .text-sm.text-gray-700 { color: #d1d5db !important; }
html.dark nav span.text-sm.font-medium.text-gray-700 { color: #d1d5db !important; }

/* Pause/Resume button */
html.dark .pause-resume-btn { background-color: #c2410c !important; }
html.dark .pause-resume-btn:hover { background-color: #9a3412 !important; }

/* Modal */
html.dark .bg-white.relative.top-20 { background-color: #1f2937 !important; border-color: #374151 !important; }
html.dark .fixed .bg-white { background-color: #1f2937 !important; border-color: #374151 !important; }
html.dark .modal-header { border-color: #374151 !important; background-color: #1f2937 !important; }
html.dark .modal-header h3 { color: #f9fafb !important; }
html.dark .modal-body { background-color: #1f2937 !important; }
html.dark .exchange-table-container,
html.dark .strategy-overview,
html.dark .chart-container { background-color: #111827 !important; }
html.dark .exchange-table-container h4, html.dark .chart-container h4 { color: #f3f4f6 !important; }
html.dark .border-b.border-gray-300 { border-color: #374151 !important; }
html.dark .border-b.border-gray-100 { border-color: #1f2937 !important; }
html.dark .text-sm.font-medium.text-gray-700 { color: #9ca3af !important; }
html.dark .close-btn { color: #9ca3af !important; }
html.dark .close-btn:hover { color: #f3f4f6 !important; }
html.dark .legend-item span { color: #d1d5db !important; }
html.dark .text-gray-600.mb-8 span { color: #9ca3af !important; }
html.dark .flex.flex-wrap.justify-center span { color: #d1d5db; }

/* Palette semantica unificata per i box colorati dentro i modal.
   Il viola resta disponibile per le distinzioni intenzionali già
   presenti (es. intra vs cross-exchange in Spread Sniper). */
html.dark .modal-body .bg-blue-50   { background-color: #1e3a5f !important; border-color: #1e40af !important; }
html.dark .modal-body .bg-green-50  { background-color: #052e16 !important; border-color: #166534 !important; }
html.dark .modal-body .bg-red-50    { background-color: #450a0a !important; border-color: #7f1d1d !important; }
html.dark .modal-body .bg-amber-50  { background-color: #451a03 !important; border-color: #92400e !important; }
html.dark .modal-body .bg-purple-50 { background-color: #2e1b4e !important; border-color: #6d28d9 !important; }
html.dark .modal-body .text-blue-800,   html.dark .modal-body .text-blue-900   { color: #93c5fd !important; }
html.dark .modal-body .text-green-800,  html.dark .modal-body .text-green-900  { color: #6ee7b7 !important; }
html.dark .modal-body .text-red-800,    html.dark .modal-body .text-red-900    { color: #fca5a5 !important; }
html.dark .modal-body .text-amber-800,  html.dark .modal-body .text-amber-900  { color: #fcd34d !important; }
html.dark .modal-body .text-purple-800, html.dark .modal-body .text-purple-900 { color: #c4b5fd !important; }
html.dark .modal-body .text-gray-600 { color: #9ca3af !important; }
html.dark .modal-body table tr { background-color: transparent !important; }
html.dark .modal-body .border-b { border-color: #374151 !important; }
