/* sql2mongodb.com — foglio di stile condiviso fra index.php e guide.php */

:root {
  --bg:        #0f1117;
  --bg2:       #161b27;
  --surface:   #1e2436;
  --surface2:  #252d42;
  --border:    rgba(255,255,255,.07);
  --border2:   rgba(255,255,255,.12);
  --text:      #e8eaf0;
  --text-2:    #8892aa;
  --text-3:    #50596e;
  --green:     #4ade80;
  --green-d:   #22c55e;
  --green-s:   rgba(74,222,128,.08);
  --blue:      #60a5fa;
  --blue-s:    rgba(96,165,250,.08);
  --amber:     #fbbf24;
  --red:       #f87171;
  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow:    0 4px 24px rgba(0,0,0,.3);
  --font:      'DM Sans', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Fira Code', monospace;
  --t:         .18s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  line-height: 1.6;
}
img { display: block; max-width: 100%; }

/* ── NAV ─────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15,17,23,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 5%;
}
.nav-inner {
  max-width: 1000px; margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 11px 0; gap: 12px;
}
.nav-brand {
  font-family: var(--mono); font-size: .85rem;
  font-weight: 500; color: var(--text);
  text-decoration: none;
}
.nav-brand .sql  { color: var(--blue); }
.nav-brand .arr  { color: var(--text-3); margin: 0 4px; }
.nav-brand .mdb  { color: var(--green); }
.lang-switcher {
  display: flex; gap: 2px; flex-wrap: wrap;
}
.lang-switcher a {
  font-size: .72rem; font-weight: 500;
  color: var(--text-3); text-decoration: none;
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: color var(--t), background var(--t);
  min-height: 28px; display: inline-flex; align-items: center;
}
.lang-switcher a:hover { color: var(--text); background: var(--surface); }
.lang-switcher a.active { color: var(--green); background: var(--green-s); }

/* ── HERO ────────────────────────────────── */
.hero {
  padding: 72px 20px 56px;
  text-align: center;
  background: linear-gradient(180deg, #0f1117 0%, #12161f 100%);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(96,165,250,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96,165,250,.03) 1px, transparent 1px);
  background-size: 44px 44px;
}
.hero-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em;
  color: var(--green); border: 1px solid rgba(74,222,128,.2);
  background: var(--green-s); padding: .26rem .9rem;
  margin-bottom: 1.4rem;
}
.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 700; letter-spacing: -.03em;
  line-height: 1.1; margin-bottom: .9rem;
}
.hero h1 .h1-sub {
  display: block; margin-top: .25rem;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  font-weight: 400; letter-spacing: -.01em;
  color: var(--text-2);
}
.hero h1 .sql { color: var(--blue); }
.hero h1 .arr { color: var(--text-3); font-weight: 300; }
.hero h1 .mdb { color: var(--green); }
.hero-sub {
  font-size: clamp(.9rem, 2vw, 1.05rem);
  color: var(--text-2); max-width: 580px;
  margin: 0 auto 1.8rem; line-height: 1.75; font-weight: 300;
}
.feature-pills {
  display: flex; flex-wrap: nowrap;
  justify-content: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.feature-pills::-webkit-scrollbar { display: none; }
.pill {
  font-family: var(--mono); font-size: .64rem;
  letter-spacing: .08em; color: var(--text-3);
  border: 1px solid var(--border2);
  background: var(--surface); padding: 3px 10px;
  border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}

/* ── CONVERTER ───────────────────────────── */
.converter-section {
  padding: 48px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.converter-inner { max-width: 1000px; margin: 0 auto; }

.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px; align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-family: var(--mono); font-size: .72rem;
  letter-spacing: .1em; text-transform: uppercase;
}
.panel-title.sql-title { color: var(--blue); }
.panel-title.mongo-title { color: var(--green); }
.panel-dots { display: flex; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: #f87171; } .dot-y { background: #fbbf24; } .dot-g { background: #4ade80; }

.panel-body { padding: 0; }
#sql_query {
  display: block; width: 100%;
  padding: 16px;
  background: transparent; border: none; outline: none;
  font-family: var(--mono); font-size: .85rem;
  color: var(--text); line-height: 1.65;
  min-height: 220px; resize: vertical;
}
#sql_query::placeholder { color: var(--text-3); }

.convert-bar {
  grid-column: 1 / -1;
  display: flex; gap: 10px; align-items: center;
}
#convertBtn {
  flex: 1; padding: 12px;
  background: var(--green-d); color: #0a1a10;
  border: none; border-radius: var(--radius-md);
  font-family: var(--font); font-size: .95rem; font-weight: 700;
  cursor: pointer; min-height: 44px;
  transition: background var(--t), box-shadow var(--t);
}
#convertBtn:hover { background: var(--green); box-shadow: 0 0 0 3px var(--green-s); }

