/* ===== SITO-OK.COM - CSS UNIFICATO SISTEMATO ===== */
/* Contiene tutti gli stili per: Frontend, Admin Panel, Login */
/* Versione 2.1.1 - Fix scroll, punteggio e rate limiting */

/* ===== CSS CUSTOM PROPERTIES (VARIABILI) ===== */
:root {
  /* === COLORI BRAND === */
  --primary-orange: #ff7849;
  --primary-orange-dark: #ff6b35;
  --primary-orange-light: #ffb347;
  
  /* === COLORI ADMIN (DARK THEME) === */
  --admin-bg-dark: #1e293b;
  --admin-bg-medium: #334155;
  --admin-bg-light: #475569;
  --admin-text: #f1f5f9;
  --admin-text-muted: #94a3b8;
  --admin-border: rgba(255, 255, 255, 0.1);
  
  /* === COLORI SISTEMA === */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* === TIPOGRAFIA === */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  
  /* === SPAZIATURE === */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* === BORDER RADIUS === */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  
  /* === SHADOWS === */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.2);
  --shadow-orange: 0 8px 25px rgba(255, 120, 73, 0.3);
  
  /* === BACKDROP FILTERS === */
  --blur-sm: blur(10px);
  --blur-md: blur(20px);
  
  /* === TRANSITIONS === */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s ease;
}

/* ===== RESET E BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* iOS momentum scrolling */
  -webkit-overflow-scrolling: touch;
  /* ✅ SCROLL FIX: Previeni rimbalzi su iOS */
  overscroll-behavior: none;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* ✅ SCROLL FIX: Stabilizza scroll */
  overflow-x: hidden;
  position: relative;
}

/* ===== UTILITY CLASSES ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* === FLEXBOX UTILITIES === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* === TEXT UTILITIES === */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* === SPACING UTILITIES === */
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.pt-xl { padding-top: var(--spacing-xl); }

/* ===== COMPONENT STYLES ===== */

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  outline: none;
  /* Assicura che i pulsanti siano sempre cliccabili */
  z-index: 10;
  pointer-events: auto;
}

.btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left var(--transition-slow);
  pointer-events: none;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-dark) 100%);
  color: white;
  box-shadow: var(--shadow-orange);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(255, 120, 73, 0.4);
}

.btn-secondary {
  background: var(--admin-border);
  color: var(--admin-text);
  border: 1px solid var(--admin-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
}

/* Button Sizes */
.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
}

.btn-xl {
  padding: 1.25rem 2rem;
  font-size: 1.25rem;
}

/* === FORMS === */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  font-size: 0.875rem;
}

.form-input {
  width: 100%;
  padding: var(--spacing-md) 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  background: #f8fafc;
  transition: var(--transition-normal);
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--primary-orange);
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 120, 73, 0.1);
  transform: translateY(-1px);
}

.form-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.form-input.valid {
  border-color: var(--success);
}

.form-input.invalid {
  border-color: var(--warning);
}

/* === CARDS === */
.card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: var(--transition-normal);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  color: var(--primary-orange);
}

/* === ALERTS === */
.alert {
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  border: 1px solid;
  font-size: 0.875rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--info);
}

/* === LOADING STATES === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text::after {
  content: '';
  animation: dots 1.5s linear infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* === STATUS INDICATORS === */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.operational {
  background: var(--success);
}

.status-dot.warning {
  background: var(--warning);
}

.status-dot.error {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== THEME: MAIN SITE (ORANGE) ===== */
.theme-main {
  background: linear-gradient(135deg, var(--primary-orange) 0%, #ff9500 50%, var(--primary-orange-light) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  /* ✅ SCROLL FIX: Previeni overflow issues */
  scroll-padding-top: 2rem;
}

.theme-main::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="70" r="1.5" fill="rgba(255,255,255,0.1)"/><circle cx="70" cy="30" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="10" r="0.8" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

.theme-main .container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--blur-md);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: 
    0 32px 64px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: relative;
  animation: slideUp 0.8s ease-out;
  /* ✅ SCROLL FIX: Previeni overflow per mobile */
  overflow-x: hidden;
  margin-bottom: 6rem; /* Spazio extra per footer */
}

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

