/* ═══════════════════════════════════════════════════════
   Haste Calculator — css/haste.css  v2
   Depends on css/base.css (tokens + nav)
   ═══════════════════════════════════════════════════════ */

html { scroll-behavior: smooth; }

/* ── Container ────────────────────────────────────────── */
.haste-container {
  padding: 2.5rem 2.5rem 3rem;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
}

/* ── Header ───────────────────────────────────────────── */
.haste-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.haste-header h1 {
  margin: 0 0 .5rem 0;
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: .1em;
  line-height: 1.1;
  text-transform: uppercase;
}

.haste-header p {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 400;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════
   Controls Section
   ═══════════════════════════════════════════════════════ */
.haste-controls-section {
  background: linear-gradient(135deg, rgba(26,29,41,.85) 0%, rgba(30,33,48,.9) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow:
    0 8px 32px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.04);
  transition: border-color .3s ease, box-shadow .3s ease;
}

/* 4-col grid */
.haste-controls-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  position: relative;
}

.control-header {
  color: var(--text-accent);
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  text-align: center;
  margin: 0 0 .25rem 0;
  padding-bottom: .5rem;
  border-bottom: 1px solid rgba(124,58,237,.15);
}

/* ── Haste Input ──────────────────────────────────────── */
.haste-input {
  width: 100%;
  padding: 1rem .75rem;
  font-size: 1.25rem;
  font-weight: 800;
  font-family: inherit;
  background: rgba(15,17,23,.6);
  border: 2px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-primary);
  text-align: center;
  transition: all .3s cubic-bezier(.4,0,.2,1);
  outline: none;
  -moz-appearance: textfield;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.35);
  letter-spacing: .02em;
}
.haste-input::-webkit-outer-spin-button,
.haste-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.haste-input:focus {
  border-color: var(--accent-color);
  background: rgba(15,17,23,.8);
}
.haste-input:hover:not(:focus) {
  border-color: var(--border-hover);
}
.haste-input::placeholder {
  color: var(--text-muted);
  opacity: .5;
  font-weight: 500;
}

/* ── Buff / Race Toggles ──────────────────────────────── */
.buff-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  user-select: none;
  padding: .5rem .625rem;
  border-radius: 12px;
  transition: all .25s ease;
  background: rgba(15,17,23,.45);
  border: 1px solid var(--border-color);
  min-height: 52px;
}
.buff-toggle:hover {
  background: rgba(15,17,23,.6);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.race-checkbox,
.buff-checkbox { display: none; }

.buff-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: 2px solid var(--border-color);
  transition: all .3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  flex-shrink: 0;
}
.race-checkbox:checked ~ .buff-icon,
.buff-checkbox:checked ~ .buff-icon {
  border-color: var(--accent-color);
  transform: scale(1.05);
}

/* Custom switch track + thumb */
.buff-switch {
  position: relative;
  display: inline-block;
  width: 38px; height: 20px;
  flex-shrink: 0;
}
.buff-switch::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--border-color);
  border-radius: 10px;
  transition: all .35s cubic-bezier(.4,0,.2,1);
}
.buff-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: all .35s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 4px rgba(0,0,0,.3);
}
.race-checkbox:checked + .buff-switch::before,
.buff-checkbox:checked + .buff-switch::before {
  background: var(--accent-color);
}
.race-checkbox:checked + .buff-switch::after,
.buff-checkbox:checked + .buff-switch::after {
  transform: translateX(18px);
}

.buff-info {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  flex: 1;
  min-width: 0;
}
.buff-name {
  color: var(--text-primary);
  font-size: .8rem;
  font-weight: 700;
  transition: color .3s ease;
  line-height: 1.2;
}
.race-checkbox:checked ~ .buff-info .buff-name,
.buff-checkbox:checked ~ .buff-info .buff-name {
  color: var(--accent-color);
}
.buff-description {
  color: var(--text-muted);
  font-size: .675rem;
  font-weight: 500;
  line-height: 1.3;
  opacity: .75;
}