/* Output */
.output-panel .panel-body { position: relative; }
#mongo_output {
  display: block; width: 100%;
  padding: 16px;
  background: transparent;
  font-family: var(--mono); font-size: .85rem;
  color: var(--green); line-height: 1.65;
  min-height: 220px; white-space: pre-wrap;
  word-break: break-all;
}
.output-placeholder { color: var(--text-3); font-style: italic; font-family: var(--mono); font-size: .82rem; }
.copy-btn {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 12px; background: var(--surface2);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .68rem; color: var(--text-2);
  cursor: pointer; transition: color var(--t), background var(--t);
  display: none;
}
.copy-btn:hover { color: var(--green); background: var(--green-s); }
.copy-btn.visible { display: block; }

.error-box {
  grid-column: 1/-1;
  background: rgba(248,113,113,.08); color: var(--red);
  border: 1px solid rgba(248,113,113,.2);
  border-radius: var(--radius-sm); padding: 12px 16px;
  font-family: var(--mono); font-size: .82rem;
}

/* Examples */
.examples-bar {
  margin-top: 16px;
}
.examples-label {
  font-size: .72rem; color: var(--text-3);
  font-family: var(--mono); letter-spacing: .1em;
  text-transform: uppercase; margin-bottom: 8px; display: block;
}
.examples-list {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.example-btn {
  font-family: var(--mono); font-size: .68rem;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  padding: 4px 10px; cursor: pointer; white-space: nowrap;
  transition: color var(--t), border-color var(--t), background var(--t);
  min-height: 28px;
}
.example-btn:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-s); }

/* ── DOCS SECTION ────────────────────────── */
.docs-section {
  padding: 72px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.docs-inner { max-width: 1000px; margin: 0 auto; }
.section-tag {
  font-family: var(--mono); font-size: .67rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--green); display: block; margin-bottom: .6rem;
}
.section-title {
  font-size: clamp(1.3rem, 2.5vw, 1.9rem);
  font-weight: 700; letter-spacing: -.02em;
  color: var(--text); margin-bottom: .8rem;
}
.section-sub {
  font-size: .93rem; color: var(--text-2);
  line-height: 1.8; max-width: 640px; margin-bottom: 3rem;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1px; background: var(--border);
  margin-bottom: 48px;
}
.op-card {
  background: var(--bg2); padding: 1.6rem;
  transition: background var(--t);
}
.op-card:hover { background: var(--surface); }
.op-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: .7rem;
}
.op-badge {
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  padding: 2px 8px; border-radius: 4px; letter-spacing: .08em;
}
.badge-select { background: var(--blue-s); color: var(--blue); }
.badge-insert { background: var(--green-s); color: var(--green); }
.badge-update { background: rgba(251,191,36,.08); color: var(--amber); }
.badge-delete { background: rgba(248,113,113,.08); color: var(--red); }
.badge-agg    { background: rgba(167,139,250,.08); color: #a78bfa; }
.op-card h3 { font-size: .9rem; font-weight: 600; color: var(--text); }
.op-card p { font-size: .82rem; color: var(--text-2); line-height: 1.7; margin-bottom: .9rem; }
.code-block {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--mono); font-size: .72rem;
  color: var(--text-2); overflow-x: auto;
  white-space: pre; scrollbar-width: thin;
}
.code-block .kw  { color: var(--blue); }
.code-block .op  { color: var(--green); }
.code-block .val { color: var(--amber); }
.code-block .cmt { color: var(--text-3); }

/* Operators table */
.ops-table-wrap {
  overflow-x: auto; margin-bottom: 48px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.ops-table {
  width: 100%; border-collapse: collapse;
  font-size: .83rem; font-family: var(--mono);
}
.ops-table th {
  background: var(--surface2); color: var(--text-2);
  padding: 10px 16px; text-align: left;
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.ops-table td {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: top;
}
.ops-table tr:last-child td { border-bottom: none; }
.ops-table tr:hover td { background: var(--surface); }
.ops-table .sql-col { color: var(--blue); }
.ops-table .mongo-col { color: var(--green); }
.ops-table .note-col { color: var(--text-2); font-family: var(--font); font-size: .8rem; }

/* Why / FAQ */
.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5px; background: var(--border);
}
.faq-item {
  background: var(--bg2); padding: 1.6rem;
}
.faq-item h3 { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: .5rem; }
.faq-item p  { font-size: .83rem; color: var(--text-2); line-height: 1.75; }

/* ── FOOTER ──────────────────────────────── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 24px 20px; text-align: center;
}
.site-footer p { font-size: .75rem; color: var(--text-3); }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--green); }
.fsep { margin: 0 8px; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 700px) {
  .converter-grid { grid-template-columns: 1fr; }
  .convert-bar { grid-column: 1; }
  .hero { padding: 52px 16px 40px; }
  .docs-section, .converter-section { padding: 52px 16px; }
  .ops-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .hero h1 { font-size: 1.6rem; }
  .lang-switcher a { padding: 3px 5px; font-size: .65rem; }
}

/* ═══════════════════════════════════════════════════════════
   GUIDE  (guide.php)
   ═══════════════════════════════════════════════════════════ */

.nav-tool-link {
  font-size: .74rem; font-weight: 500; color: var(--text-2);
  text-decoration: none; padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border2); transition: color var(--t), border-color var(--t);
}
.nav-tool-link:hover { color: var(--green); border-color: var(--green); }