.theme-main .container:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 40px 80px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: var(--transition-normal);
}

/* === MAIN SITE SPECIFIC COMPONENTS === */

/* Header e Logo */
.header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.logo::before {
  font-size: 2.2rem;
  animation: pulse 2s ease-in-out infinite;
}

.theme-main .logo {
  background: linear-gradient(135deg, var(--primary-orange), var(--primary-orange-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.theme-main .logo::before {
  content: '🔍';
}

.subtitle {
  color: #64748b;
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0;
  animation: fadeIn 1s ease-out 0.3s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Form Scansione */
.scan-form {
  margin-bottom: var(--spacing-xl);
}

.input-container {
  position: relative;
  margin-bottom: var(--spacing-lg);
}

.url-input {
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  background: #f8fafc;
  transition: var(--transition-normal);
  outline: none;
}

.url-input:focus {
  border-color: var(--primary-orange);
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 120, 73, 0.1);
  transform: translateY(-1px);
}

.url-input:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

.url-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.url-input.valid {
  border-color: var(--success);
}

.url-input.invalid {
  border-color: var(--warning);
}

.scan-button {
  width: 100%;
  padding: 1.25rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-dark) 100%);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.scan-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s;
}

.scan-button:hover::before {
  left: 100%;
}

.scan-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(255, 120, 73, 0.3);
}

.scan-button:active {
  transform: translateY(0);
}

.scan-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Loading */
.loading {
  display: none;
  text-align: center;
  padding: var(--spacing-xl);
  animation: fadeInUp 0.5s ease-out;
}

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

.loading-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid var(--primary-orange);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: #64748b;
  font-size: 1rem;
  font-weight: 500;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s linear infinite;
}

/* Risultati */
.result {
  display: none;
  padding: var(--spacing-xl);
  border-radius: var(--radius-xl);
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  animation: resultSlide 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: none;
  backdrop-filter: var(--blur-sm);
  /* ✅ SCROLL FIX: Assicura leggibilità su mobile */
  word-wrap: break-word;
  overflow-wrap: break-word;
  scroll-margin-top: 2rem; /* Spazio per scroll */
  margin-bottom: 2rem; /* Spazio extra sotto */
}

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

.result.safe {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(34, 197, 94, 0.9));
  color: white;
  box-shadow: 0 20px 40px rgba(16, 185, 129, 0.3);
}

.result.unsafe,
.result.rate-limit {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.9));
  color: white;
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.3);
}

.result.loading {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.95), rgba(217, 119, 6, 0.9));
  color: white;
  box-shadow: 0 20px 40px rgba(245, 158, 11, 0.3);
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  animation: bounce 1s ease-in-out;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.result-text {
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.result-details {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 400;
  position: relative;
  z-index: 10;
}

/* Risultati Dettagliati */
.result-details-expanded {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--blur-sm);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: var(--shadow-sm);
  display: none;
  /* ✅ SCROLL FIX */
  scroll-margin-top: 2rem;
  margin-bottom: 1.5rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: #1e293b;
}

.detail-item strong {
  color: #374151;
  font-weight: 600;
  min-width: 120px;
}

.detail-item span:last-child {
  color: #6b7280;
  text-align: right;
  font-weight: 500;
}

/* ✅ SCORE SYSTEM SISTEMATO - Nuovo sistema di punteggio */
.score-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 0.75rem;
  position: relative;
  z-index: 10;
  border: 1px solid;
}

/* ✅ SISTEMATO: Colori per nuovo sistema (alto = buono) */
.score-safe {
  background: rgba(16, 185, 129, 0.15);
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.3);
}

.score-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.3);
}

