/* ================================================================
   IP Subnet Calculator — subnet_calculator.css
   ================================================================ */

/* ── Wrap ── */
.sn-wrap {
  font-family: inherit;
  color: #1a2236;
}

/* ── Hero ── */
.sn-hero {
  background: linear-gradient(135deg, #1a2236 0%, #1e3a5f 100%);
  padding: 56px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.sn-hero::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(240,90,40,0.08);
  top: -120px; right: -80px;
  pointer-events: none;
}
.sn-hero::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -60px; left: -40px;
  pointer-events: none;
}
.sn-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
}
.sn-hero-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.35));
}
.sn-hero-icon svg { width: 100%; height: 100%; }
.sn-hero-title {
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.sn-hero-sub {
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 560px;
  margin-left: auto; margin-right: auto;
}

/* ── Outer container ── */
.sn-outer {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ── Calculator card ── */
.sn-calc-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px 28px 20px;
  margin-top: -28px;
  box-shadow: 0 8px 40px rgba(0,0,0,.10);
  position: relative;
  z-index: 2;
}

/* Input row */
.sn-inputs-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.sn-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sn-field-ip   { flex: 1 1 160px; }
.sn-field-cidr { flex: 0 0 80px; }
.sn-field-mask { flex: 1 1 160px; }
.sn-label {
  font-size: .78rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sn-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: .95rem;
  font-family: 'Courier New', monospace;
  color: #111827;
  background: #f9fafb;
  box-sizing: border-box;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.sn-input:focus {
  border-color: #f05a28;
  box-shadow: 0 0 0 3px rgba(240,90,40,.12);
  background: #fff;
}
.sn-input.sn-input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}
.sn-input-cidr {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}
.sn-sep {
  font-size: 1.6rem;
  font-weight: 700;
  color: #9ca3af;
  line-height: 1;
  padding-bottom: 10px;
  flex-shrink: 0;
}
.sn-btn {
  padding: 11px 24px;
  background: linear-gradient(135deg, #f05a28, #d44e22);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .02em;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform .18s, box-shadow .18s;
  box-shadow: 0 2px 12px rgba(240,90,40,.28);
  align-self: flex-end;
}
.sn-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(240,90,40,.4);
}

/* Slider row */
.sn-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.sn-slider-label {
  font-size: .75rem;
  font-weight: 600;
  color: #9ca3af;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.sn-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 5px;
  border-radius: 4px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
  position: relative;
}
.sn-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #f05a28;
  box-shadow: 0 2px 8px rgba(240,90,40,.35);
  cursor: pointer;
  transition: transform .15s;
}
.sn-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.sn-slider::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #f05a28;
  border: none;
  box-shadow: 0 2px 8px rgba(240,90,40,.35);
  cursor: pointer;
}
.sn-slider-live {
  font-size: .95rem;
  font-weight: 700;
  color: #f05a28;
  font-family: 'Courier New', monospace;
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
}

/* Error */
.sn-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  color: #b91c1c;
  font-size: .88rem;
  display: none;
}
.sn-error.sn-error--visible { display: block; }

/* ── Results section ── */
.sn-results {
  display: none;
  margin-top: 28px;
}
.sn-results.sn-results--visible { display: block; }
.sn-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.sn-results-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}
.sn-results-cidr {
  font-family: 'Courier New', monospace;
  color: #f05a28;
  font-size: 1rem;
}
.sn-copy-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background .18s, border-color .18s;
}
.sn-copy-all-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

/* Results grid */
.sn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 860px) { .sn-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .sn-grid { grid-template-columns: 1fr; } }

