/* Teething chart tool: /tools/baby-teething-chart/ and /cs/nastroje/prorezavani-zoubku/ */

.teeth-tool {
  margin: 0 0 24px;
}

.teeth-intro {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink2);
}

/* Tooth map: visual representation of baby's mouth */
.teeth-map {
  margin: 24px 0;
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--line);
}

.teeth-jaw {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 12px auto;
  position: relative;
  max-width: 400px;
}

/* Create dental arch shape using transform */
.teeth-jaw-upper {
  padding-bottom: 12px;
}

.teeth-jaw-lower {
  padding-top: 12px;
}

/* Make upper teeth curve upward (convex arc) */
.teeth-jaw-upper .tooth-btn:nth-child(1) { transform: translateY(8px) rotate(-8deg); }
.teeth-jaw-upper .tooth-btn:nth-child(2) { transform: translateY(4px) rotate(-5deg); }
.teeth-jaw-upper .tooth-btn:nth-child(3) { transform: translateY(1px) rotate(-2deg); }
.teeth-jaw-upper .tooth-btn:nth-child(4) { transform: translateY(0px) rotate(-1deg); }
.teeth-jaw-upper .tooth-btn:nth-child(5) { transform: translateY(0px); }
.teeth-jaw-upper .tooth-btn:nth-child(6) { transform: translateY(0px); }
.teeth-jaw-upper .tooth-btn:nth-child(7) { transform: translateY(0px) rotate(1deg); }
.teeth-jaw-upper .tooth-btn:nth-child(8) { transform: translateY(1px) rotate(2deg); }
.teeth-jaw-upper .tooth-btn:nth-child(9) { transform: translateY(4px) rotate(5deg); }
.teeth-jaw-upper .tooth-btn:nth-child(10) { transform: translateY(8px) rotate(8deg); }

/* Make lower teeth curve downward (convex arc) */
.teeth-jaw-lower .tooth-btn:nth-child(1) { transform: translateY(-8px) rotate(8deg); }
.teeth-jaw-lower .tooth-btn:nth-child(2) { transform: translateY(-4px) rotate(5deg); }
.teeth-jaw-lower .tooth-btn:nth-child(3) { transform: translateY(-1px) rotate(2deg); }
.teeth-jaw-lower .tooth-btn:nth-child(4) { transform: translateY(0px) rotate(1deg); }
.teeth-jaw-lower .tooth-btn:nth-child(5) { transform: translateY(0px); }
.teeth-jaw-lower .tooth-btn:nth-child(6) { transform: translateY(0px); }
.teeth-jaw-lower .tooth-btn:nth-child(7) { transform: translateY(0px) rotate(-1deg); }
.teeth-jaw-lower .tooth-btn:nth-child(8) { transform: translateY(-1px) rotate(-2deg); }
.teeth-jaw-lower .tooth-btn:nth-child(9) { transform: translateY(-4px) rotate(-5deg); }
.teeth-jaw-lower .tooth-btn:nth-child(10) { transform: translateY(-8px) rotate(-8deg); }

.teeth-jaw-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink3);
  margin: 0 0 8px;
  text-align: center;
}

/* Individual tooth button */
.tooth-btn {
  width: 36px;
  height: 48px;
  border: 2px solid var(--line);
  border-radius: 6px 6px 10px 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.tooth-btn:hover {
  border-color: var(--caramel);
  transform: translateY(-2px);
  z-index: 1;
}

.tooth-btn:active {
  transform: translateY(0);
}

.tooth-btn.active {
  background: var(--caramel);
  border-color: var(--caramel);
}

.tooth-btn.active::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 18px;
  font-weight: bold;
}

/* Preserve arch shape on hover for upper teeth */
.teeth-jaw-upper .tooth-btn:nth-child(1):hover { transform: translateY(6px) rotate(-8deg); }
.teeth-jaw-upper .tooth-btn:nth-child(2):hover { transform: translateY(2px) rotate(-5deg); }
.teeth-jaw-upper .tooth-btn:nth-child(3):hover { transform: translateY(-1px) rotate(-2deg); }
.teeth-jaw-upper .tooth-btn:nth-child(4):hover { transform: translateY(-2px) rotate(-1deg); }
.teeth-jaw-upper .tooth-btn:nth-child(5):hover { transform: translateY(-2px); }
.teeth-jaw-upper .tooth-btn:nth-child(6):hover { transform: translateY(-2px); }
.teeth-jaw-upper .tooth-btn:nth-child(7):hover { transform: translateY(-2px) rotate(1deg); }
.teeth-jaw-upper .tooth-btn:nth-child(8):hover { transform: translateY(-1px) rotate(2deg); }
.teeth-jaw-upper .tooth-btn:nth-child(9):hover { transform: translateY(2px) rotate(5deg); }
.teeth-jaw-upper .tooth-btn:nth-child(10):hover { transform: translateY(6px) rotate(8deg); }

/* Preserve arch shape on hover for lower teeth */
.teeth-jaw-lower .tooth-btn:nth-child(1):hover { transform: translateY(-10px) rotate(8deg); }
.teeth-jaw-lower .tooth-btn:nth-child(2):hover { transform: translateY(-6px) rotate(5deg); }
.teeth-jaw-lower .tooth-btn:nth-child(3):hover { transform: translateY(-3px) rotate(2deg); }
.teeth-jaw-lower .tooth-btn:nth-child(4):hover { transform: translateY(-2px) rotate(1deg); }
.teeth-jaw-lower .tooth-btn:nth-child(5):hover { transform: translateY(-2px); }
.teeth-jaw-lower .tooth-btn:nth-child(6):hover { transform: translateY(-2px); }
.teeth-jaw-lower .tooth-btn:nth-child(7):hover { transform: translateY(-2px) rotate(-1deg); }
.teeth-jaw-lower .tooth-btn:nth-child(8):hover { transform: translateY(-3px) rotate(-2deg); }
.teeth-jaw-lower .tooth-btn:nth-child(9):hover { transform: translateY(-6px) rotate(-5deg); }
.teeth-jaw-lower .tooth-btn:nth-child(10):hover { transform: translateY(-10px) rotate(-8deg); }