.score-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Score Legend */
.score-section {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.score-legend {
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(248, 250, 252, 0.8);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.score-legend h5 {
  margin-bottom: 0.75rem;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 600;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.5rem;
}

.legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.legend-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ✅ SISTEMATO: Legenda per nuovo sistema */
.legend-item.excellent {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.legend-item.good {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.legend-item.fair {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.legend-item.warning {
  background: rgba(251, 146, 60, 0.1);
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.legend-item.danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.legend-icon {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.legend-range {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.125rem;
}

.legend-desc {
  color: #6b7280;
  font-size: 0.6875rem;
}

/* ===== SUGGERIMENTI SICUREZZA - CON FIX PULSANTI ===== */
.security-tips {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  display: none;
  backdrop-filter: var(--blur-sm);
  /* ✅ SCROLL FIX */
  scroll-margin-top: 2rem;
  margin-bottom: 2rem;
}

.security-tips h4 {
  margin-bottom: var(--spacing-md);
  color: #1e40af;
  font-size: 1rem;
  font-weight: 600;
}

.security-tips p {
  color: #374151;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.security-tips ul {
  margin-left: var(--spacing-md);
  margin-top: 0.5rem;
}

.security-tips li {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: #4b5563;
}

/* ===== PULSANTI UNDERSTOOD - VERSIONE CORRETTA E SICURA ===== */
.understood-button {
  width: 100%;
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  outline: none;
  
  /* CRITICO: Assicura che il pulsante sia sempre cliccabile */
  z-index: 100;
  pointer-events: auto;
  
  /* Prevenire problemi di touch su mobile */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.understood-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s;
  pointer-events: none;
}

.understood-button:hover::before {
  left: 100%;
}

.understood-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.understood-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.understood-button:focus,
.understood-button:focus-visible {
  outline: 2px solid var(--success);
  outline-offset: 2px;
}

/* Pulsante per siti non sicuri */
.understood-button.unsafe {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.understood-button.unsafe:hover {
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.understood-button.unsafe:focus,
.understood-button.unsafe:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

/* Pulsante disabilitato */
.understood-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* Messaggi di Sistema */
.bot-message {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  margin-top: var(--spacing-md);
  color: #dc2626;
  text-align: center;
  display: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  margin-bottom: 1.5rem;
}

/* ✅ SERVICE STATUS MIGLIORATO */
.service-status {
  position: fixed;
  bottom: 100px; /* Sopra il footer */
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--blur-sm);
  padding: 0.75rem var(--spacing-md);
  border-radius: 20px;
  font-size: 0.75rem;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  display: none;
  max-width: calc(100vw - 40px);
  word-wrap: break-word;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* CTA Section */
.cta-section {
  margin-top: var(--spacing-lg);
  padding: 0;
  animation: slideInUp 0.6s ease-out 0.5s both;
  /* ✅ SCROLL FIX */
  scroll-margin-top: 2rem;
  margin-bottom: 2rem;
}

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

.cta-content {
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: var(--blur-sm);
  border: 1px solid rgba(226, 232, 240, 0.5);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: var(--transition-normal);
}

.cta-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 0.6s;
}

.cta-content:hover::before {
  left: 100%;
}

.cta-content:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.1);
  border-color: rgba(255, 120, 73, 0.3);
}

.cta-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.cta-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.cta-description {
  font-size: 0.875rem;
  color: #64748b;
  margin-bottom: var(--spacing-md);
  position: relative;
  z-index: 1;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem var(--spacing-lg);
  background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-orange-dark) 100%);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  transition: var(--transition-normal);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.cta-button:hover::before {
  left: 100%;
}

.cta-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-orange);
}

.cta-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.cta-arrow {
  transition: transform 0.3s ease;
}

.cta-button:hover .cta-arrow {
  transform: translateX(3px);
}

/* Varianti CTA */
.cta-passwordrubata .cta-content {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
}

.cta-passwordrubata .cta-icon {
  color: var(--success);
}

.cta-passwordrubata .cta-button {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.cta-passwordrubata .cta-button:hover {
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.cta-controllosicurezza .cta-content {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
}

.cta-controllosicurezza .cta-icon {
  color: var(--info);
}

.cta-controllosicurezza .cta-button {
  background: linear-gradient(135deg, var(--info) 0%, #1d4ed8 100%);
}

.cta-controllosicurezza .cta-button:hover {
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

/* Footer */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: var(--blur-md);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding: var(--spacing-md) 1.25rem;
  z-index: 50;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #64748b;
}

.footer-content p {
  margin: 0.25rem 0;
}

.footer-content strong {
  color: var(--primary-orange);
  font-weight: 600;
}

.footer-content a {
  color: var(--primary-orange);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.footer-content a:hover {
  color: var(--primary-orange-dark);
  text-decoration: underline;
}

/* ===== THEME: ADMIN (DARK) ===== */
.theme-admin {
  background: linear-gradient(135deg, var(--admin-bg-dark) 0%, var(--admin-bg-medium) 50%, var(--admin-bg-light) 100%);
  min-height: 100vh;
  color: var(--admin-text);
}

.theme-admin .form-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--admin-border);
  color: var(--admin-text);
  backdrop-filter: var(--blur-sm);
}

.theme-admin .form-input:focus {
  border-color: var(--primary-orange);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(255, 120, 73, 0.1);
}

.theme-admin .form-input::placeholder {
  color: var(--admin-text-muted);
}

.theme-admin .form-label {
  color: #e2e8f0;
}

/* === TABLES === */
.table-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: var(--blur-sm);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: var(--spacing-xl);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--admin-border);
}

.table th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  color: #cbd5e1;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* === DASHBOARD GRID === */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-md);
}

.stat-item {
  text-align: center;
  padding: var(--spacing-md);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: var(--spacing-sm);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--admin-text-muted);
}

/* ===== THEME: LOGIN (DARK + ANIMATIONS) ===== */
.theme-login {
  background: linear-gradient(135deg, var(--admin-bg-dark) 0%, var(--admin-bg-medium) 30%, var(--admin-bg-light) 60%, var(--primary-orange) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
  color: var(--admin-text);
}

.theme-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="1.5" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="70" r="1.2" fill="rgba(255,255,255,0.1)"/><circle cx="70" cy="30" r="0.8" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="10" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="90" r="1.3" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
  animation: float 25s ease-in-out infinite;
}

/* Floating shapes for login */
.floating-shape {
  position: absolute;
  background: linear-gradient(135deg, rgba(255, 120, 73, 0.1), rgba(255, 107, 53, 0.05));
  border-radius: 50%;
  animation: floatShape 20s ease-in-out infinite;
}

.floating-shape:nth-child(1) {
  width: 100px;
  height: 100px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.floating-shape:nth-child(2) {
  width: 150px;
  height: 150px;
  top: 60%;
  right: 10%;
  animation-delay: -5s;
}

.floating-shape:nth-child(3) {
  width: 80px;
  height: 80px;
  bottom: 20%;
  left: 20%;
  animation-delay: -10s;
}

@keyframes floatShape {
  0%, 100% {
    transform: translateY(0px) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-50px) scale(1.1);
    opacity: 0.6;
  }
}

.theme-login .container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: var(--blur-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-2xl);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 
    0 32px 64px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  animation: slideUp 0.8s ease-out;
  z-index: 10;
}

