/* ==========================================================================
   PN Tech - Compact Engineering Resistor Color Code Calculator Styles
   Modern, elegant side-by-side engineering lab layout
   ========================================================================== */

:root {
  --rcalc-bg: #ffffff;
  --rcalc-border: #e2e8f0;
  --rcalc-border-focus: #3B281B;
  --rcalc-accent: #3B281B;
  --rcalc-accent-light: #533b28;
  --rcalc-gold: #d97706;
  --rcalc-lead: #94a3b8;
  --rcalc-body-grad-start: #f8fafc;
  --rcalc-body-grad-end: #e2e8f0;
}

/* Page Hero */
.rcalc-hero {
  background: radial-gradient(circle at 10% 20%, rgba(212, 163, 115, 0.14) 0%, rgba(250, 246, 238, 0.5) 45%, rgba(255, 255, 255, 0) 100%);
  padding: 2.75rem 1rem 1.75rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.rcalc-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--board);
  text-decoration: none;
  margin-bottom: 1rem;
  padding: 0.4rem 0.85rem;
  background: #FAF6EE;
  border: 1px solid #DCC28D;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.rcalc-breadcrumb:hover {
  background: var(--board);
  color: #ffffff;
  border-color: var(--board);
  transform: translateX(-3px);
}

.rcalc-btn-switch-tool {
  border: 1.5px solid #DCC28D;
  color: var(--board);
  padding: 0.45rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #FAF6EE;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(59, 40, 27, 0.05);
}

.rcalc-btn-switch-tool:hover {
  background: var(--board);
  color: #ffffff;
  border-color: var(--board);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 40, 27, 0.2);
}

.rcalc-hero-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.rcalc-hero-lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 750px;
  margin: 0;
}

/* Mode Switcher Tabs */
.rcalc-modes-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.rcalc-tabs {
  display: inline-flex;
  background: #FAF6EE;
  padding: 0.35rem;
  border-radius: 14px;
  border: 1.5px solid #E8DFC8;
}

.rcalc-tab-btn {
  background: transparent;
  border: none;
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.rcalc-tab-btn:hover {
  color: var(--board);
}

.rcalc-tab-btn.active {
  background: linear-gradient(135deg, #3B281B, #241F21);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(59, 40, 27, 0.25);
}

/* Main Side-by-Side Card */
.rcalc-panel-card {
  position: relative;
  background: #ffffff;
  border: 1.5px solid rgba(212, 163, 115, 0.45);
  border-radius: 20px;
  box-shadow: 0 12px 36px rgba(59, 40, 27, 0.06);
  padding: 2rem;
  margin-bottom: 2.25rem;
  overflow: hidden;
}

.rcalc-panel-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  background: linear-gradient(90deg, #3B281B 0%, #D4A373 50%, #10B981 100%);
}

.rcalc-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.25rem;
  align-items: start;
}

/* Left Column: Form Controls Grid */
.rcalc-controls-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rcalc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem 1.25rem;
}

.rcalc-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rcalc-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rcalc-label .rcalc-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.rcalc-select,
.rcalc-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  background: #f8fafc;
  font-family: inherit;
  transition: all 0.2s ease;
  appearance: auto;
  outline: none;
}

.rcalc-select:focus,
.rcalc-input:focus {
  border-color: var(--board);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 40, 27, 0.1);
}

/* Value Readout Box inside left grid */
.rcalc-readout-field {
  grid-column: span 1;
}

.rcalc-value-display {
  background: #FAF6EE;
  border: 1.5px solid #DCC28D;
  border-radius: 10px;
  padding: 0.6rem 1rem;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--board-deep);
  user-select: text;
  box-shadow: inset 0 1px 3px rgba(59, 40, 27, 0.05);
}

.rcalc-value-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: #E8DFC8;
  color: var(--board-deep);
  font-weight: 800;
}

