* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0f172a; color: #e2e8f0; min-height: 100vh; }

header { background: #1e293b; padding: 1rem 2rem; display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; border-bottom: 2px solid #334155; }
header h1 { font-size: 1.5rem; color: #39ff14; white-space: nowrap; }
nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.tab { background: none; border: none; color: #94a3b8; padding: 0.5rem 1rem; cursor: pointer; border-radius: 6px; font-size: 0.9rem; }
.tab:hover { background: #334155; color: #e2e8f0; }
.tab.active { background: #39ff14; color: #0f172a; font-weight: 600; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
#scrape-status { font-size: 0.8rem; color: #94a3b8; }

.btn-action { background: #39ff14; color: #0f172a; border: none; padding: 0.5rem 1.2rem; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-action:hover { background: #2ecc40; }
.btn-danger { background: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.2rem; }

.search-bar { position: relative; }
.search-bar input { background: #1e293b; border: 1px solid #334155; color: #e2e8f0; padding: 0.5rem 1rem; border-radius: 6px; width: 280px; }
.search-bar input:focus { outline: none; border-color: #39ff14; }

.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: #1e293b; border: 1px solid #334155; border-radius: 6px; max-height: 300px; overflow-y: auto; z-index: 100; display: none; }
.search-dropdown.active { display: block; }
.search-dropdown .item { padding: 0.5rem 1rem; cursor: pointer; display: flex; justify-content: space-between; border-bottom: 1px solid #334155; }
.search-dropdown .item:hover { background: #334155; }

.role-section { margin-bottom: 1.5rem; }
.role-heading { font-size: 1rem; color: #e2e8f0; padding: 0.5rem 0; border-bottom: 1px solid #334155; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.role-count { background: #334155; padding: 0.1rem 0.5rem; border-radius: 10px; font-size: 0.8rem; color: #94a3b8; margin-left: auto; }
.player-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.player-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.player-card .nome { font-weight: 600; font-size: 0.95rem; }
.player-card .ruolo { display: inline-block; background: #334155; padding: 0.1rem 0.4rem; border-radius: 4px; font-size: 0.75rem; width: fit-content; }
.player-card .squadra { color: #94a3b8; font-size: 0.85rem; }
.player-card .stats { display: flex; gap: 0.5rem; font-size: 0.8rem; color: #94a3b8; }
.player-card .stats span { background: #0f172a; padding: 0.1rem 0.4rem; border-radius: 4px; }
.player-card .actions { margin-top: auto; display: flex; gap: 0.3rem; }
.player-card .voto-previsto { color: #39ff14; font-weight: 600; }
.player-card.infortunato { opacity: 0.5; border-color: #ef4444; }
.player-card.in-rosa { border-color: #22c55e; }

.formazione-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 1rem; margin-bottom: 1rem; }
.formazione-card h3 { color: #39ff14; margin-bottom: 0.5rem; }
.formazione-card .punteggio { font-size: 1.2rem; font-weight: 700; color: #22c55e; margin-bottom: 0.3rem; }
.formazione-card .mod-difesa { font-size: 0.85rem; color: #94a3b8; }
.formazione-card .schieramento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
.formazione-card .schieramento .ruolo-col h4 { font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.25rem; }
.giocatore-item { font-size: 0.85rem; padding: 0.2rem 0; border-bottom: 1px solid #1e293b; }
.giocatore-item .voto { color: #39ff14; font-size: 0.8rem; }

.ottimizza-controls { display: flex; align-items: center; gap: 0.75rem; }
.ottimizza-controls label { font-size: 0.9rem; color: #94a3b8; }
.ottimizza-controls input { background: #1e293b; border: 1px solid #334155; color: #e2e8f0; padding: 0.3rem 0.5rem; border-radius: 4px; width: 60px; }

.param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.param-item { background: #1e293b; border: 1px solid #334155; border-radius: 6px; padding: 0.75rem; }
.param-item label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.param-item label span { color: #94a3b8; font-size: 0.75rem; }
.param-item input { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 0.3rem 0.5rem; border-radius: 4px; width: 100%; }

#stats-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.stat-card { background: #1e293b; border: 1px solid #334155; border-radius: 8px; padding: 1rem; text-align: center; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: #39ff14; }
.stat-card .label { font-size: 0.85rem; color: #94a3b8; }

.loading { text-align: center; padding: 2rem; color: #94a3b8; }

#login-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.95); display: flex; align-items: center; justify-content: center; z-index: 1000; }
#login-box { background: #1e293b; padding: 2rem; border-radius: 12px; border: 1px solid #334155; width: 340px; text-align: center; }
#login-box h2 { color: #39ff14; margin-bottom: 0.5rem; }
#login-box p { color: #94a3b8; font-size: 0.85rem; margin-bottom: 1.5rem; }
#login-box input { display: block; width: 100%; background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 0.75rem; font-size: 0.9rem; }
#login-box input:focus { outline: none; border-color: #39ff14; }
#login-box .btn-action { width: 100%; margin-bottom: 0.5rem; }
.login-msg { color: #ef4444; font-size: 0.8rem; margin-bottom: 0.75rem; min-height: 1.2rem; }
.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-secondary:hover { background: #475569; }
.user-badge { color: #94a3b8; font-size: 0.8rem; }