.theme-login .container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%, rgba(255, 120, 73, 0.05) 100%);
  border-radius: var(--radius-2xl);
  pointer-events: none;
}

.theme-admin .logo,
.theme-login .logo {
  color: var(--admin-text);
}

.theme-login .logo::before {
  content: '🔒';
  filter: drop-shadow(0 4px 8px rgba(255, 120, 73, 0.3));
}

.logo-text {
  background: linear-gradient(135deg, var(--primary-orange), var(--primary-orange-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 8px rgba(255, 120, 73, 0.2);
}

/* Connection Status */
.connection-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--admin-text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem var(--spacing-md);
  border-radius: 20px;
  backdrop-filter: var(--blur-sm);
}

/* ===== SCROLL TO TOP BUTTON ===== */
#scrollToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-orange);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(255, 120, 73, 0.3);
  transition: var(--transition-normal);
}

#scrollToTop:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 120, 73, 0.4);
}

/* ===== RESPONSIVE DESIGN SISTEMATO ===== */
@media (max-width: 768px) {
  :root {
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-main,
  .theme-login {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .theme-main .container,
  .theme-login .container {
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    margin-bottom: 8rem; /* Più spazio per footer */
  }

  .logo {
    font-size: 1.75rem;
  }

  .logo::before {
    font-size: 1.5rem;
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }

  /* ✅ SERVICE STATUS MOBILE */
  .service-status {
    bottom: 110px; /* Sopra il footer su mobile */
    right: 15px;
    left: 15px;
    font-size: 0.6875rem;
    padding: 0.625rem 0.875rem;
    text-align: center;
  }
}

@media (max-width: 640px) {
  /* ✅ MOBILE: Spacing migliorato per evitare scroll issues */
  body.theme-main {
    padding: 1rem 0.75rem 10rem 0.75rem; /* Più spazio in basso */
    align-items: flex-start;
    padding-top: 2rem;
    min-height: 100vh;
  }

  .theme-main {
    min-height: 100vh;
    /* ✅ CRITICAL: Evita scroll orizzontale */
    overflow-x: hidden;
    padding: 2rem 0.75rem 10rem;
    align-items: flex-start;
  }

  .theme-main .container {
    padding: var(--spacing-lg);
    margin: 0 auto 6rem;
    border-radius: var(--radius-xl);
    max-width: 100%;
    overflow-x: hidden;
    /* ✅ SCROLL FIX: Margini migliorati */
    scroll-margin-top: 1rem;
    scroll-margin-bottom: 6rem;
  }

  .logo {
    font-size: 1.75rem;
  }

  .logo::before {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .url-input {
    padding: 1rem 1.25rem;
    font-size: 16px; /* Previene zoom automatico iOS */
  }

  .scan-button {
    padding: 1rem;
    font-size: 1rem;
  }

  .result {
    padding: 1.25rem;
    font-size: 1rem;
    margin-bottom: 2rem; /* Spazio extra su mobile */
    /* ✅ SCROLL FIX */
    scroll-margin-top: 1rem;
    scroll-margin-bottom: 2rem;
  }

  .result.rate-limit,
  .result.unsafe {
    padding: 1.25rem;
    font-size: 1rem;
  }
  
  .result.rate-limit .result-text,
  .result.unsafe .result-text {
    font-size: 1.125rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
  
  .result.rate-limit .result-details,
  .result.unsafe .result-details {
    font-size: 0.875rem;
    line-height: 1.4;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  }

  .result-icon {
    font-size: 2.5rem;
  }

  .footer {
    padding: 0.75rem var(--spacing-md);
  }

  .footer-content {
    font-size: 0.6875rem;
    line-height: 1.3;
  }

  .cta-content {
    padding: 1.25rem;
  }

  .cta-title {
    font-size: 1rem;
  }

  .cta-description {
    font-size: 0.8125rem;
  }

  .cta-button {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
  }

  .result-details-expanded,
  .security-tips {
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0.5rem 2rem;
    /* ✅ SCROLL FIX */
    scroll-margin-top: 1rem;
  }
  
  .detail-item {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .detail-item strong {
    min-width: auto;
  }
  
  .detail-item span:last-child {
    text-align: left;
    font-size: 0.8125rem;
  }

  .legend-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
  }

  .legend-item {
    padding: 0.25rem;
    font-size: 0.6875rem;
  }

  .legend-icon {
    font-size: 0.875rem;
  }

  .score-legend {
    padding: 0.75rem;
  }

  .score-legend h5 {
    font-size: 0.8125rem;
  }

  .understood-button {
    padding: 0.875rem var(--spacing-md);
    font-size: 0.9rem;
    margin-top: var(--spacing-md);
  }

  .bot-message {
    padding: 0.875rem;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: var(--spacing-md) 0.5rem 2rem;
  }

  #scrollToTop {
    bottom: 120px; /* Sopra footer su mobile */
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  body.theme-main {
    padding: 1rem 0.5rem 10rem 0.5rem;
  }

  .theme-main .container,
  .theme-login .container {
    padding: 1.25rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .result {
    font-size: 1rem;
  }

  .cta-title {
    font-size: 0.9rem;
  }

  .cta-description {
    font-size: 0.75rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 0.75rem var(--spacing-md);
    font-size: 0.875rem;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  .theme-main .container {
    background: rgba(15, 23, 42, 0.95);
    color: #e2e8f0;
  }

  .theme-main .form-input {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
  }

  .theme-main .form-input:focus {
    background: #0f172a;
  }

  .theme-main .form-input::placeholder {
    color: #64748b;
  }

  .theme-main .subtitle {
    color: #94a3b8;
  }

  .theme-main .loading-text {
    color: #94a3b8;
  }

  .theme-main .footer {
    background: rgba(15, 23, 42, 0.95);
    border-top-color: rgba(255, 255, 255, 0.1);
  }

  .theme-main .footer-content {
    color: #94a3b8;
  }

  .theme-main .cta-content {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(51, 65, 85, 0.5);
  }

  .theme-main .cta-title {
    color: #e2e8f0;
  }

  .theme-main .cta-description {
    color: #94a3b8;
  }

  .theme-main .cta-passwordrubata .cta-content {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
  }

  .theme-main .cta-controllosicurezza .cta-content {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
  }

  .theme-main .security-tips {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: rgba(59, 130, 246, 0.3);
  }

  .theme-main .security-tips h4 {
    color: #60a5fa;
  }

  .theme-main .security-tips p {
    color: #e2e8f0;
  }

  .theme-main .security-tips li {
    color: #cbd5e1;
  }

  .theme-main .result-details-expanded {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: rgba(51, 65, 85, 0.5);
  }

  .theme-main .detail-item {
    color: #e2e8f0;
  }

  .theme-main .detail-item strong {
    color: #f1f5f9;
  }

  .theme-main .detail-item span:last-child {
    color: #94a3b8;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* ✅ Mantieni scroll smooth per accessibilità */
  html {
    scroll-behavior: auto;
  }
}

/* Focus styles per navigazione da tastiera */
.btn:focus-visible,
.form-input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary-orange);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card {
    border-width: 2px;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .theme-main,
  .theme-admin,
  .theme-login {
    background: white !important;
    color: black !important;
  }
  
  .card {
    background: white !important;
    border: 1px solid #000 !important;
  }
  
  .btn {
    background: white !important;
    color: black !important;
    border: 1px solid #000 !important;
  }

  .footer,
  .service-status,
  #scrollToTop {
    display: none;
  }
}

/* ===== DEBUG E SVILUPPO ===== */
.debug-info {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  z-index: 9999;
  display: none;
}

.debug-mobile {
  position: fixed;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  z-index: 9999;
  display: none;
}

/* Mostra debug info solo in development */
body[data-debug="true"] .debug-info,
body[data-debug="true"] .debug-mobile {
  display: block;
}

@media (max-width: 640px) {
  .debug-mobile {
    font-size: 0.6875rem;
    padding: 0.375rem;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.card,
.btn,
.form-input {
  will-change: transform, box-shadow;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .card:hover,
  .btn:hover,
  .form-input:focus {
    transform: none;
  }
}
/* ===== AGGIUNTE CSS PER DOPPIO CONTROLLO ===== */
/* Da aggiungere al file unified-styles.css esistente */

/* === INDICATORI FONTI MULTIPLE === */
.multi-source-indicator {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.sources-grid {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--info);
}

.source-badge::before {
    content: '🔍';
    font-size: 0.875rem;
}

.source-badge[data-source*="Google"]::before {
    content: '🛡️';
}

.source-badge[data-source*="Cache"]::before {
    content: '⚡';
}

/* === INDICATORI CONFIDENCE === */
.confidence-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.confidence-very_high {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.confidence-very_high::before {
    content: '🎯';
}

.confidence-high {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.confidence-high::before {
    content: '✅';
}

.confidence-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.confidence-medium::before {
    content: '🟡';
}

.confidence-low {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.confidence-low::before {
    content: '⚠️';
}

/* === DOPPIO CONTROLLO HIGHLIGHTS === */
.dual-check-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--success);
    margin: 0.5rem 0;
}

.dual-check-badge::before {
    content: '🔍🛡️';
    font-size: 1rem;
}

/* === AGGIORNAMENTI SCORE BADGE === */
.score-badge.dual-check {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.15));
    border: 1px solid rgba(16, 185, 129, 0.3);
    position: relative;
}

.score-badge.dual-check::after {
    content: '🔍🛡️';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.75rem;
    background: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* === INDICATORI DI STATO NEL SERVICE STATUS === */
.service-status.dual-check {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.service-status.dual-check .status-dot {
    background: linear-gradient(135deg, var(--success), var(--info));
    animation: pulse-dual 2s ease-in-out infinite;
}

@keyframes pulse-dual {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.1);
    }
}

/* === ADMIN PANEL - DUAL CHECK STATS === */
.dual-check-stats {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.dual-check-stats h4 {
    color: var(--success);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dual-check-stats h4::before {
    content: '🔍🛡️';
}

.source-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.source-item {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.75rem;
}

.source-item .source-count {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.source-item.dual-check .source-count {
    color: var(--success);
}

.source-item.single-source .source-count {
    color: var(--warning);
}

.source-item.cache-source .source-count {
    color: var(--info);
}

/* === ANIMATIONS PER DUAL CHECK === */
@keyframes dual-check-glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.5), 0 0 30px rgba(59, 130, 246, 0.3);
    }
}

.result.dual-check {
    animation: dual-check-glow 3s ease-in-out infinite;
}

/* === TOOLTIPS PER CONFIDENCE === */
.confidence-tooltip {
    position: relative;
    cursor: help;
}

.confidence-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.confidence-tooltip:hover::after {
    opacity: 1;
}

/* === INDICATORI DI DISCREPANZA === */
.discrepancy-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.75rem;
    color: var(--warning);
}

.discrepancy-warning::before {
    content: '⚠️ ';
    font-weight: bold;
}

/* === PROGRESSIVE ENHANCEMENT === */
.sources-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--admin-text-muted);
}

.sources-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid var(--primary-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 640px) {
    .sources-grid {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .source-badge {
        justify-content: center;
        padding: 0.375rem;
    }
    
    .multi-source-indicator {
        padding: 0.75rem;
        margin: 0.75rem 0;
    }
    
    .confidence-indicator {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }
    
    .dual-check-badge {
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
        padding: 0.75rem;
    }
    
    .source-breakdown {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.375rem;
    }
    
    .source-item {
        padding: 0.375rem;
        font-size: 0.6875rem;
    }
    
    .source-item .source-count {
        font-size: 1rem;
    }
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
    .multi-source-indicator {
        background: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.4);
    }
    
    .source-badge {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.4);
        color: #60a5fa;
    }
    
    .dual-check-stats {
        background: rgba(16, 185, 129, 0.1);
        border-color: rgba(16, 185, 129, 0.3);
    }
    
    .confidence-tooltip::after {
        background: rgba(15, 23, 42, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .discrepancy-warning {
        background: rgba(245, 158, 11, 0.15);
        border-color: rgba(245, 158, 11, 0.4);
        color: #fbbf24;
    }
}

/* === HIGH CONTRAST MODE === */
@media (prefers-contrast: high) {
    .source-badge {
        border-width: 2px;
        font-weight: 600;
    }
    
    .confidence-indicator {
        border-width: 2px;
        font-weight: 600;
    }
    
    .dual-check-badge {
        border-width: 2px;
        font-weight: 700;
    }
}

/* === PRINT STYLES === */
@media print {
    .multi-source-indicator,
    .dual-check-badge,
    .confidence-indicator {
        background: white !important;
        border: 1px solid #000 !important;
        color: #000 !important;
    }
    
    .sources-grid {
        display: none; /* Nasconde le icone in stampa */
    }
    
    .source-badge::before,
    .confidence-indicator::before,
    .dual-check-badge::before {
        display: none; /* Nasconde le emoji in stampa */
    }
}
/* ===== MODAL CONFERMA PERSONALIZZATO ===== */
/* Da aggiungere a unified-styles.css */

/* === MODAL BASE === */
.proceed-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: modalFadeIn 0.3s ease-out;
}

.proceed-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.proceed-modal-container {
    position: relative;
    z-index: 10001;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.proceed-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* === HEADER === */
.proceed-modal-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
}

.proceed-modal-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-orange), var(--primary-orange-dark));
    border-radius: 12px;
    filter: drop-shadow(0 4px 8px rgba(255, 120, 73, 0.3));
}

