/* =============================================================================
   ILS Measure Tools CSS — Styles for interactive ruler, divider & measurement UI
   Companion to ils-measure-tools.js | v1.0
   ============================================================================= */

/* ─── Live Measurement Readout ─── */
.mt-readout-wrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
}

.mt-readout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef2ff, #dbeafe);
  border: 2px solid #6366f1;
  font-size: 16px;
  font-weight: 700;
  color: #4338ca;
  transition: all 0.3s ease;
  min-width: 120px;
  justify-content: center;
}

.mt-readout.mt-readout-snapped {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #22c55e;
  color: #16a34a;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}

.dark .mt-readout {
  background: linear-gradient(135deg, #1e1b4b, #1e3a5f);
  border-color: #818cf8;
  color: #a5b4fc;
}

.dark .mt-readout.mt-readout-snapped {
  background: linear-gradient(135deg, #052e16, #14532d);
  border-color: #4ade80;
  color: #86efac;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

.mt-readout-icon {
  font-size: 18px;
}

.mt-readout-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mt-readout-value {
  font-size: 22px;
  font-weight: 800;
}

.mt-readout-detail {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.8;
}

.mt-readout-check {
  font-size: 16px;
  margin-left: 4px;
  animation: mt-check-pop 0.4s ease-out;
}

@keyframes mt-check-pop {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.3); }
  100% { transform: scale(1); opacity: 1; }
}

/* ─── Tool Mode Selector ─── */
.mt-tool-cards {
  display: flex;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.mt-tool-card {
  flex: 1;
  min-width: 130px;
  max-width: 220px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.mt-tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.25s;
}

.mt-tool-card:hover {
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
}

.mt-tool-card:hover::before {
  background: #6366f1;
}

.mt-tool-card.mt-tool-active {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4338ca;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.18);
}

.mt-tool-card.mt-tool-active::before {
  background: #6366f1;
}

.mt-tool-icon {
  font-size: 30px;
  display: block;
  margin-bottom: 6px;
}

.mt-tool-desc {
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  opacity: 0.7;
  line-height: 1.3;
}

.dark .mt-tool-card {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark .mt-tool-card:hover {
  border-color: #818cf8;
  background: #1e1b4b;
}

.dark .mt-tool-card:hover::before {
  background: #818cf8;
}

.dark .mt-tool-card.mt-tool-active {
  background: #312e81;
  border-color: #818cf8;
  color: #c7d2fe;
}

.dark .mt-tool-card.mt-tool-active::before {
  background: #818cf8;
}

/* ─── Segment Target Selector ─── */
.mt-target-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 10px 0;
  flex-wrap: wrap;
}

.mt-target-btn {
  padding: 10px 22px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  font-size: 15px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mt-target-btn:hover:not(:disabled) {
  border-color: #6366f1;
  background: #eef2ff;
  transform: translateY(-1px);
}

.mt-target-btn.mt-target-active {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4f46e5;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.mt-target-btn.mt-target-done {
  background: #dcfce7;
  border-color: #22c55e;
  color: #16a34a;
  cursor: default;
}

.mt-target-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.dark .mt-target-btn {
  background: #1e293b;
  border-color: #475569;
  color: #cbd5e1;
}

.dark .mt-target-btn:hover:not(:disabled) {
  border-color: #818cf8;
  background: #312e81;
}

.dark .mt-target-btn.mt-target-active {
  background: #312e81;
  border-color: #818cf8;
  color: #c7d2fe;
}

.dark .mt-target-btn.mt-target-done {
  background: #14532d;
  border-color: #4ade80;
  color: #86efac;
}

/* ─── Transfer Button (divider → ruler) ─── */
.mt-transfer-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: 2px solid #4f46e5;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.mt-transfer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.mt-transfer-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.mt-transfer-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.mt-transfer-btn .mt-transfer-arrow {
  display: inline-block;
  animation: mt-arrow-bounce 1.2s ease-in-out infinite;
}

@keyframes mt-arrow-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}

.dark .mt-transfer-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-color: #818cf8;
}

/* ─── Instruction Chip ─── */
.mt-instruction {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  font-size: 14px;
  font-weight: 600;
  color: #92400e;
  margin: 10px 0;
  line-height: 1.4;
}

.mt-instruction-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.dark .mt-instruction {
  background: #422006;
  border-color: #f59e0b;
  color: #fef3c7;
}

/* ─── Snap Flash Overlay ─── */
.mt-snap-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: rgba(34, 197, 94, 0.08);
  border: 2px solid #22c55e;
  opacity: 0;
  z-index: 10;
}

