/* ======================================= */
/* WEERSTAND CALCULATOR - MODERN UNIFIED   */
/* ======================================= */

/* ===== COLOR DEFINITIONS ===== */
/* Dark mode is default, light mode overrides via :root.light-mode */

.weerstand-calculator-card {
  /* Dark mode colors */
  --resistor-card-bg-card: var(--secondary-bg);
  --resistor-card-bg-input: var(--primary-bg);
  --resistor-card-bg-form: var(--secondary-bg);
  --resistor-card-border: var(--border-color);
  --resistor-card-text: var(--text-primary);
  --resistor-card-text-secondary: var(--text-secondary);
  --resistor-card-button-bg: var(--link-color);
  --resistor-card-button-text: var(--text-primary);
  --resistor-card-button-border: var(--border-color);
  --resistor-card-button-hover-border: var(--link-color);
  --resistor-card-button-hover-shadow: rgba(88, 166, 255, 0.2);
  --resistor-card-accent-blue: #3b82f6;
  --resistor-card-overlay-dark: rgba(255, 255, 255, 0.05);
  --resistor-card-overlay-medium: rgba(255, 255, 255, 0.08);
  --resistor-card-overlay-light: rgba(255, 255, 255, 0.03);
  --resistor-card-border-dark: rgba(45, 55, 72, 0.5);
  --resistor-card-focus-border: var(--link-color);
  --resistor-card-focus-shadow: rgba(88, 166, 255, 0.1);
}

/* Light mode color overrides */
:root.light-mode .weerstand-calculator-card {
  --resistor-card-bg-card: #ffffff;
  --resistor-card-bg-input: #ffffff;
  --resistor-card-bg-form: #f9fafb;
  --resistor-card-border: #d0d7de;
  --resistor-card-text: #24292f;
  --resistor-card-text-secondary: #57606a;
  --resistor-card-button-bg: #ffffff;
  --resistor-card-button-text: #24292f;
  --resistor-card-button-border: #d0d7de;
  --resistor-card-button-hover-border: #0969da;
  --resistor-card-button-hover-shadow: rgba(9, 105, 218, 0.15);
  --resistor-card-accent-blue: #3b82f6;
  --resistor-card-overlay-dark: #f9fafb;
  --resistor-card-overlay-medium: #f3f4f6;
  --resistor-card-overlay-light: #ffffff;
  --resistor-card-border-dark: #d0d7de;
  --resistor-card-focus-border: #0969da;
  --resistor-card-focus-shadow: rgba(9, 105, 218, 0.1);
}

/* ===== MAIN CARD ===== */
.weerstand-calculator-card {
  max-width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  background: var(--resistor-card-bg-card);
  border: 1px solid var(--resistor-card-border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: var(--resistor-card-text);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Gradient top border */
.weerstand-calculator-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--resistor-card-accent-blue), #2563eb, var(--resistor-card-accent-blue));
  background-size: 200% 100%;
  animation: weerstandGradientShift 3s ease infinite;
}

