/* style.css — tema scuro ispirato a YouTube */

:root {
  --bg:        #0f0f0f;
  --surface:   #1c1c1e;
  --surface-2: #272729;
  --border:    #333336;
  --text:      #f1f1f1;
  --text-dim:  #9a9a9c;
  --accent:    #ff0033;
  --accent-2:  #ff5e7a;
  --radius:    14px;
  --shadow:    0 8px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a1a1d 0%, var(--bg) 60%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }

code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .88em;
}

a { color: inherit; }

/* --- Topbar --- */
.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(15,15,15,.7);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand__logo {
  display: inline-grid; place-items: center;
  width: 30px; height: 22px; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 12px; padding-left: 2px;
}
.topbar__right { display: flex; align-items: center; gap: 16px; }
.ghlink { color: var(--text-dim); text-decoration: none; font-size: 14px; }
.ghlink:hover { color: var(--text); }

/* Switch lingua IT / EN */
.langswitch {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
}
.langswitch__btn {
  border: 0; background: transparent; color: var(--text-dim);
  font: 600 13px/1 inherit; padding: 6px 12px; border-radius: 999px;
  cursor: pointer; transition: background .15s, color .15s;
}
.langswitch__btn:hover { color: var(--text); }
.langswitch__btn--active { background: var(--accent); color: #fff; }

/* --- Upload --- */
.upload { text-align: center; padding: 60px 0 40px; }
.upload__title { font-size: clamp(28px, 5vw, 44px); margin: 0 0 12px; letter-spacing: -.02em; }
.upload__subtitle { color: var(--text-dim); max-width: 560px; margin: 0 auto 32px; font-size: 17px; }

.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 44px 24px;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .1s;
  max-width: 560px; margin: 0 auto;
}
.dropzone:hover, .dropzone--over { border-color: var(--accent); background: var(--surface-2); }
.dropzone--over { transform: scale(1.01); }
.dropzone__icon {
  font-size: 30px; width: 60px; height: 60px; margin: 0 auto 14px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); color: var(--accent);
}
.dropzone__text { font-size: 16px; }
.dropzone__hint { color: var(--text-dim); font-size: 13px; margin-top: 8px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 24px; color: var(--text-dim); }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--surface-2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  color: #ff6b6b; background: rgba(255,0,51,.08);
  border: 1px solid rgba(255,0,51,.25); border-radius: 10px;
  padding: 12px 16px; max-width: 560px; margin: 20px auto 0; font-size: 14px;
}

/* --- Guida "dove trovo il file" --- */
.guide { max-width: 560px; margin: 40px auto 0; text-align: left; }
.guide__title { font-size: 18px; margin: 0 0 18px; text-align: center; }
.steps { list-style: none; margin: 0; padding: 0; }
.step {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.step__num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--accent); color: #fff;
}
.step__body { font-size: 15px; color: var(--text); }
.step__body a { color: var(--accent-2); }
.step__path {
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim); word-break: break-word;
}
.step__path strong { color: var(--text); }
.step__note { display: block; margin-top: 8px; font-size: 12.5px; color: var(--text-dim); }

/* --- Stats --- */
.results { padding: 32px 0 40px; }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; text-align: center;
}
.stat--action {
  cursor: pointer; color: var(--text); font: inherit;
  transition: background .2s, border-color .2s;
}
.stat--action:hover { background: var(--surface-2); border-color: var(--accent); }
.stat__value {
  font-size: 28px; font-weight: 700; letter-spacing: -.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat__label { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* --- Grid card --- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card__title { margin: 0 0 16px; font-size: 18px; }

/* --- Search --- */
.search {
  width: 100%; padding: 12px 14px; font-size: 15px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .2s;
}
.search:focus { border-color: var(--accent); }
.search-results { margin-top: 14px; max-height: 420px; overflow-y: auto; }
.search-hint { color: var(--text-dim); font-size: 14px; }

.result {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px; border-radius: 10px; text-decoration: none;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.result:hover { background: var(--surface-2); border-color: var(--border); }
.result__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result__meta { text-align: right; flex-shrink: 0; }
.result__count { display: block; color: var(--accent-2); font-weight: 700; }
.result__extra { display: block; color: var(--text-dim); font-size: 12px; }

/* --- Top list --- */
.toplist { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.toplist__item { display: flex; align-items: center; gap: 14px; padding: 9px 0; }
.toplist__rank {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--text-dim);
}
.toplist__item:nth-child(1) .toplist__rank { background: var(--accent); color: #fff; }
.toplist__item:nth-child(2) .toplist__rank,
.toplist__item:nth-child(3) .toplist__rank { background: var(--accent-2); color: #fff; }
.toplist__body { flex: 1; min-width: 0; }
.toplist__head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.toplist__name {
  font-weight: 600; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toplist__name:hover { color: var(--accent-2); }
.toplist__count { color: var(--text-dim); font-size: 14px; flex-shrink: 0; }
.bar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar__fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* --- Footer --- */
.footer { text-align: center; color: var(--text-dim); font-size: 13px; padding: 20px 20px 40px; }

.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
