/* =========================================
   SHOPCONVERT — style.css
   Unit Converter for Mechanics
   Design system: white cards, #061d33 text,
   #ff9901 accent — DM Sans + IBM Plex Mono
   ========================================= */

:root {
  --primary:        #ff9901;
  --primary-hover:  #e68a00;
  --primary-light:  #fff7e6;
  --dark:           #061d33;
  --mid:            #4a5568;
  --muted:          #9ca3af;
  --border:         #e2e8f0;
  --bg:             #f7f8fa;
  --white:          #ffffff;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow:         0 4px 10px rgba(0,0,0,0.08);
  --shadow-md:      0 8px 24px rgba(0,0,0,0.12);
  --font-body:      'DM Sans', sans-serif;
  --font-mono:      'IBM Plex Mono', monospace;
}

/* ---- APP WRAPPER ---- */
.shopconvert-app {
  width: 100%;
  margin-bottom: 40px;
}

.shopconvert-app .app-container.shopconvert-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
}

/* ---- CATEGORY TABS ---- */
.sc-tabs {
  display: flex;
  gap: 0;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sc-tabs::-webkit-scrollbar { display: none; }

.sc-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  padding: 12px 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  white-space: nowrap;
  min-width: 0;
}

.sc-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2.5px;
  background: transparent;
  border-radius: 2px 2px 0 0;
  transition: all 0.15s;
}

.sc-tab:hover { color: var(--mid); }

.sc-tab.active {
  color: var(--primary);
}

.sc-tab.active::after {
  background: var(--primary);
  left: 15%;
  right: 15%;
}

.sc-tab svg { opacity: 0.6; transition: opacity 0.15s; }
.sc-tab.active svg { opacity: 1; stroke: var(--primary); }

/* ---- CONVERTER PANEL ---- */
.sc-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sc-input-area {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  gap: 10px;
  align-items: end;
}

.sc-field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sc-field-group:first-child {
  grid-column: 1 / -1;
}

.sc-field-group:nth-child(2) {
  grid-column: 1 / 2;
}

.sc-field-group:nth-child(4) {
  grid-column: 4 / 6;
}

.sc-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sc-input {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -moz-appearance: textfield;
}

.sc-input::-webkit-outer-spin-button,
.sc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sc-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,153,1,0.15);
}

.sc-select {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  background: var(--white);
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-sm);
  padding: 10px 30px 10px 11px;
  outline: none;
  cursor: pointer;
  appearance: none;
  width: 100%;
  background-image: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 12 12%22%3E%3Cpath fill=%22%239ca3af%22 d=%22M2 4l4 4 4-4z%22/%3E%3C/svg%3E');
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sc-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,153,1,0.15);
}

/* Swap button */
.sc-swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--mid);
  transition: all 0.15s;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 2px;
}

.sc-swap-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.sc-swap-btn:active { transform: scale(0.92); }

/* ---- RESULT ---- */
.sc-result {
  padding: 16px 18px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 68px;
  display: flex;
  align-items: center;
}

.sc-result-empty {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
  width: 100%;
  text-align: center;
}

.sc-result-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: sc-fadeIn 0.2s ease;
}

@keyframes sc-fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sc-result-primary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.sc-result-val {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.1;
  word-break: break-all;
}

.sc-result-unit {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.sc-result-formula {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

/* ---- ALL CONVERSIONS GRID ---- */
.sc-all-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sc-all-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sc-all-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.sc-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--white);
  transition: background 0.1s;
  cursor: pointer;
}

.sc-all-row:hover { background: var(--bg); }

.sc-all-row + .sc-all-row {
  border-top: 1px solid var(--border);
}

.sc-all-row.active-unit {
  background: var(--primary-light);
}

.sc-all-unit {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--mid);
  font-weight: 500;
}

.sc-all-val {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--dark);
  font-weight: 600;
}

/* ---- TOAST ---- */
.of-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--dark);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 4000;
  white-space: nowrap;
}

.of-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 520px) {
  .sc-tab { font-size: 10px; padding: 10px 6px 8px; }
  .sc-tab svg { width: 14px; height: 14px; }
  .sc-input { font-size: 18px; padding: 10px 12px; }
  .sc-result-val { font-size: 22px; }
  .sc-input-area {
    grid-template-columns: 1fr auto 1fr;
  }
  .sc-field-group:first-child {
    grid-column: 1 / -1;
  }
  .sc-field-group:nth-child(2) {
    grid-column: 1 / 2;
  }
  .sc-swap-btn {
    grid-column: 2 / 3;
  }
  .sc-field-group:nth-child(4) {
    grid-column: 3 / 4;
  }
}