/**
 * Veewom Online Measurement Tools
 * Specialized Tools Stylesheet
 *
 * @package Veewom\RulerOnline
 */

/* ==========================================================================
   1. ONLINE RULER TOOL
   ========================================================================== */

.ruler-stage {
  position: relative;
  width: 100%;
  background-color: var(--white);
  border: 2px solid var(--slate-300);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.ruler-canvas-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background-color: #fffbeb;
  position: relative;
  cursor: crosshair;
}

#rulerCanvas {
  display: block;
  background-color: #fffdf5;
}

.ruler-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: var(--slate-50);
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--slate-200);
}

.ruler-controls-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.control-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--slate-700);
}

.form-select, .form-input {
  padding: 0.5rem 0.85rem;
  font-size: 0.92rem;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background-color: var(--white);
  color: var(--slate-800);
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-select:focus, .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.ppi-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background-color: var(--white);
  overflow: hidden;
}

.ppi-stepper input {
  width: 75px;
  border: none;
  text-align: center;
  font-weight: 700;
  padding: 0.5rem 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--slate-900);
}

.ppi-stepper input:focus {
  outline: none;
}

.ppi-step-btn {
  background-color: var(--slate-100);
  border: none;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--slate-700);
  transition: background-color var(--transition-fast);
}

.ppi-step-btn:hover {
  background-color: var(--slate-200);
}

/* Measurement Marker Readout Box */
.measurement-readout-card {
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
  color: var(--white);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.readout-col {
  display: flex;
  flex-direction: column;
}

.readout-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-400);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.readout-value {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fb923c;
  line-height: 1;
}

.readout-fraction {
  font-size: 1.1rem;
  color: #fdba74;
  margin-left: 0.35rem;
}

/* Calibration Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background-color: var(--white);
  border-radius: var(--radius-xl);
  max-width: 620px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--slate-200);
  overflow: hidden;
  animation: modalEnter 0.2s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  color: var(--slate-900);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--slate-500);
  line-height: 1;
}

.modal-body {
  padding: 1.75rem;
}

.modal-footer {
  padding: 1rem 1.75rem;
  background-color: var(--slate-50);
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Card Simulator for Calibration */
.credit-card-sim {
  margin: 1.5rem auto;
  height: 140px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 12px;
  border: 2px dashed #f97316;
  position: relative;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  color: var(--white);
  overflow: hidden;
  transition: width 0.05s ease-out;
}

.card-sim-chip {
  width: 38px;
  height: 28px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border-radius: 4px;
}

.card-sim-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--slate-300);
}

.card-sim-width-label {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fdba74;
}

/* ==========================================================================
   2. PRINTABLE RULER TOOL
   ========================================================================== */

.printable-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 0.5rem;
}

.printable-tab-btn {
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: var(--slate-600);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.printable-tab-btn:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.printable-tab-btn.active {
  background-color: var(--primary);
  color: var(--white);
}

.printable-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.printable-card {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.printable-preview-wrap {
  background-color: #f8fafc;
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.printable-preview-wrap img {
  max-height: 180px;
  width: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.printable-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.printable-card-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.printable-card-desc {
  color: var(--slate-600);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.download-options-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.download-btn-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--slate-800);
  background-color: var(--white);
  transition: all var(--transition-fast);
}

.download-btn-pill:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
  text-decoration: none;
}

.download-btn-pill svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

/* ==========================================================================
   3. PPI CALCULATOR TOOL
   ========================================================================== */

.calculator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 900px) {
  .calculator-layout {
    grid-template-columns: 1fr;
  }
}

.calc-form-group {
  margin-bottom: 1.25rem;
}

.calc-form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--slate-800);
  margin-bottom: 0.4rem;
}

.calc-input-row {
  display: flex;
  gap: 0.75rem;
}

.preset-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
}

.preset-chip {
  background-color: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-chip:hover {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.calc-results-card {
  background: linear-gradient(135deg, var(--white) 0%, var(--slate-50) 100%);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.calc-results-header {
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.calc-highlight-metric {
  text-align: center;
  padding: 1.25rem;
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.calc-highlight-metric .number {
  font-size: 2.75rem;
  font-weight: 900;
  color: var(--primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.calc-highlight-metric .unit {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
}

.results-metrics-table {
  width: 100%;
  border-collapse: collapse;
}

.results-metrics-table tr {
  border-bottom: 1px solid var(--slate-200);
}

.results-metrics-table tr:last-child {
  border-bottom: none;
}

.results-metrics-table td {
  padding: 0.75rem 0.5rem;
  font-size: 0.92rem;
}

.results-metrics-table td:first-child {
  color: var(--slate-600);
  font-weight: 500;
}

.results-metrics-table td:last-child {
  text-align: right;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--slate-900);
}

/* ==========================================================================
   4. INTERACTIVE PROTRACTOR TOOL
   ========================================================================== */

.protractor-stage {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.protractor-canvas-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
  position: relative;
  touch-action: none;
}

#protractorCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: grab;
}

#protractorCanvas:active {
  cursor: grabbing;
}

.protractor-angle-display {
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.angle-badge-value {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fb923c;
}

.angle-meta-pill {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-200);
}

/* ==========================================================================
   5. UNIT CONVERTER TOOL
   ========================================================================== */

.converter-container {
  max-width: 820px;
  margin: 0 auto;
}

.converter-card {
  background-color: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.75rem;
}

@media (max-width: 700px) {
  .converter-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.converter-col label {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--slate-800);
  margin-bottom: 0.5rem;
}

.converter-swap-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background-color: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 1.5rem;
}

@media (max-width: 700px) {
  .converter-swap-btn {
    margin: 0.5rem auto;
  }
}

.converter-swap-btn:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: rotate(180deg);
}

.converter-swap-btn svg {
  width: 20px;
  height: 20px;
}

.converter-result-banner {
  background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
  color: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin-bottom: 1.5rem;
}

.converter-result-formula {
  font-size: 0.92rem;
  color: var(--slate-400);
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}

.converter-table-wrap {
  overflow-x: auto;
  margin-top: 1.5rem;
}

.converter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.converter-table th, .converter-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--slate-200);
  text-align: left;
}

.converter-table th {
  background-color: var(--slate-50);
  font-weight: 700;
  color: var(--slate-800);
}

.converter-table tr:hover {
  background-color: var(--slate-50);
}
