/* :root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-strong: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --accent: #9333ea;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
} */

/* @media (prefers-color-scheme: dark) { */
  :root {
    --bg: #020617;
    --surface: #0f172a;
    --surface-strong: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --primary: #60a5fa;
    --primary-hover: #3b82f6;
    --success: #34d399;
    --accent: #c084fc;
    --danger: #f87171;
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
  }
/* } */

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.05), transparent 40%), var(--bg);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  line-height: 1.5;
}

img,
svg {
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  min-height: 44px;
  border-radius: 12px;
}

button {
  cursor: pointer;
}

.page-shell {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.hero {
  display: grid;
  gap: 16px;
  padding: 20px 0 18px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  line-height: 1.1;
}

.hero-copy {
  max-width: 54rem;
  margin: 0.6rem 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.95rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.lang-toggle {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: inherit;
  border-radius: 999px;
  width: 2.5rem;
  height: 2.5rem;
  min-height: unset;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.lang-toggle:hover {
  background: rgba(255,255,255,0.16);
}

main {
  display: grid;
  gap: 20px;
}

main > * {
  min-width: 0;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: box-shadow 0.3s ease;
}

section:hover {
  box-shadow: var(--shadow-md);
}

.panel-header,
.section-title {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.panel-header h2,
.section-title h2 {
  margin: 0;
  font-size: 1.3rem;
}

.panel-header p,
.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.secondary-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.secondary-button:hover {
  background: var(--surface-strong);
}

.upload-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 16px 0;
}

.upload-card {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 18px;
  background: var(--surface-strong);
  transition: all 0.2s ease;
}

.upload-card:hover,
.upload-card:focus-within {
  border-color: var(--primary);
  background: var(--surface);
}

.upload-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.upload-card input[type="file"] {
  width: 100%;
  margin-top: 10px;
  font-size: 0.875rem;
}

.upload-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.instructions-card {
  margin-top: 10px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.instructions-card h3 {
  margin-top: 0;
  font-size: 1rem;
}

.instructions-card ol {
  margin: 10px 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.instructions-card ol li {
  margin-bottom: 6px;
}

.error-message {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: none;
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 16px;
}

.stat-card {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  font-size: 1.8rem;
  line-height: 1;
}

.results-section .tab-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.tab-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0 18px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.tab-button.active {
  background: var(--primary);
  color: #ffffff;
  border-color: transparent;
}

.controls-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  margin: 16px 0;
  align-items: flex-end;
}

.control-label {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.875rem;
  min-width: 0;
}

.control-label input,
.control-label select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pagination-current {
  min-width: 7rem;
  text-align: center;
  font-weight: 600;
  color: inherit;
  font-size: 0.875rem;
}

.pagination-goto {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-goto-label {
  font-size: 0.875rem;
  color: var(--muted);
  white-space: nowrap;
}

.pagination-input {
  width: 4rem;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.875rem;
  text-align: center;
  min-height: 36px;
  -moz-appearance: textfield;
}

.pagination-input::-webkit-inner-spin-button,
.pagination-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

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

.pagination-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.results-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 0;
}

.results-table th,
.results-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  text-align: center;
}

.results-table th {
  color: var(--muted);
  font-weight: 600;
  padding: 15px 10px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table-actions {
  justify-content: center;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table td strong {
  display: inline-block;
  color: var(--text);
  padding: 12px 7px;
}

.results-table td a {
  color: var(--primary);
  text-decoration: none;
}

.results-table td a:hover,
.results-table td a:focus {
  text-decoration: underline;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-button {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-size: 0.825rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
}

.action-button .btn-short {
  display: none;
}

.action-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.privacy-section p {
  margin: 0 0 1rem;
  line-height: 1.8;
  color: var(--muted);
  font-size: 0.9rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
}

.fas, .fab, .far {
  margin-right: 0.5rem;
}

button .fas, button .fab {
  margin-right: 0.5rem;
}

.tab-button .fas {
  margin-right: 0.5rem;
}

.pagination-button .fas:last-child {
  margin-right: 0;
  margin-left: 0.5rem;
}

.pagination-button .fas:first-child {
  margin-right: 0.5rem;
  margin-left: 0.5rem;
}

@media (max-width: 840px) {
  .upload-grid {
    grid-template-columns: 1fr;
  }

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

  .panel-header,
  .section-title {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 12px;
  }

  section {
    padding: 16px;
    border-radius: 16px;
  }

  .hero {
    padding: 14px 0 12px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }
  
  .controls-row {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 12px 0;
  }

  .control-label {
    flex: 1 1 0;
  }

  .control-label input,
  .control-label select {
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .results-table {
    min-width: 100%;
  }

  .results-table th,
  .results-table td {
    padding: 10px 8px;
    font-size: 0.8rem;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
  }

  .pagination-info {
    text-align: center;
    width: 100%;
  }

  .pagination-controls {
    width: 100%;
    justify-content: center;
    gap: 0.75rem;
  }

  .pagination-controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    justify-items: center;
    align-items: center;
    width: 100%;
  }

  .pagination-button:first-of-type {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
  }

  .pagination-current {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.9rem;
    min-width: 5rem;
  }

  .pagination-goto {
    grid-column: 2;
    grid-row: 2;
  }

  .pagination-button:last-of-type {
    grid-column: 3;
    grid-row: 1;
    justify-self: start;
  }

  .pagination-button {
    flex: 0 1 auto;
    min-width: 90px;
    padding: 8px 12px;
    font-size: 0.8rem;
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-card strong {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .action-button .btn-full {
    display: none;
  }

  .action-button .btn-short {
    display: inline;
  }
}

/* ============================================
   COLORI ICONE
   ============================================ */

/* --- Header & Brand --- */
.eyebrow i {
  color: #3899ac; /* Instagram blue per il brand */
}

.hero h1 i {
  color: #3899ac; /* Instagram blue per il titolo principale */
}

/* --- Badge di sicurezza --- */
.badge i {
  color: #2ecc71; /* Verde per sicurezza/privacy */
}

/* --- Sezione Upload --- */
#upload-heading i {
  color: #3498db; /* Blu per upload */
}

.upload-card h3 i {
  color: #9b59b6; /* Purple per followers/following */
}

.upload-hint i {
  color: #7f8c8d; /* Grigio neutro per hint/informazioni */
}

.instructions-card h3 i {
  color: #f39c12; /* Orange per istruzioni */
}

/* --- Stats Section --- */
.stat-card:nth-child(1) i {
  color: #3498db; /* Total followers - blu */
}

.stat-card:nth-child(2) i {
  color: #9b59b6; /* Total following - purple */
}

.stat-card:nth-child(3) i {
  color: #e74c3c; /* Non-followers - rosso (warning) */
}

.stat-card:nth-child(4) i {
  color: #2ecc71; /* Fans - verde (positivo) */
}

.stat-card:nth-child(5) i {
  color: #f39c12; /* Mutuals - orange (bilanciato) */
}

/* --- Tab Buttons --- */
.tab-button[data-group="nonFollowers"] i {
  color: #e74c3c; /* Rosso per non-followers */
}

.tab-button[data-group="fans"] i {
  color: #2ecc71; /* Verde per fans */
}

.tab-button[data-group="mutuals"] i {
  color: #f39c12; /* Orange per mutuals */
}

.tab-button.active[data-group="nonFollowers"] i {
  color: #c0392b; /* Rosso più intenso per active */
}

.tab-button.active[data-group="fans"] i {
  color: #27ae60; /* Verde più intenso per active */
}

.tab-button.active[data-group="mutuals"] i {
  color: #d68910; /* Orange più intenso per active */
}

/* --- Controls (Search & Sort) --- */
.control-label i {
  color: #7f8c8d; /* Grigio neutro per controlli */
}

/* --- Table Headers --- */
.results-table th i {
  color: #3498db; /* Blu per header della tabella */
}

/* --- Pagination --- */
.pagination-button i {
  color: #3498db; /* Blu per navigazione */
}

/* --- Privacy Section --- */
.privacy-section h2 i {
  color: #2ecc71; /* Verde per privacy/security */
}

.privacy-section p i {
  color: #2ecc71; /* Verde per check/code icons */
}

/* ============================================
   SCROLL REVEAL ANIMATION
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  pointer-events: none;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.skeleton-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  width: min(90vw, 420px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skeleton-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-strong) 25%, rgba(148, 163, 184, 0.15) 50%, var(--surface-strong) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-line.short  { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long   { width: 100%; }

.skeleton-line.title {
  height: 18px;
  width: 50%;
  margin-bottom: 0.25rem;
}

.skeleton-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--surface-strong) 25%, rgba(148, 163, 184, 0.15) 50%, var(--surface-strong) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skeleton-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.skeleton-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-loading-text {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ============================================
   TABLE CROSS-FADE TRANSITION
   ============================================ */

.table-fade {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.table-fade.switching {
  opacity: 0.4;
  transform: translateY(6px);
}

/* ============================================
   FILTERED RESULTS COUNTER
   ============================================ */

.search-counter {
  margin: 0 0 0 auto;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  align-self: flex-end;
}

@media (max-width: 640px) {
  .search-counter {
    font-size: 0.75rem;
  }
}

/* ============================================
   COPY USERNAME BUTTON
   ============================================ */

.username-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0px;
}

.copy-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 4px;
  min-height: unset;
  font-size: 0.8rem;
  transition: all 0.2s;
  opacity: 0.55;
  display: inline-flex;
  align-items: center;
}

.copy-btn:focus-visible,
.copy-btn:hover {
  opacity: 1;
  color: var(--primary);
  border-color: var(--border);
  background: var(--surface-strong);
}

.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ============================================
   RELATIVE TIME
   ============================================ */

.relative-time {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  opacity: 0.7;
}

/* ============================================
   ROW CLICKED STATE
   ============================================ */

.row-clicked {
  opacity: 0.6;
}

.row-clicked:hover {
  opacity: 0.85;
}


/* --- Error Message --- */
.error-message i {
  color: #e74c3c; /* Rosso per errori */
}

/* --- Reset Button --- */
#resetButton i {
  color: #f39c12; /* Orange per refresh/reset */
}

/* Colore per le righe cliccate */
.row-clicked {
  background-color: #4b537d !important;
  transition: background-color 0.2s ease;
}