/* ===================== THEME ===================== */
:root {
  --bg:        #0a0e14;
  --bg-soft:   #0f141d;
  --panel:     #111824;
  --panel-2:   #161f2e;
  --border:    #1f2b3d;
  --border-lit:#2b3a52;
  --text:      #c8d3e0;
  --text-dim:  #6b7a8f;
  --accent:    #00ff9c;
  --accent-2:  #16e0bd;
  --cyan:      #38bdf8;
  --amber:     #ffb454;
  --red:       #ff5370;
  --shadow:    0 0 0 1px var(--border), 0 12px 32px rgba(0,0,0,.45);
  --mono: "Fira Code", "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--mono);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0,255,156,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(56,189,248,.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; min-height: 100vh; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 268px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { font-size: 19px; font-weight: 600; letter-spacing: .3px; white-space: nowrap; }
.brand .prompt { color: var(--accent); }
.brand .brand-name { color: var(--text); }
.cursor-blink { color: var(--accent); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 51%,100% { opacity: 0; } }

.brand-sub { color: var(--text-dim); font-size: 12px; margin: 6px 0 28px; }

.menu { display: flex; flex-direction: column; gap: 6px; flex: 1; }

.menu-item {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13.5px;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}
.menu-item .icon { color: var(--border-lit); font-weight: 600; transition: color .15s; }
.menu-item:hover { background: var(--panel); color: var(--text); }
.menu-item:hover .icon { color: var(--cyan); }
.menu-item.active {
  background: var(--panel-2);
  color: var(--accent);
  border-color: var(--border-lit);
  box-shadow: inset 2px 0 0 var(--accent);
}
.menu-item.active .icon { color: var(--accent); }

.sidebar-footer { color: var(--text-dim); font-size: 11px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ===================== MAIN ===================== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 44px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.dots { display: flex; gap: 7px; }
.dots span { width: 12px; height: 12px; border-radius: 50%; }
.dots span:nth-child(1) { background: var(--red); }
.dots span:nth-child(2) { background: var(--amber); }
.dots span:nth-child(3) { background: var(--accent); }
.topbar-path { color: var(--text-dim); font-size: 13px; }

.content { padding: 32px clamp(18px, 4vw, 48px); max-width: 1000px; width: 100%; }

/* ===================== TOOL SECTIONS ===================== */
.tool { display: none; animation: fade .25s ease; }
.tool.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tool-title { font-size: 24px; font-weight: 600; color: var(--text); }
.tool-title::before { content: "$ "; color: var(--accent); }
.tool-desc { color: var(--text-dim); margin: 8px 0 24px; font-size: 13px; }
.tool-desc code, .tool-desc { line-height: 1.6; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; color: var(--accent-2); font-size: 12.5px; }

/* ===================== CARD ===================== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.sub-title { font-size: 14px; color: var(--cyan); margin-bottom: 14px; font-weight: 500; }

/* ===================== FORM ELEMENTS ===================== */
.field { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.field label { font-size: 12px; color: var(--text-dim); }
.field-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font-family: var(--mono);
  background: var(--bg);
  border: 1px solid var(--border-lit);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,255,156,.12);
}
textarea { resize: vertical; }
select { cursor: pointer; }

/* Range */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--bg); border-radius: 6px; border: 1px solid var(--border-lit); cursor: pointer; padding: 0; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(0,255,156,.6); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }

/* ===================== BUTTONS ===================== */
.btn {
  font-family: var(--mono);
  background: var(--panel-2);
  border: 1px solid var(--border-lit);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #04130c; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #04130c; }
.btn.ghost { padding: 11px 13px; }

.btn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 16px 0; }
.presets { display: flex; gap: 8px; margin-top: 10px; }
.chip { font-family: var(--mono); background: var(--bg); border: 1px solid var(--border-lit); color: var(--text-dim); border-radius: 6px; padding: 5px 14px; cursor: pointer; font-size: 12px; }
.chip:hover { border-color: var(--cyan); color: var(--cyan); }

/* ===================== CHECKBOXES ===================== */
.checks { display: flex; flex-direction: column; gap: 11px; margin-top: 18px; }
.checks.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--text); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ===================== RESULTS ===================== */
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.result-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 13px 15px; display: flex; flex-direction: column; gap: 4px; }
.result-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }
.result-value { font-size: 16px; color: var(--accent); font-weight: 500; word-break: break-all; }

.error { color: var(--red); font-size: 12.5px; margin-top: 12px; min-height: 1em; }
.hint { color: var(--text-dim); font-size: 12px; margin-top: 12px; }