/* ═══════════════════════════════════════════════════════
   Results Layout  (left card · right table)
   ═══════════════════════════════════════════════════════ */
.haste-results-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  align-items: stretch;
}

/* ── Result Card ──────────────────────────────────────── */
.result-card {
  text-align: center;
  background: linear-gradient(160deg, rgba(26,29,41,.9) 0%, rgba(30,33,48,.95) 100%);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  padding: 1.5rem 1.25rem;
  box-shadow:
    0 8px 32px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.03);
  transition: border-color .3s ease, box-shadow .3s ease;
  height: 100%;
}

.result-label {
  font-size: .7rem;
  font-weight: 700;
  margin-bottom: .875rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-accent);
}

.result-value {
  font-size: 3.25rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: .75rem;
  line-height: 1;
  letter-spacing: -.03em;
}

.conversion-text {
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.4;
  min-height: 1.5rem;
}

/* GCD warning — absolutely positioned so it never shifts layout */
#gcdWarningInput {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  padding-top: .5rem;
}

.gcd-warning {
  background: linear-gradient(135deg, rgba(245,158,11,.9), rgba(234,88,12,.9));
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: .85rem;
  box-shadow: 0 4px 16px rgba(245,158,11,.25);
  text-align: center;
  line-height: 1.35;
  position: relative;
  cursor: default;
}

/* GCD Cap tooltip */
.gcd-warning .gcd-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  padding: .75rem 1rem;
  background: rgba(15,17,23,.97);
  color: var(--text-secondary);
  font-size: .75rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 9999;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
  text-align: left;
}
.gcd-warning .gcd-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(15,17,23,.97);
}
.gcd-warning:hover .gcd-tooltip {
  visibility: visible;
  opacity: 1;
}

/* ── WeakAura promo ───────────────────────────────────── */
.weakaura-container {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.weakaura-title {
  font-size: .8rem;
  font-weight: 700;
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-accent);
}
.weakaura-link {
  display: block;
  text-decoration: none;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  background: rgba(15,17,23,.5);
}
.weakaura-link:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.weakaura-image { width: 100%; height: auto; display: block; }

/* Import from Wago.io button */
.wago-import-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .75rem;
  padding: .65rem 1.25rem;
  background: linear-gradient(135deg, rgba(194,65,54,.85), rgba(168,50,42,.9));
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid rgba(194,65,54,.5);
  transition: all .3s cubic-bezier(.4,0,.2,1);
  letter-spacing: .03em;
}
.wago-import-btn:hover {
  background: linear-gradient(135deg, rgba(214,75,64,.95), rgba(194,65,54,1));
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(194,65,54,.35);
}
.wago-icon {
  width: 18px;
  height: 18px;
}
.weakaura-info {
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  text-align: center;
}
.weakaura-name {
  color: var(--accent-color);
  font-weight: 700;
  font-size: .85rem;
}
.weakaura-description {
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════
   DoT Breakpoint Table
   ═══════════════════════════════════════════════════════ */
.spells-table {
  background: linear-gradient(160deg, rgba(26,29,41,.9) 0%, rgba(30,33,48,.95) 100%);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow:
    0 8px 32px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.03);
  overflow: hidden;
  transition: border-color .3s ease, box-shadow .3s ease;
  height: 100%;
}

.table-header {
  background: rgba(0,0,0,.15);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.table-title {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: .06em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.spells-container { background: transparent; }

/* ── Spell Row ────────────────────────────────────────── */
.spell-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 2fr;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: all .25s ease;
  gap: 1.25rem;
}
.spell-row:last-child { border-bottom: none; }

.spell-row:hover {
  background: rgba(255,255,255,.03);
}

.spell-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

.spell-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  object-fit: cover;
  transition: all .3s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,.45);
  flex-shrink: 0;
}
.spell-icon:hover {
  border-color: var(--border-hover);
  transform: scale(1.08);
}