.sn-metric-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px 16px 14px;
  position: relative;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
  transition: box-shadow .18s, transform .18s;
}
.sn-metric-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  transform: translateY(-1px);
}
.sn-metric-icon {
  width: 22px; height: 22px;
  color: #f05a28;
  margin-bottom: 8px;
}
.sn-metric-icon svg { width: 100%; height: 100%; }
.sn-metric-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  margin-bottom: 6px;
}
.sn-metric-val {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  word-break: break-all;
  line-height: 1.3;
  min-height: 1.4em;
}
.sn-metric-val--large {
  font-size: 1.15rem;
  color: #f05a28;
}
.sn-metric-val--meta {
  font-family: inherit;
  font-size: .88rem;
  line-height: 1.5;
}
.sn-copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  border: none;
  background: #f3f4f6;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  padding: 0;
  transition: background .15s, color .15s;
}
.sn-copy-btn:hover { background: #e5e7eb; color: #f05a28; }
.sn-copy-btn svg { width: 14px; height: 14px; }

/* Accent top-border per card type */
.sn-mc-network   { border-top: 3px solid #3b82f6; }
.sn-mc-broadcast { border-top: 3px solid #8b5cf6; }
.sn-mc-mask      { border-top: 3px solid #f05a28; }
.sn-mc-wildcard  { border-top: 3px solid #10b981; }
.sn-mc-first     { border-top: 3px solid #06b6d4; }
.sn-mc-last      { border-top: 3px solid #f59e0b; }
.sn-mc-hosts     { border-top: 3px solid #f05a28; }
.sn-mc-meta      { border-top: 3px solid #6b7280; }

/* ── Binary card ── */
.sn-binary-card {
  background: #0f172a;
  border-radius: 10px;
  padding: 20px 22px;
  margin-top: 6px;
}
.sn-binary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.sn-binary-title {
  margin: 0;
  font-size: .92rem;
  font-weight: 700;
  color: rgba(255,255,255,.85);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.sn-binary-legend {
  font-size: .78rem;
  color: rgba(255,255,255,.5);
  display: flex;
  align-items: center;
  gap: 4px;
}
.sn-legend-bit {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
  line-height: 18px;
}

.sn-binary-table-wrap { overflow-x: auto; }
.sn-binary-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  white-space: nowrap;
}
.sn-binary-table th {
  color: rgba(255,255,255,.45);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: left;
  padding: 0 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sn-binary-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  vertical-align: middle;
}
.sn-binary-table tr:last-child td { border-bottom: none; }
.sn-bin-label {
  color: rgba(255,255,255,.55);
  font-size: .75rem;
  min-width: 130px;
  white-space: nowrap;
}
.sn-bin-val { letter-spacing: .1em; }
.sn-bin-decimal {
  color: rgba(255,255,255,.55);
  padding-left: 16px;
}
.sn-bin-dot {
  color: rgba(255,255,255,.3);
  padding: 0 1px;
}
.sn-bit-net {
  display: inline-block;
  color: #f05a28;
  background: rgba(240,90,40,.18);
  border-radius: 2px;
  font-weight: 700;
}
.sn-bit-host {
  display: inline-block;
  color: rgba(255,255,255,.55);
}

/* ── Reference table ── */
.sn-ref-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px;
  margin-top: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.sn-ref-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
}
.sn-ref-intro {
  margin: 0 0 18px;
  font-size: .88rem;
  color: #6b7280;
}
.sn-ref-table-wrap { overflow-x: auto; }
.sn-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 480px;
}
.sn-ref-table th {
  text-align: left;
  padding: 10px 14px;
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
}
.sn-ref-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}
.sn-ref-table code {
  font-family: 'Courier New', monospace;
  font-size: .88rem;
  font-weight: 700;
  color: #f05a28;
}
.sn-ref-table tbody tr {
  cursor: pointer;
  transition: background .14s;
}
.sn-ref-table tbody tr:hover { background: #fff7f4; }
.sn-ref-table tbody tr:hover td:first-child code { text-decoration: underline; }
.sn-ref-table tbody tr:last-child td { border-bottom: none; }

/* ── About grid ── */
.sn-about-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 28px;
}
@media (max-width: 680px) { .sn-about-grid { grid-template-columns: 1fr; } }

.sn-about-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.sn-about-card h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}
.sn-about-card p {
  margin: 0 0 10px;
  font-size: .9rem;
  line-height: 1.7;
  color: #4b5563;
}
.sn-about-card p:last-child { margin-bottom: 0; }
.sn-about-card code {
  font-family: 'Courier New', monospace;
  font-size: .85rem;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 3px;
  color: #1e3a5f;
}

/* ── Toast notification ── */
.sn-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: #111827;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
}
.sn-toast.sn-toast--show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .sn-hero { padding: 40px 16px 36px; }
  .sn-calc-card { padding: 20px 16px 16px; margin-top: -20px; }
  .sn-inputs-row { gap: 8px; }
  .sn-field-cidr { flex: 0 0 64px; }
  .sn-sep { font-size: 1.3rem; }
  .sn-ref-card, .sn-about-card { padding: 20px 16px; }
  .sn-binary-card { padding: 16px; }
  .sn-outer { padding: 0 12px 40px; }
}
