/* ==========================================================================
   ToolNova Interactive Tools CSS
   ========================================================================== */

.tool-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (min-width: 900px) {
  .tool-layout-split {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.tool-panel-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tool-panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Forms and Inputs */
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9375rem;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-input[type="number"] {
  -moz-appearance: textfield;
}

.input-prefix-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.input-prefix-group .form-input {
  padding-left: 2rem;
}
.input-suffix {
  position: absolute;
  right: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
}
.input-suffix-group .form-input {
  padding-right: 2.2rem;
}

/* Radio & Checkbox Buttons / Segmented Controls */
.segmented-control {
  display: flex;
  background: var(--bg-page);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  gap: 0.25rem;
}
.segment-btn {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.segment-btn.active, .segment-btn:hover {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* File Dropzones */
.dropzone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--bg-page);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 1rem;
  color: var(--primary);
}
.dropzone-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}
.dropzone-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* Image / Preview Canvas Containers */
.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  min-height: 240px;
  max-height: 480px;
  margin-bottom: 1.25rem;
}
.preview-image {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
}

/* Range Sliders */
.range-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.range-slider {
  flex-grow: 1;
  accent-color: var(--primary);
  cursor: pointer;
}
.range-value {
  font-weight: 700;
  min-width: 3.5rem;
  text-align: right;
  font-family: var(--font-mono);
  color: var(--primary);
}

/* Result Metric Cards */
.results-card {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.results-hero {
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.results-hero-label {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.results-hero-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.results-hero-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-item {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius-md);
}
.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}
.metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}
.data-table th {
  background: var(--bg-page);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: var(--surface-hover);
}

/* Copy button & Toast */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.copy-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