/* Bottom Card Footer Actions: Reset, Display, Copy & View all Resistors on the same level */
.rcalc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1.5px dashed #E8DFC8;
  flex-wrap: wrap;
}

.rcalc-actions-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.rcalc-btn-reset {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.rcalc-btn-reset:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.06);
}

/* Signature Brand Buttons (Dark Brown with subtle shadow & hover) */
.rcalc-btn-match,
.rcalc-btn-calc {
  background: linear-gradient(135deg, #3B281B, #241F21);
  color: #ffffff;
  border: 1.5px solid #241F21;
  padding: 0.7rem 1.35rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(59, 40, 27, 0.22);
  font-family: inherit;
  text-decoration: none;
}

.rcalc-btn-match:hover,
.rcalc-btn-calc:hover {
  background: linear-gradient(135deg, #533b28, #3B281B);
  border-color: #3B281B;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(59, 40, 27, 0.35);
  color: #ffffff;
}

.rcalc-btn-match:active,
.rcalc-btn-calc:active {
  transform: translateY(0);
}

.rcalc-btn-copy {
  background: #FAF6EE;
  color: var(--board);
  border: 1.5px solid #DCC28D;
  padding: 0.68rem 1.15rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.rcalc-btn-copy:hover {
  background: #E8DFC8;
  border-color: var(--board);
  transform: translateY(-1px);
}

/* Right Column: Visualizer Box & Catalog Link */
.rcalc-visualizer-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rcalc-visualizer-box {
  background: radial-gradient(circle at 50% 50%, #ffffff 0%, #FAF8F5 100%);
  border: 1.5px solid #E8DFC8;
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1.25rem;
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 20px rgba(59, 40, 27, 0.04);
}

.rcalc-bench-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed #E8DFC8;
}

.rcalc-bench-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #FAF6EE;
  border: 1px solid #DCC28D;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--board);
}

.rcalc-bench-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.rcalc-bench-val {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--board-deep);
}

.rcalc-svg {
  width: 100%;
  max-width: 460px;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08));
}

/* Band Labels under Resistor */
.rcalc-band-tags {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.rcalc-band-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
}

.rcalc-band-tag-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.rcalc-right-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.rcalc-btn-view-all {
  background: #FAF6EE;
  color: var(--board);
  border: 1.5px solid #DCC28D;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(59, 40, 27, 0.05);
}

.rcalc-btn-view-all:hover {
  background: var(--board);
  border-color: var(--board);
  transform: translateY(-1px);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 40, 27, 0.2);
}

/* Reverse Mode (Value to Bands) */
.rcalc-reverse-card {
  display: none;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}

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

.rcalc-reverse-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.rcalc-target-group {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  transition: all 0.2s ease;
}

.rcalc-target-group:focus-within {
  border-color: var(--board);
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(59, 40, 27, 0.08);
}

.rcalc-target-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
}

.rcalc-target-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--board);
  background: rgba(59, 40, 27, 0.08);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.rcalc-target-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.rcalc-input-box {
  flex: 1.8;
}

.rcalc-unit-box {
  flex: 1.2;
}

.rcalc-target-input {
  width: 100%;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.65rem 0.95rem;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
}

.rcalc-target-input:focus {
  border-color: var(--board);
  box-shadow: 0 0 0 3px rgba(59, 40, 27, 0.12);
}

.rcalc-target-unit {
  width: 100%;
  height: 100%;
  font-size: 1rem;
  font-weight: 700;
  color: var(--board);
  background: #f1f5f9;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rcalc-target-unit:focus {
  border-color: var(--board);
  background: #ffffff;
}

.rcalc-rev-options-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.rcalc-input-row {
  display: flex;
  gap: 0.5rem;
}

.rcalc-input-row .rcalc-input {
  flex: 2;
}

.rcalc-input-row .rcalc-select {
  flex: 1;
}