/* ===================== PASSWORD OUTPUT ===================== */
.output-row { display: flex; gap: 10px; margin-bottom: 14px; }
.mono-output { font-size: 16px; letter-spacing: .5px; color: var(--accent); }
.strength-bar { height: 6px; background: var(--bg); border-radius: 6px; overflow: hidden; margin-bottom: 22px; border: 1px solid var(--border); }
.strength-fill { height: 100%; width: 0; transition: width .3s, background .3s; border-radius: 6px; }

/* ===================== CONVERTER ===================== */
.conv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.conv-cell { display: flex; flex-direction: column; gap: 6px; }
.conv-cell label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }

/* ===================== TABS ===================== */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab { font-family: var(--mono); background: transparent; border: none; color: var(--text-dim); padding: 10px 16px; cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===================== CODE BLOCK ===================== */
.code-block { position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; margin-top: 14px; }
.code-block pre { padding: 16px; overflow-x: auto; }
.code-block code { background: none; color: var(--text); padding: 0; font-size: 13px; line-height: 1.6; white-space: pre; }
.copy-code { position: absolute; top: 8px; right: 8px; padding: 5px 12px; font-size: 12px; z-index: 2; }
.code-tag { position: absolute; top: 12px; left: 14px; font-size: 11px; color: var(--cyan); text-transform: uppercase; letter-spacing: 1px; }
.code-block:has(.code-tag) pre { padding-top: 34px; }

/* ===================== DNS TABLE ===================== */
.dns-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dns-table th, .dns-table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dns-table th { color: var(--cyan); font-weight: 500; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
.dns-table tbody tr:last-child td { border-bottom: none; }
.dns-table td:nth-child(1) { color: var(--amber); width: 70px; }
.dns-table td:nth-child(2) { color: var(--text-dim); width: 80px; }
.dns-table td:nth-child(3) { color: var(--accent); word-break: break-all; }

/* ===================== PWNED RESULT ===================== */
.pwned-result { margin-top: 18px; padding: 18px; border-radius: 8px; font-size: 14px; border: 1px solid var(--border); }
.pwned-result.safe { background: rgba(0,255,156,.08); border-color: var(--accent); color: var(--accent); }
.pwned-result.danger { background: rgba(255,83,112,.08); border-color: var(--red); color: var(--red); }
.pwned-result.loading { color: var(--text-dim); }
.pwned-result strong { font-size: 20px; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--accent); color: var(--accent);
  padding: 12px 22px; border-radius: 8px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: all .25s ease; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px) {
  .app { flex-direction: column; }

  /* Sidebar devient une barre supérieure compacte et collante */
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: column;
    padding: 12px 12px 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    background: rgba(10, 14, 20, .92);
  }
  /* Marque + sous-titre sur une seule ligne pour gagner de la hauteur */
  .brand { font-size: 17px; display: inline-flex; }
  .brand-sub { display: none; }

  /* Menu horizontal défilant, scrollbar masquée, accroche tactile */
  .menu {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin-top: 10px;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .menu::-webkit-scrollbar { display: none; }
  .menu-item {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 13px;
    min-height: 42px;
    scroll-snap-align: start;
  }
  .menu-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-footer { display: none; }

  /* La topbar décorative (boutons macOS) prend de la place : on la masque */
  .topbar { display: none; }

  .content { padding: 20px 16px 64px; }
  .tool-title { font-size: 19px; }
  .tool-desc { font-size: 12.5px; }
  .card { padding: 16px 14px; }

  /* iOS zoome quand un champ < 16px : on force 16px sur mobile */
  input[type="text"], input[type="password"], input[type="number"],
  select, textarea { font-size: 16px; }

  /* Champs et boutons empilés, cibles tactiles plus grandes */
  .field-row { flex-direction: column; align-items: stretch; gap: 14px; }
  .field-row .btn { width: 100%; }
  .field[style] { max-width: none !important; }   /* annule les max-width inline */
  .btn { padding: 13px 16px; }
  .btn-grid { grid-template-columns: 1fr 1fr; }
  .output-row { flex-wrap: wrap; }
  .output-row .mono-output { flex: 1 1 100%; }
  .output-row .btn { flex: 1; }

  .result-grid { grid-template-columns: 1fr 1fr; }
  .conv-grid { grid-template-columns: 1fr 1fr; }
  .checks.services { grid-template-columns: 1fr 1fr; }
  .checks .check { min-height: 36px; }

  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }
}

@media (max-width: 460px) {
  .btn-grid { grid-template-columns: 1fr; }
  .conv-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .checks.services { grid-template-columns: 1fr; }
  .mono-output { font-size: 15px; }
  .result-value { font-size: 15px; }
  .tool-title { font-size: 18px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-lit); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
