/* ============================================================
   DevTools Online — tool.css
   Stili condivisi per tutte le pagine tool
   ============================================================ */

/* Le variabili colore sono definite in shell.css (:root) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  min-height: 100%;
  position: relative;
  margin: 5px;
}

/* Grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.022) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

/* ── PAGE LAYOUT ────────────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 28px 60px;
}

.page-header { margin-bottom: 32px; animation: fadeDown 0.45s ease both; }

.page-title {
  font-size: 1.7rem;
  font-weight: 800;
  background: linear-gradient(90deg, var(--accent) 0%, #ffffff 70%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ── CARD ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  margin-bottom: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  animation: fadeUp 0.4s ease both;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ── GRID ───────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.mt { margin-top: 14px; }

@media (max-width: 560px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-wrap { padding: 20px 14px 40px; }
}

/* ── FORM ───────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }

label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text2);
  font-family: 'JetBrains Mono', monospace;
}

input[type=text], input[type=number], input[type=email],
input[type=password], input[type=date], input[type=search], select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  padding: 10px 13px;
  width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

input[type=date] { color-scheme: dark; }

/* Rimuove la lente nativa webkit che si sovrappone al testo */
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }

select option { background: var(--surface2); }

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0066cc);
  color: #fff;
  width: 100%;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(0,212,255,0.2);
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,212,255,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text2);
}

.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-icon {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-icon:hover          { border-color: var(--accent); color: var(--accent); }
.btn-icon.remove:hover   { border-color: var(--red);    color: var(--red);    }

.btn-download {
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 5px;
}

.btn-download:hover { background: var(--accent); color: var(--bg); }

.btn-download-all {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  background: rgba(0,255,157,0.05);
  color: var(--green);
  font-family: 'Syne', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin-top: 8px;
}

.btn-download-all:hover {
  background: rgba(0,255,157,0.1);
  box-shadow: 0 0 18px rgba(0,255,157,0.15);
}

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 14px;
  line-height: 1.5;
}

.alert.visible  { display: flex; }
.alert.error    { background: rgba(255,77,109,0.09);  border: 1px solid rgba(255,77,109,0.28);  color: var(--red);    }
.alert.success  { background: rgba(0,255,157,0.07);   border: 1px solid rgba(0,255,157,0.22);   color: var(--green);  }
.alert.info     { background: rgba(0,212,255,0.07);   border: 1px solid rgba(0,212,255,0.22);   color: var(--accent); }
.alert.warning  { background: rgba(255,176,32,0.08);  border: 1px solid rgba(255,176,32,0.25);  color: var(--amber);  }

/* ── PROGRESS ───────────────────────────────────────────────── */
.progress-bar  { height: 8px; background: var(--border); border-radius: 6px; margin: 16px 0 4px; overflow: hidden; display: none; }
.progress-bar.visible { display: block; }
.progress-bar.indeterminate .progress-fill {
  width: 42% !important;
  transition: none;
  animation: prog-slide 1.1s ease-in-out infinite;
}
@keyframes prog-slide {
  0%   { transform: translateX(-160%); }
  100% { transform: translateX(290%); }
}
.progress-msg {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: var(--text2);
  margin-bottom: 12px;
  min-height: 1.1rem;
  display: none;
  animation: prog-blink 1.2s ease-in-out infinite;
}
.progress-msg.visible { display: block; }
@keyframes prog-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 6px;
  width: 0%;
  transition: width 0.35s ease;
}

/* ── OUTPUT FILES ───────────────────────────────────────────── */
.output-section { display: none; animation: fadeUp 0.4s ease both; }
.output-section.visible { display: block; }

.output-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--green);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 12px;
}

.file-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.file-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--green);
  display: flex; align-items: center; gap: 7px;
}

.file-content {
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted);
  max-height: 90px;
  overflow: hidden;
  position: relative;
  line-height: 1.6;
  word-break: break-all;
}

.file-content::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 32px;
  background: linear-gradient(transparent, var(--surface));
}

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.badge-green { background: rgba(0,255,157,0.1);  color: var(--green);  border: 1px solid rgba(0,255,157,0.25); }
.badge-blue  { background: rgba(0,212,255,0.1);  color: var(--accent); border: 1px solid rgba(0,212,255,0.25); }
.badge-amber { background: rgba(255,176,32,0.1); color: var(--amber);  border: 1px solid rgba(255,176,32,0.25);}

/* ── DROP ZONE ──────────────────────────────────────────────── */
.import-drop {
  border: 2px dashed var(--border2);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 10px;
}

.import-drop:hover, .import-drop.dragover {
  border-color: var(--accent);
  background: rgba(0,212,255,0.04);
}

.import-drop .drop-icon { font-size: 1.6rem; }
.import-drop p { color: var(--muted); font-size: 0.95rem; margin-top: 5px; }

/* ── SAN ────────────────────────────────────────────────────── */
.san-list { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.san-item { display: flex; gap: 8px; align-items: center; }
.san-item input { flex: 1; }

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0);     }
}

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

/* ── CODE BLOCK ─────────────────────────────────────────────── */
pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  color: var(--text);
  overflow-x: auto;
  line-height: 1.8;
  margin-top: 8px;
}