.proceed-modal-title {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.proceed-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    font-size: 1.25rem;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.proceed-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    transform: scale(1.1);
}

/* === BODY === */
.proceed-modal-body {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* URL Preview */
.proceed-url-preview {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1rem;
}

.url-preview-label {
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.url-preview-url {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: #1e40af;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    word-break: break-all;
    font-weight: 500;
}

/* Security Info */
.proceed-security-info {
    margin: 0.5rem 0;
}

.security-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 0.875rem;
}

.security-badge.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 146, 60, 0.05));
    border-color: rgba(245, 158, 11, 0.3);
}

.security-badge.danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border-color: rgba(239, 68, 68, 0.3);
}

.security-icon {
    font-size: 1.25rem;
}

.security-text {
    flex: 1;
    font-weight: 500;
    color: #065f46;
    font-size: 0.875rem;
}

.security-badge.warning .security-text {
    color: #92400e;
}

.security-badge.danger .security-text {
    color: #991b1b;
}

.security-score {
    font-weight: 600;
    color: #059669;
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.security-badge.warning .security-score {
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.3);
}

.security-badge.danger .security-score {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Warnings */
.proceed-warnings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.warning-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.4;
}

.warning-icon {
    font-size: 1rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}

/* Source Info per Doppio Controllo */
.proceed-source-info {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 0.875rem;
}