.spell-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all .25s ease;
}
.spell-name:hover {
  color: var(--text-secondary);
}

.base-ticks {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  text-align: center;
  padding: .4rem .6rem;
  background: rgba(15,17,23,.4);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.04);
  white-space: nowrap;
}

/* ── Ticks Badge ──────────────────────────────────────── */
.ticks-badge {
  padding: .5rem 1rem;
  border-radius: 24px;
  font-weight: 800;
  font-size: .8125rem;
  min-width: 85px;
  text-align: center;
  transition: all .35s ease;
  border: 2px solid transparent;
  white-space: nowrap;
  justify-self: center;
}
.ticks-badge.no-ticks {
  background: rgba(45,49,66,.6);
  color: var(--text-muted);
  opacity: .7;
}
.ticks-badge.has-ticks {
  background: linear-gradient(135deg, rgba(16,185,129,.15), rgba(16,185,129,.08));
  color: #34d399;
  border-color: rgba(16,185,129,.3);
}
.ticks-badge.high-ticks {
  background: linear-gradient(135deg, rgba(251,191,36,.15), rgba(245,158,11,.08));
  color: #fbbf24;
  border-color: rgba(251,191,36,.3);
}

/* ── Breakpoint info ──────────────────────────────────── */
.breakpoint-info {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  align-items: flex-start;
}
.breakpoint-text {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: 0;
}
.bp-pct {
  color: var(--text-primary);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.2;
}
.bp-rating {
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 500;
}
.breakpoint-maxed {
  color: var(--success-color);
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .03em;
}

/* Progress track */
.progress-container {
  width: 100%;
  max-width: 100%;
  height: 8px;
  background: rgba(15,17,23,.5);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.04);
}
.progress-bar {
  height: 100%;
  background: var(--accent-color);
  width: 0%;
  transition: width .8s cubic-bezier(.4,0,.2,1);
  border-radius: 3px;
}

/* ── Breakpoint explainer ─────────────────────────────── */
.breakpoint-explainer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,.04);
}
.breakpoint-explainer p {
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.65;
  margin: 0;
}
.breakpoint-explainer strong {
  color: var(--text-secondary);
  font-weight: 700;
}
.breakpoint-explainer a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.15);
  text-underline-offset: 2px;
  transition: color .2s ease, text-decoration-color .2s ease;
}
.breakpoint-explainer a:hover {
  color: var(--accent-color);
  text-decoration-color: var(--accent-color);
}
.explainer-icon {
  width: 15px;
  height: 15px;
  vertical-align: middle;
  margin-right: 2px;
  border-radius: 3px;
}

/* ═══════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════ */