/* Accessibility */
.tooth-btn:focus {
  outline: 2px solid var(--caramel);
  outline-offset: 2px;
}

/* Count display */
.teeth-count-wrap {
  text-align: center;
  margin: 16px 0;
}

.teeth-count {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink1);
}

/* Birth date input */
.teeth-age-input {
  margin: 20px 0;
}

.teeth-age-input label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--ink1);
}

.teeth-age-input input[type="date"] {
  width: 100%;
  max-width: 200px;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
}

.teeth-age-input input[type="date"]:focus {
  outline: 2px solid var(--caramel);
  outline-offset: 1px;
  border-color: var(--caramel);
}

/* Result display */
.teeth-result {
  margin: 24px 0;
  padding: 20px;
  background: var(--cream);
  border-radius: 12px;
  min-height: 80px;
}

.teeth-result-label {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink3);
  margin: 0 0 12px;
}

.teeth-next-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.teeth-next-list li {
  padding: 8px 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink1);
}

.teeth-next-list li strong {
  color: var(--caramel);
  font-weight: 600;
}

.teeth-result-big {
  font-size: 18px;
  font-weight: 600;
  color: var(--caramel);
  text-align: center;
  margin: 20px 0;
}

.teeth-result-help {
  font-size: 15px;
  color: var(--ink2);
  text-align: center;
  margin: 20px 0;
}

/* Reset button */
.teeth-reset {
  margin: 16px 0;
  text-align: center;
}

.teeth-reset button {
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--caramel);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.teeth-reset button:hover {
  border-color: var(--caramel);
  background: var(--cream);
}

.teeth-reset button:focus {
  outline: 2px solid var(--caramel);
  outline-offset: 2px;
}

/* Chart table */
.teeth-chart-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}

.teeth-chart-table th {
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--line);
  color: var(--ink1);
}

.teeth-chart-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink2);
}

.teeth-chart-table tr:last-child td {
  border-bottom: none;
}

/* Keep table as table on mobile (override any global responsive table CSS) */
@media (max-width: 640px) {
  .teeth-chart-table,
  .teeth-chart-table thead,
  .teeth-chart-table tbody,
  .teeth-chart-table tr,
  .teeth-chart-table th,
  .teeth-chart-table td {
    display: table;
    display: table-header-group;
    display: table-row-group;
    display: table-row;
    display: table-cell;
  }
  
  .teeth-chart-table {
    display: table;
    font-size: 14px;
  }
  
  .teeth-chart-table thead {
    display: table-header-group;
  }
  
  .teeth-chart-table tbody {
    display: table-row-group;
  }
  
  .teeth-chart-table tr {
    display: table-row;
  }
  
  .teeth-chart-table th,
  .teeth-chart-table td {
    display: table-cell;
    padding: 8px 4px;
    font-size: 14px;
  }
  
  .teeth-chart-table th:first-child,
  .teeth-chart-table td:first-child {
    width: 15%;
  }
}

/* Mobile optimization */
@media (max-width: 400px) {
  .tooth-btn {
    width: 32px;
    height: 44px;
  }
  
  .teeth-jaw {
    gap: 3px;
  }
  
  /* Slightly reduced curve on mobile */
  .teeth-jaw-upper .tooth-btn:nth-child(1) { transform: translateY(6px) rotate(-6deg); }
  .teeth-jaw-upper .tooth-btn:nth-child(2) { transform: translateY(3px) rotate(-4deg); }
  .teeth-jaw-upper .tooth-btn:nth-child(9) { transform: translateY(3px) rotate(4deg); }
  .teeth-jaw-upper .tooth-btn:nth-child(10) { transform: translateY(6px) rotate(6deg); }
  
  .teeth-jaw-lower .tooth-btn:nth-child(1) { transform: translateY(-6px) rotate(6deg); }
  .teeth-jaw-lower .tooth-btn:nth-child(2) { transform: translateY(-3px) rotate(4deg); }
  .teeth-jaw-lower .tooth-btn:nth-child(9) { transform: translateY(-3px) rotate(-4deg); }
  .teeth-jaw-lower .tooth-btn:nth-child(10) { transform: translateY(-6px) rotate(-6deg); }
}

/* Noscript fallback */
.teeth-fallback {
  padding: 20px;
  background: var(--cream);
  border-radius: 12px;
  margin: 20px 0;
}

.teeth-fallback p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.5;
}

/* Narrow phones: the chart table and the two jaws must fit 360-390 px without sideways scroll */
@media (max-width: 480px) {
  .teeth-chart-table { table-layout: fixed; font-size: 13px; }
  .teeth-chart-table th, .teeth-chart-table td { padding: 8px 4px; overflow-wrap: anywhere; hyphens: auto; }
  .teeth-chart-table th:first-child, .teeth-chart-table td:first-child { width: 2.5em; }
  .teeth-jaw { gap: 2px; }
  .teeth-jaw .tooth-btn { min-width: 0; flex: 1 1 0; }
}

/* Long source URLs must wrap on phones */
.tool-teething .prose { overflow-wrap: anywhere; }
