/* ── Subnet Module CSS ─────────────────────────────────────────────────────── */

#subnet-content {
  padding: 1.5rem;
}

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.subnet-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.subnet-tab {
  height: 44px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--sub);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: 0 16px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.subnet-tab.active {
  color: var(--accent, #7c6af7);
  border-bottom-color: var(--accent, #7c6af7);
  font-weight: 700;
}

/* ── Difficulty Buttons ────────────────────────────────────────────────────── */
.subnet-difficulty {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.subnet-diff-btn {
  flex: 1;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--r2, 8px);
  background: transparent;
  color: var(--sub);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.subnet-diff-btn.active[data-diff="leicht"] {
  border-color: #3ddc97;
  background: rgba(61, 220, 151, 0.1);
  color: #3ddc97;
}

.subnet-diff-btn.active[data-diff="mittel"] {
  border-color: #f7c36a;
  background: rgba(247, 195, 106, 0.1);
  color: #f7c36a;
}

.subnet-diff-btn.active[data-diff="schwer"] {
  border-color: #ff5c6a;
  background: rgba(255, 92, 106, 0.1);
  color: #ff5c6a;
}

/* ── Binary Panel ──────────────────────────────────────────────────────────── */
.subnet-binary-panel {
  background: var(--surface, #12121a);
  border-radius: var(--r, 12px);
  padding: 16px;
  margin-top: 16px;
}

.subnet-binary-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}

.subnet-binary-row:last-child {
  margin-bottom: 0;
}

.subnet-binary-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  min-width: 50px;
}

.subnet-binary-value {
  font-family: var(--mono);
  font-size: 0.81rem;
  color: var(--text, #e0e0e0);
  word-break: break-all;
}

.subnet-binary-net {
  color: #60a5fa;
  font-weight: 700;
}

.subnet-binary-host {
  color: #3ddc97;
  font-weight: 400;
}

/* ── Task Prompt ───────────────────────────────────────────────────────────── */
.subnet-task-prompt {
  background: var(--surface, #12121a);
  border-radius: var(--r, 12px);
  padding: 16px;
  margin-top: 16px;
}

.subnet-task-prompt .subnet-prompt-ip {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent, #7c6af7);
}

/* ── Form ──────────────────────────────────────────────────────────────────── */
.subnet-form {
  background: var(--surface, #12121a);
  border-radius: var(--r, 12px);
  padding: 16px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subnet-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subnet-field-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ── Octet Inputs ──────────────────────────────────────────────────────────── */
.subnet-octet-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.subnet-octet-input {
  width: 48px;
  height: 44px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--surface, #12121a);
  border: 1px solid var(--border);
  border-radius: var(--r2, 8px);
  color: var(--text);
  outline: none;
}

.subnet-octet-input:focus {
  border-color: var(--accent, #7c6af7);
}

.subnet-octet-dot {
  color: var(--sub);
  line-height: 44px;
  padding: 0 4px;
  font-family: var(--mono);
}

.subnet-octet-input.correct {
  border-color: #3ddc97;
  background: #0d2e1e;
}

.subnet-octet-input.wrong {
  border-color: #ff5c6a;
  background: #2e0d12;
}

.subnet-octet-input.solved {
  border-color: var(--sub, #6b6b8a);
  color: var(--sub, #6b6b8a);
}

/* ── Number Inputs ─────────────────────────────────────────────────────────── */
.subnet-number-input {
  width: 80px;
  height: 44px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2, 8px);
  color: var(--text);
  outline: none;
}

.subnet-number-input:focus {
  border-color: var(--accent);
}

.subnet-number-input.correct {
  border-color: #3ddc97;
  background: #0d2e1e;
}

.subnet-number-input.wrong {
  border-color: #ff5c6a;
  background: #2e0d12;
}

.subnet-number-input.solved {
  border-color: var(--sub);
  color: var(--sub);
}

.subnet-number-wide {
  width: 120px;
}

/* ── CIDR Prefix ───────────────────────────────────────────────────────────── */
.subnet-cidr-prefix {
  display: flex;
  align-items: center;
  gap: 4px;
}

.subnet-cidr-prefix span {
  color: var(--sub);
  font-family: var(--mono);
  font-size: 0.95rem;
}

/* ── Solution Row (Explanation + D2 side-by-side on desktop) ───────────────── */
.subnet-solution-row {
  margin-top: 16px;
}

/* ── Explanation ───────────────────────────────────────────────────────────── */
.subnet-explanation {
  background: var(--surface2, #1a1a2e);
  border: 1px solid var(--border);
  border-radius: var(--r, 12px);
  padding: 16px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s;
}

/* ── D2 Container ──────────────────────────────────────────────────────────── */
.subnet-d2-container {
  background: var(--surface, #12121a);
  border-radius: var(--r, 12px);
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}

.subnet-d2-container svg {
  max-width: 100%;
  height: auto;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .subnet-solution-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
  }
  .subnet-explanation {
    flex: 1;
    min-width: 0;
  }
  .subnet-d2-container {
    flex: 0 0 280px;
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .subnet-octet-group {
    flex-wrap: wrap;
    gap: 4px;
  }
  .subnet-octet-input {
    width: 44px;
  }
}

@media (max-width: 360px) {
  .subnet-difficulty {
    flex-direction: column;
  }
}

@media (min-width: 768px) {
  #subnet-content {
    max-width: 600px;
    margin: 0 auto;
  }
}