/* Large desktop — controls go 2-col */
@media (max-width: 1400px) {
  .haste-controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet landscape — stack results, tighten spell rows */
@media (max-width: 1024px) {
  .haste-container {
    padding: 2rem 1.5rem 2.5rem;
  }
  .haste-controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .haste-results-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .result-card { position: relative; top: 0; }
  .spell-row {
    grid-template-columns: 1fr 110px 95px 170px;
    gap: 1rem;
    padding: 1.25rem;
  }
}

/* Tablet portrait — single column everything */
@media (max-width: 768px) {
  .haste-container { padding: 1.5rem 1rem 2rem; }
  .haste-header { margin-bottom: 1.5rem; }
  .haste-header h1 { font-size: 1.75rem; letter-spacing: .05em; }
  .haste-controls-section { padding: 1.25rem; border-radius: 16px; }
  .haste-controls-grid { grid-template-columns: 1fr; gap: .875rem; }
  .control-header[style*="visibility: hidden"] { display: none; }

  .haste-results-layout { grid-template-columns: 1fr; }
  .result-card { padding: 1.75rem 1.25rem; border-radius: 16px; }
  .result-value { font-size: 2.75rem; }

  .spells-table { border-radius: 16px; }
  .spell-row {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
    padding: 1.25rem 1rem;
  }
  .spell-info { justify-content: center; }
  .base-ticks { justify-self: center; }
  .ticks-badge { justify-self: center; }
  .breakpoint-info {
    text-align: center;
    align-items: center;
    margin: 0 auto;
  }
  .progress-container { max-width: 200px; }
  .table-header { padding: 1rem 1.25rem; }
  .table-title { font-size: 1.1rem; }
  .spell-icon { width: 44px; height: 44px; }
  .spell-name { font-size: .9rem; }

  .breakpoint-explainer { padding: 1rem 1.25rem; }
  .breakpoint-explainer p { font-size: .75rem; }
}

/* Phone */
@media (max-width: 480px) {
  .haste-container { padding: 1rem .75rem 1.5rem; }
  .haste-header { margin-bottom: 1.25rem; }
  .haste-header h1 { font-size: 1.5rem; }
  .haste-controls-section { padding: 1rem; border-radius: 12px; margin-bottom: 1.5rem; }
  .haste-controls-grid { gap: .75rem; }
  .control-header { font-size: .6rem; letter-spacing: 1px; }

  .buff-toggle { padding: .45rem .5rem; min-height: 46px; }
  .buff-name { font-size: .775rem; }
  .buff-description { font-size: .65rem; }
  .buff-icon { width: 26px; height: 26px; border-radius: 6px; }
  .buff-switch { width: 34px; height: 18px; }
  .buff-switch::after { width: 14px; height: 14px; }
  .race-checkbox:checked + .buff-switch::after,
  .buff-checkbox:checked + .buff-switch::after { transform: translateX(16px); }

  .result-card { padding: 1.25rem 1rem; border-radius: 14px; }
  .result-value { font-size: 2.25rem; }
  .result-label { font-size: .6rem; letter-spacing: 2px; }
  .conversion-text { font-size: .8rem; }

  .haste-input { font-size: 1.1rem; padding: .875rem .625rem; border-radius: 12px; }

  .spells-table { border-radius: 14px; }
  .spell-row { padding: 1rem .875rem; gap: .75rem; }
  .spell-icon { width: 40px; height: 40px; border-radius: 10px; }
  .spell-name { font-size: .85rem; }
  .base-ticks { font-size: .75rem; padding: .35rem .5rem; }
  .ticks-badge { font-size: .75rem; padding: .4rem .75rem; min-width: 75px; }
  .breakpoint-text { font-size: .75rem; }
  .progress-container { max-width: 160px; height: 6px; }
  .table-header { padding: .875rem 1rem; }
  .table-title { font-size: 1rem; }

  .weakaura-title { font-size: .72rem; }
  .wago-import-btn { font-size: .75rem; padding: .55rem 1rem; }

  .breakpoint-explainer { padding: .875rem 1rem; }
  .breakpoint-explainer p { font-size: .7rem; }

  .gcd-warning { font-size: .75rem; padding: .6rem 1rem; border-radius: 10px; }
  .gcd-warning .gcd-tooltip { width: 240px; font-size: .7rem; }
}

/* Very small phone */
@media (max-width: 360px) {
  .haste-container { padding: .75rem .5rem 1.25rem; }
  .haste-header h1 { font-size: 1.25rem; }
  .haste-controls-section { padding: .875rem; }

  .result-value { font-size: 2rem; }
  .result-card { padding: 1rem .875rem; }

  .spell-row { padding: .875rem .75rem; }
  .spell-icon { width: 36px; height: 36px; }
  .spell-name { font-size: .8rem; }

  .buff-toggle { padding: .4rem .45rem; min-height: 42px; border-radius: 10px; }
  .buff-icon { width: 24px; height: 24px; }
  .buff-name { font-size: .725rem; }
}