.source-label {
    font-size: 0.75rem;
    color: #065f46;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.source-badge-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #065f46;
}

/* === FOOTER === */
.proceed-modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.btn-cancel,
.btn-proceed {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-cancel {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-cancel:hover {
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-proceed {
    background: linear-gradient(135deg, var(--primary-orange), var(--primary-orange-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(255, 120, 73, 0.3);
}

.btn-proceed:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 120, 73, 0.4);
}

.btn-proceed:active,
.btn-cancel:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1rem;
}

/* === ANIMATIONS === */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
}

.proceed-modal.closing .proceed-modal-container {
    animation: modalSlideOut 0.2s ease-in forwards;
}

.proceed-modal.closing .proceed-modal-backdrop {
    animation: modalFadeOut 0.3s ease-in forwards;
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 350px;
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
}

.toast.success {
    border-left: 4px solid var(--success);
    color: #065f46;
}

.toast.error {
    border-left: 4px solid var(--danger);
    color: #991b1b;
}

.toast.warning {
    border-left: 4px solid var(--warning);
    color: #92400e;
}

.toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .proceed-modal {
        padding: 0.5rem;
    }
    
    .proceed-modal-container {
        max-height: 95vh;
    }
    
    .proceed-modal-header {
        padding: 1rem 1rem 0.75rem;
    }
    
    .proceed-modal-body {
        padding: 0 1rem 1rem;
        gap: 0.75rem;
    }
    
    .proceed-modal-footer {
        padding: 0.75rem 1rem 1rem;
        flex-direction: column;
    }
    
    .btn-cancel,
    .btn-proceed {
        padding: 1rem;
    }
    
    .proceed-modal-icon {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
    
    .proceed-modal-title {
        font-size: 1.125rem;
    }
    
    .source-badges {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .toast-container {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
    }
    
    .toast {
        max-width: none;
        margin: 0 auto;
    }
}

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
    .proceed-modal-content {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .proceed-modal-title {
        color: #f1f5f9;
    }
    
    .proceed-modal-close {
        background: rgba(255, 255, 255, 0.1);
        color: #94a3b8;
    }
    
    .proceed-modal-close:hover {
        background: rgba(239, 68, 68, 0.2);
        color: #fca5a5;
    }
    
    .url-preview-label,
    .warning-item {
        color: #cbd5e1;
    }
    
    .url-preview-url {
        background: rgba(0, 0, 0, 0.3);
        color: #60a5fa;
        border-color: rgba(59, 130, 246, 0.3);
    }
    
    .btn-cancel {
        background: linear-gradient(135deg, #374151, #1f2937);
        color: #e5e7eb;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .btn-cancel:hover {
        background: linear-gradient(135deg, #4b5563, #374151);
    }
    
    .toast {
        background: rgba(30, 41, 59, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .toast.success {
        color: #6ee7b7;
    }
    
    .toast.error {
        color: #fca5a5;
    }
    
    .toast.warning {
        color: #fbbf24;
    }
}