.rcalc-chips-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.rcalc-chip-btn {
  background: #FAF6EE;
  border: 1.5px solid #E8DFC8;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--board);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.rcalc-chip-btn:hover {
  background: var(--board);
  color: #ffffff;
  border-color: var(--board);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(59, 40, 27, 0.2);
}

/* Matching Store Catalog Shelf */
.rcalc-shelf-section {
  margin-top: 2.5rem;
}

.rcalc-shelf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.rcalc-shelf-header h3 {
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rcalc-shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.rcalc-item-card {
  position: relative;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rcalc-item-card:hover {
  border-color: var(--board);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Distinct Green Border for Exact Matches */
.rcalc-item-card.is-exact {
  border: 2.5px solid #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.06) 0%, #ffffff 45%);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.18);
}

.rcalc-item-card.is-exact:hover {
  border-color: #059669;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.28);
}

/* Difference Badge above product */
.rcalc-diff-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-align: center;
  line-height: 1.3;
}

.rcalc-diff-badge.exact-match {
  background: #dcfce7;
  color: #15803d;
  border: 1.5px solid #86efac;
  box-shadow: 0 1px 3px rgba(22, 163, 74, 0.1);
}

.rcalc-diff-badge.diff-higher {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.rcalc-diff-badge.diff-lower {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.rcalc-item-img-link {
  display: block;
  text-decoration: none;
}

.rcalc-item-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  transition: transform 0.2s ease;
}

.rcalc-item-card:hover .rcalc-item-img {
  transform: scale(1.02);
}

.rcalc-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.rcalc-card-val-chip {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  background: #334155;
  color: #ffffff;
  display: inline-block;
  letter-spacing: 0.2px;
}

.rcalc-item-card.is-exact .rcalc-card-val-chip {
  background: #15803d;
}

.rcalc-item-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

.rcalc-item-name a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

.rcalc-item-name a:hover {
  color: var(--board);
}

.rcalc-item-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--board-deep);
  margin-bottom: 0.75rem;
}

.rcalc-card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
}

.rcalc-item-btn-view {
  flex: 1;
  background: #f1f5f9;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.rcalc-item-btn-view:hover {
  background: #e2e8f0;
  color: var(--board);
  border-color: #94a3b8;
}

.rcalc-item-btn {
  flex: 1.2;
  background: var(--board);
  color: #ffffff;
  border: none;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.rcalc-item-btn:hover {
  background: var(--board-deep);
}

/* Collapsible Reference Guide with Brand Accent */
.rcalc-guide-card {
  background: #ffffff;
  border: 1.5px solid #E8DFC8;
  border-radius: 16px;
  margin-top: 2.5rem;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(59, 40, 27, 0.04);
}

.rcalc-guide-header {
  padding: 1.1rem 1.5rem;
  background: #FAF6EE;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  color: var(--board-deep);
  user-select: none;
  transition: all 0.2s ease;
}

.rcalc-guide-header:hover {
  background: #F5EFEB;
  color: var(--board);
}

.rcalc-guide-body {
  padding: 1.25rem 1.5rem;
  border-top: 1.5px solid #E8DFC8;
  overflow-x: auto;
}

.rcalc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.rcalc-table th,
.rcalc-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid #E8DFC8;
  text-align: left;
}

.rcalc-table th {
  background: #FAF8F5;
  font-weight: 800;
  color: var(--board-deep);
  border-bottom: 2px solid #DCC28D;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .rcalc-main-grid,
  .rcalc-reverse-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .rcalc-visualizer-col {
    order: -1;
  }

  .rcalc-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 580px) {
  .rcalc-form-grid {
    grid-template-columns: 1fr;
  }

  .rcalc-readout-field {
    grid-column: span 1;
  }

  .rcalc-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .rcalc-actions-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .rcalc-actions-row button,
  .rcalc-actions-row a {
    justify-content: center;
    width: 100%;
  }

  .rcalc-right-actions {
    justify-content: center;
    width: 100%;
  }

  .rcalc-btn-view-all {
    width: 100%;
    justify-content: center;
  }
}