@keyframes weerstandGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ===== HEADER ===== */
.weerstand-calculator-card h1 {
  color: var(--resistor-card-text);
  font-size: 1.6rem;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.weerstand-calculator-card-subtitle {
  text-align: center;
  color: var(--resistor-card-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-weight: 400;
}

/* ===== SELECTOR ===== */
.weerstand-calculator-card-selector {
  text-align: center;
  background: var(--resistor-card-bg-form);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--resistor-card-border);
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.weerstand-calculator-card-selector:hover {
  border-color: var(--resistor-card-button-hover-border);
}

.weerstand-calculator-card-selector label {
  font-weight: 600;
  margin-right: 0.75rem;
  color: var(--resistor-card-text);
  font-size: 0.95rem;
}

.weerstand-calculator-card-selector select {
  padding: 0.625rem 1.125rem;
  border-radius: 8px;
  border: 2px solid var(--resistor-card-border);
  background: var(--resistor-card-bg-input);
  color: var(--resistor-card-text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.weerstand-calculator-card-selector select:hover {
  border-color: var(--resistor-card-button-hover-border);
}

.weerstand-calculator-card-selector select:focus {
  outline: none;
  border-color: var(--resistor-card-focus-border);
  box-shadow: 0 0 0 3px var(--resistor-card-focus-shadow);
}

/* ===== LAYOUT ===== */
.weerstand-calculator-card-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.weerstand-calculator-card-top {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ===== TABLE STYLING ===== */
.weerstand-calculator-card-table-container {
  overflow-x: auto;
  background: var(--resistor-card-bg-form);
  border-radius: 12px;
  border: 1px solid var(--resistor-card-border);
  padding: 1rem;
  height: fit-content;
}

.weerstand-calculator-card-color-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 0.85rem;
}

.weerstand-calculator-card-color-table thead th {
  background: var(--resistor-card-accent-blue);
  color: white;
  padding: 0.5rem;
  font-weight: 600;
  text-align: center;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.weerstand-calculator-card-color-table tbody td {
  padding: 0.5rem;
  text-align: center;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  min-width: 70px;
  font-size: 0.85rem;
  border: 2px solid transparent;
  box-sizing: border-box;
}

.weerstand-calculator-card-color-table tbody td.color-cell:not(.disabled):hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  border: 2px solid var(--resistor-card-accent-blue);
  z-index: 2;
}

.weerstand-calculator-card-color-table tbody td.color-cell.active {
  border: 2px solid var(--resistor-card-accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 4px 12px rgba(59, 130, 246, 0.4);
  z-index: 3;
}

.weerstand-calculator-card-color-table tbody td.color-cell.disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.weerstand-calculator-card-color-table tbody td.color-cell {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== VISUAL RESISTOR ===== */
.weerstand-calculator-card-resistor-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.875rem 1.25rem;
  background: var(--resistor-card-bg-form);
  border-radius: 12px;
  border: 1px solid var(--resistor-card-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.weerstand-calculator-card-resistor-visual:hover {
  border-color: var(--resistor-card-button-hover-border);
}

.weerstand-calculator-card-resistor-body {
  display: flex;
  align-items: center;
  position: relative;
}

.weerstand-calculator-card-resistor-lead {
  width: 60px;
  height: 3px;
  background: linear-gradient(180deg, #c0c0c0 0%, #808080 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.weerstand-calculator-card-resistor-bands-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 60px;
  padding: 0 1.25rem;
  background: linear-gradient(180deg, #e8dcc0 0%, #c4a772 50%, #8b7355 100%);
  border-radius: 30px;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  min-width: 180px;
}

.weerstand-calculator-card-resistor-bands-display::before,
.weerstand-calculator-card-resistor-bands-display::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
}

.weerstand-calculator-card-resistor-bands-display::before {
  left: 0;
  border-radius: 30px 0 0 30px;
}

.weerstand-calculator-card-resistor-bands-display::after {
  right: 0;
  border-radius: 0 30px 30px 0;
}

.weerstand-calculator-card-visual-band {
  width: 10px;
  height: 60px;
  border-radius: 2px;
  box-shadow: inset -1px 0 2px rgba(0, 0, 0, 0.3), inset 1px 0 2px rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
}

.weerstand-calculator-card-visual-band.spacer {
  width: 20px;
  background: transparent !important;
  box-shadow: none;
}

/* ===== ACTION BUTTONS ===== */
.weerstand-calculator-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.weerstand-calculator-card-btn {
  padding: 0.875rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.weerstand-calculator-card-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
  pointer-events: none;
}

.weerstand-calculator-card-btn:hover::before {
  width: 300px;
  height: 300px;
}

.weerstand-calculator-card-btn-icon {
  font-size: 1.1rem;
}

.weerstand-calculator-card-btn-primary {
  background: linear-gradient(135deg, var(--resistor-card-accent-blue) 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  border: 2px solid var(--resistor-card-accent-blue);
}

.weerstand-calculator-card-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  opacity: 0.9;
}

.weerstand-calculator-card-btn-primary:active {
  transform: translateY(0);
}

.weerstand-calculator-card-btn-secondary {
  background: var(--resistor-card-button-bg);
  color: var(--resistor-card-button-text);
  border: 2px solid var(--resistor-card-button-border);
}

.weerstand-calculator-card-btn-secondary:hover {
  background: var(--resistor-card-bg-card);
  border-color: var(--resistor-card-button-hover-border);
  transform: translateY(-2px);
}

/* ===== RESULT BOX ===== */
.weerstand-calculator-card-result {
  text-align: center;
  background: var(--resistor-card-bg-form);
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid var(--resistor-card-accent-blue);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
  transition: all 0.3s ease;
}

.weerstand-calculator-card-result:hover {
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.weerstand-calculator-card-result h3 {
  margin: 0 0 0.75rem 0;
  color: var(--resistor-card-accent-blue);
  font-size: 1.1rem;
  font-weight: 600;
}

.weerstand-calculator-card-result p {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--resistor-card-text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  font-family: 'Courier New', monospace;
}

/* ===== NOTE ===== */
.weerstand-calculator-card-note {
  text-align: center;
  color: var(--resistor-card-text-secondary);
  padding: 0.75rem;
  background: var(--resistor-card-bg-form);
  border-radius: 8px;
  border: 1px solid var(--resistor-card-border);
}

.weerstand-calculator-card-note small {
  font-size: 0.85rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 968px) {
  .weerstand-calculator-card-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

@media (max-width: 768px) {
  .weerstand-calculator-card {
    padding: 1rem;
    border-radius: 12px;
  }

  .weerstand-calculator-card h1 {
    font-size: 1.5rem;
  }

  .weerstand-calculator-card-subtitle {
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
  }

  .weerstand-calculator-card-resistor-visual {
    padding: 1.25rem 0.9375rem;
  }

  .weerstand-calculator-card-resistor-lead {
    width: 40px;
  }

  .weerstand-calculator-card-resistor-bands-display {
    height: 50px;
    padding: 0 0.9375rem;
    min-width: 140px;
  }

  .weerstand-calculator-card-visual-band {
    width: 8px;
    height: 50px;
  }

  .weerstand-calculator-card-actions {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }

  .weerstand-calculator-card-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .weerstand-calculator-card-result p {
    font-size: 1.5rem;
  }

  .weerstand-calculator-card-table-container {
    padding: 0.5rem;
  }
  
  .weerstand-calculator-card-color-table {
    font-size: 0.8rem;
  }
  
  .weerstand-calculator-card-color-table thead th {
    padding: 0.5rem;
    font-size: 0.85rem;
  }
  
  .weerstand-calculator-card-color-table tbody td {
    padding: 0.625rem;
    min-width: 60px;
    font-size: 0.85rem;
  }
}

@media (max-width: 576px) {
  .weerstand-calculator-card {
    padding: 1rem;
  }

  .weerstand-calculator-card h1 {
    font-size: 1.3rem;
  }

  .weerstand-calculator-card-subtitle {
    font-size: 0.85rem;
  }

  .weerstand-calculator-card-result p {
    font-size: 1.3rem;
  }
  
  .weerstand-calculator-card-table-container {
    padding: 0.375rem;
  }
  
  .weerstand-calculator-card-color-table {
    font-size: 0.75rem;
  }
  
  .weerstand-calculator-card-color-table thead th {
    padding: 0.375rem;
    font-size: 0.75rem;
  }
  
  .weerstand-calculator-card-color-table tbody td {
    padding: 0.5rem;
    min-width: 50px;
    font-size: 0.75rem;
  }
}