.guide-inner { max-width: 760px; margin: 0 auto; }

.guide-header {
  padding: 56px 20px 40px;
  background: linear-gradient(180deg, #0f1117 0%, #12161f 100%);
  border-bottom: 1px solid var(--border);
}
.breadcrumb { font-size: .74rem; color: var(--text-3); margin-bottom: 1.1rem; font-family: var(--mono); }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--green); }
.bc-sep { margin: 0 6px; color: var(--text-3); }

.guide-header h1 {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 700; letter-spacing: -.025em; line-height: 1.15;
  margin-bottom: .9rem;
}
.guide-standfirst {
  font-size: clamp(.95rem, 2vw, 1.08rem); color: var(--text-2);
  line-height: 1.75; font-weight: 300; margin-bottom: 1rem;
}
.guide-meta { font-family: var(--mono); font-size: .7rem; color: var(--text-3); letter-spacing: .05em; }

.guide-body { padding: 40px 20px 72px; background: var(--bg); }

/* Indice */
.toc {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg2); padding: 1.2rem 1.4rem; margin-bottom: 3rem;
}
.toc-label {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--green); display: block; margin-bottom: .7rem;
}
.toc ol { margin: 0; padding-left: 1.1rem; }
.toc li { margin-bottom: .35rem; font-size: .87rem; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--green); }

/* Corpo */
.guide-section { margin-bottom: 3rem; scroll-margin-top: 70px; }
.guide-section h2 {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 700;
  letter-spacing: -.02em; margin-bottom: 1rem; padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}
.guide-section h3 {
  font-size: .98rem; font-weight: 600; color: var(--text);
  margin: 1.8rem 0 .6rem;
}
.guide-section p { font-size: .92rem; color: var(--text-2); line-height: 1.85; margin-bottom: 1rem; }
.guide-section strong { color: var(--text); font-weight: 600; }
.guide-section em { color: var(--text); font-style: italic; }
.guide-section a { color: var(--green); text-decoration: none; border-bottom: 1px solid rgba(74,222,128,.3); }
.guide-section a:hover { border-bottom-color: var(--green); }
.guide-section code {
  font-family: var(--mono); font-size: .84em;
  background: var(--surface); padding: 1px 5px; border-radius: 4px; color: var(--text);
}
.guide-section .code-block { margin: 1rem 0 1.4rem; padding: 14px 16px; font-size: .76rem; line-height: 1.7; }
.guide-section .ops-table-wrap { margin: 1.2rem 0 1.6rem; }

.guide-list { margin: 0 0 1.2rem 1.2rem; padding: 0; }
.guide-list li {
  font-size: .92rem; color: var(--text-2); line-height: 1.8;
  margin-bottom: .5rem; padding-left: .3rem;
}
.guide-list-ol li { margin-bottom: .8rem; }

.callout {
  border-left: 2px solid var(--green);
  background: var(--green-s);
  padding: .9rem 1.2rem !important;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 1.4rem 0 !important;
  color: var(--text) !important;
}

/* CTA */
.guide-cta {
  border: 1px solid rgba(74,222,128,.22); background: var(--green-s);
  border-radius: var(--radius-md); padding: 1.6rem; margin: 3rem 0 2rem; text-align: center;
}
.guide-cta h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.guide-cta p { font-size: .87rem; color: var(--text-2); line-height: 1.7; margin-bottom: 1.1rem; }
.cta-btn {
  display: inline-block; padding: 10px 22px;
  background: var(--green-d); color: #0a1a10;
  border-radius: var(--radius-md); font-weight: 700; font-size: .9rem;
  text-decoration: none; transition: background var(--t);
}
.cta-btn:hover { background: var(--green); }

/* Correlati */
.related { border-top: 1px solid var(--border); padding-top: 1.4rem; }
.related ul { list-style: none; padding: 0; margin: 0; }
.related li { margin-bottom: .5rem; }
.related a { color: var(--text-2); text-decoration: none; font-size: .88rem; }
.related a:hover { color: var(--green); }

/* Blocco guide in home */
.guides-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--border); }
.guide-card { background: var(--bg2); padding: 1.5rem; text-decoration: none; display: block; transition: background var(--t); }
.guide-card:hover { background: var(--surface); }
.guide-card h3 { font-size: .92rem; font-weight: 600; color: var(--text); margin-bottom: .45rem; }
.guide-card p { font-size: .82rem; color: var(--text-2); line-height: 1.7; }
.guide-card .gc-arrow { color: var(--green); font-family: var(--mono); font-size: .75rem; margin-top: .7rem; display: block; }

@media (max-width: 700px) {
  .guide-header { padding: 40px 16px 32px; }
  .guide-body { padding: 32px 16px 56px; }
}