.mt-snap-flash.mt-flash-active {
  animation: mt-snap-glow 0.8s ease-out forwards;
}

@keyframes mt-snap-glow {
  0%   { opacity: 1; border-color: #22c55e; background: rgba(34, 197, 94, 0.15); }
  100% { opacity: 0; border-color: transparent; background: transparent; }
}

.dark .mt-snap-flash {
  background: rgba(74, 222, 128, 0.06);
  border-color: #4ade80;
}

/* ─── Status Indicators ─── */
.mt-status-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 8px 0;
  flex-wrap: wrap;
}

.mt-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  transition: all 0.3s;
}

.mt-status-chip.mt-status-active {
  background: #dbeafe;
  color: #2563eb;
  border-color: #93c5fd;
}

.mt-status-chip.mt-status-done {
  background: #dcfce7;
  color: #16a34a;
  border-color: #86efac;
}

.dark .mt-status-chip {
  background: #1e293b;
  color: #64748b;
  border-color: #334155;
}

.dark .mt-status-chip.mt-status-active {
  background: #1e3a5f;
  color: #60a5fa;
  border-color: #3b82f6;
}

.dark .mt-status-chip.mt-status-done {
  background: #052e16;
  color: #4ade80;
  border-color: #22c55e;
}

/* ─── Comparison Result Card ─── */
.mt-compare-result {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #86efac;
  margin: 12px 0;
  font-size: 15px;
  font-weight: 700;
  color: #166534;
}

.mt-compare-vs {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
  padding: 0 4px;
}

.mt-compare-winner {
  color: #16a34a;
}

.dark .mt-compare-result {
  background: linear-gradient(135deg, #052e16, #14532d);
  border-color: #4ade80;
  color: #bbf7d0;
}

.dark .mt-compare-vs {
  color: #64748b;
}

.dark .mt-compare-winner {
  color: #4ade80;
}

/* ─── Measurement Counter Badges ─── */
.mt-counter-row {
  display: flex;
  gap: 12px;
  margin: 12px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.mt-counter {
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 18px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  min-width: 100px;
  transition: all 0.3s;
}

.mt-counter .mt-counter-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: #6366f1;
  margin-bottom: 2px;
}

.mt-counter.mt-counter-done {
  border-color: #22c55e;
  background: #f0fdf4;
}

.mt-counter.mt-counter-done .mt-counter-num {
  color: #16a34a;
}

.dark .mt-counter {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark .mt-counter .mt-counter-num {
  color: #818cf8;
}

.dark .mt-counter.mt-counter-done {
  border-color: #4ade80;
  background: #052e16;
}

.dark .mt-counter.mt-counter-done .mt-counter-num {
  color: #4ade80;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .mt-tool-cards {
    gap: 6px;
  }

  .mt-tool-card {
    min-width: 100px;
    padding: 10px 8px 8px;
    font-size: 12px;
  }

  .mt-tool-icon {
    font-size: 24px;
    margin-bottom: 4px;
  }

  .mt-tool-desc {
    font-size: 10px;
  }

  .mt-readout {
    padding: 6px 12px;
    font-size: 14px;
    min-width: 100px;
  }

  .mt-readout-value {
    font-size: 18px;
  }

  .mt-target-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .mt-transfer-btn {
    padding: 8px 18px;
    font-size: 13px;
  }

  .mt-counter {
    min-width: 80px;
    padding: 8px 12px;
  }

  .mt-counter .mt-counter-num {
    font-size: 20px;
  }

  .mt-instruction {
    font-size: 12px;
    padding: 8px 12px;
  }

  .mt-compare-result {
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .mt-tool-card {
    min-width: 80px;
    padding: 8px 6px;
  }

  .mt-readout {
    padding: 5px 10px;
    font-size: 12px;
  }

  .mt-readout-value {
    font-size: 16px;
  }
}
