/* ==========================================
   ELECTRONIC CONFIGURATION CALCULATOR STYLES
   ========================================== */
.ec-calc-wrapper * { box-sizing: border-box; margin: 0; padding: 0; }
.ec-calc-wrapper { font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 720px; width: 100%; margin: 24px auto; color: #1e293b; padding: 0 16px; }

/* Hero */
.calculator-hero { text-align: center; padding: 16px 0 8px; margin-bottom: 0; }
.calculator-hero h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 12px; background: linear-gradient(135deg, #5b21b6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; letter-spacing: -0.02em; }
.calculator-hero p { font-size: 1rem; color: #64748b; max-width: 600px; margin: 0 auto; line-height: 1.6; padding: 0 10px; }

/* Main Grid */
.calc-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
.left-panel, .right-panel { background: #ffffff; border: 1px solid #f1f5f9; border-radius: 16px; padding: 24px; min-height: 400px; width: 100%; min-width: 0; }
.left-panel h2, .right-panel h2 { font-size: 0.875rem; font-weight: 700; color: #0f172a; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Input Section */
.input-section { display: flex; flex-direction: column; gap: 16px; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-weight: 600; font-size: 0.8125rem; color: #475569; }
.input-row { display: flex; gap: 8px; }
.input-row > * { flex: 1; }

/* Element Dropdown - WIDER for better visibility */
.element-dropdown-wrapper { position: relative; flex: 1; }
.element-trigger { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: white; cursor: pointer; transition: all 0.2s; min-height: 48px; width: 100%; font-family: inherit; font-size: 0.9375rem; color: #0f172a; }
.element-trigger:hover { border-color: #8b5cf6; }
.element-trigger::after { content: '▼'; font-size: 0.6rem; color: #94a3b8; margin-left: 8px; }
.element-trigger .placeholder { color: #94a3b8; }
.element-trigger .selected-symbol { font-weight: 700; color: #5b21b6; margin-right: 8px; }
.element-trigger .selected-name { color: #0f172a; }

.element-options { 
  position: absolute; 
  top: calc(100% + 4px); 
  left: 0; 
  min-width: 340px;
  max-width: 90vw;
  background: white; 
  border: 1px solid #e2e8f0; 
  border-radius: 10px; 
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15); 
  z-index: 100; 
  display: none; 
  max-height: 400px; 
  overflow-y: auto; 
}
.element-options.open { display: block; }

.element-search { 
  width: 100%; 
  padding: 12px 14px; 
  border: none; 
  border-bottom: 1px solid #e2e8f0; 
  font-size: 0.875rem; 
  outline: none; 
  font-family: inherit; 
}
.element-search:focus { background: #faf5ff; }

/* Element option - spacious grid layout */
.element-option { 
  display: grid;
  grid-template-columns: 32px 40px 1fr;
  align-items: center;
  padding: 10px 14px; 
  cursor: pointer; 
  transition: background 0.15s; 
  border-bottom: 1px solid #f8fafc; 
  gap: 10px; 
  min-width: 0;
}
.element-option:hover { background: #f5f3ff; }

.element-option-number { 
  font-size: 0.75rem; 
  color: #94a3b8; 
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.element-option-symbol { 
  font-weight: 700; 
  color: #5b21b6; 
  font-size: 1rem; 
  text-align: center;
}
.element-option-name { 
  color: #0f172a; 
  font-size: 0.875rem; 
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Charge Select */
.charge-select { padding: 12px 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: white; font-family: inherit; font-size: 0.9375rem; color: #0f172a; cursor: pointer; outline: none; min-height: 48px; transition: all 0.2s; }
.charge-select:hover { border-color: #8b5cf6; }
.charge-select:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139,92,246,0.1); }

/* Elements Button */
.elements-btn { padding: 12px 16px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; color: #475569; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; white-space: nowrap; min-height: 48px; }
.elements-btn:hover { background: #f5f3ff; border-color: #8b5cf6; color: #5b21b6; }

/* Element Info Card */
.element-info-card { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border: 1px solid #e9d5ff; border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; min-height: 120px; transition: background 0.3s; margin-top: 16px; margin-bottom: 16px; }
.element-info-card.empty { background: #f8fafc; border-color: #e2e8f0; }
.element-info-tile { background: white; border-radius: 10px; padding: 12px 16px; min-width: 90px; text-align: center; border: 2px solid; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.element-info-tile.s-block { border-color: #ef4444; background: #fef2f2; }
.element-info-tile.p-block { border-color: #3b82f6; background: #eff6ff; }
.element-info-tile.d-block { border-color: #f59e0b; background: #fffbeb; }
.element-info-tile.f-block { border-color: #10b981; background: #ecfdf5; }
.element-info-number { font-size: 0.75rem; color: #64748b; text-align: left; }
.element-info-symbol { font-size: 1.75rem; font-weight: 800; color: #0f172a; line-height: 1; margin: 4px 0; }
.element-info-name-small { font-size: 0.6875rem; color: #475569; text-align: left; }
.element-info-details { flex: 1; }
.element-info-name { font-size: 1.25rem; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.element-info-mass { font-size: 0.875rem; color: #64748b; margin-bottom: 6px; }
.element-info-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.element-info-badge { font-size: 0.6875rem; padding: 3px 8px; background: white; border: 1px solid #e9d5ff; border-radius: 12px; color: #5b21b6; font-weight: 600; }
.element-info-placeholder { color: #94a3b8; font-size: 0.9375rem; font-style: italic; text-align: center; width: 100%; padding: 20px; }

/* Formula Reference Card */
.formula-wrapper { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.formula-heading { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; }
.aufbau-order { font-family: 'Courier New', monospace; font-size: 0.8125rem; color: #475569; line-height: 1.6; letter-spacing: 0.02em; }

/* Results Section */
.results-section { display: flex; flex-direction: column; gap: 16px; }

/* Result Cards */
.result-card { background: #faf5ff; border-left: 4px solid #8b5cf6; border-radius: 0 10px 10px 0; padding: 14px 16px; }
.result-card.empty { background: #f8fafc; border-left-color: #cbd5e1; }
.result-card-title { font-size: 0.6875rem; font-weight: 700; color: #5b21b6; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.result-card-value { font-family: 'Courier New', monospace; font-size: 1rem; color: #0f172a; line-height: 1.6; word-break: break-word; }
.result-card-value sup { font-size: 0.75em; color: #7c3aed; font-weight: 600; }
.result-card-value .noble-gas { color: #5b21b6; font-weight: 700; }
.result-card-placeholder { color: #cbd5e1; font-style: italic; font-family: inherit; font-size: 0.875rem; }

/* Shell Distribution */
.shell-distribution { display: flex; gap: 12px; flex-wrap: wrap; }
.shell-item { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 40px; }
.shell-label { font-size: 0.6875rem; font-weight: 700; color: #5b21b6; text-transform: uppercase; }
.shell-value { font-family: 'Courier New', monospace; font-size: 1.125rem; font-weight: 700; color: #0f172a; }

/* Properties List */
.properties-list { display: flex; flex-direction: column; gap: 8px; }
.property-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.property-row:last-child { border-bottom: none; }
.property-label { font-size: 0.8125rem; color: #475569; font-weight: 500; }
.property-value { font-size: 0.9375rem; color: #0f172a; font-weight: 600; font-family: 'Courier New', monospace; }
.property-value.magnetic-para { color: #059669; }
.property-value.magnetic-dia { color: #6366f1; }

/* Periodic Table Modal */
.periodic-table-modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.periodic-table-modal.open { display: flex; }
.periodic-table-content { background: white; border-radius: 16px; max-width: 1100px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px; position: relative; }
.periodic-table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.periodic-table-header h3 { font-size: 1.25rem; font-weight: 700; color: #0f172a; }
.periodic-table-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b; padding: 4px 8px; border-radius: 6px; font-family: inherit; }
.periodic-table-close:hover { background: #f1f5f9; color: #0f172a; }
.periodic-table-grid-wrapper { overflow-x: auto; margin-bottom: 16px; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.periodic-table-grid { display: grid; grid-template-columns: repeat(18, minmax(40px, 1fr)); gap: 3px; min-width: 720px; }
.pt-element { aspect-ratio: 1; border: 2px solid; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; padding: 2px; min-width: 0; overflow: hidden; }
.pt-element:hover { transform: scale(1.2); box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 2; }
.pt-element.selected { box-shadow: 0 0 0 3px #8b5cf6, 0 4px 12px rgba(139,92,246,0.4); transform: scale(1.1); z-index: 3; }
.pt-symbol { font-size: 0.75rem; font-weight: 700; line-height: 1; }
.pt-number { font-size: 0.5rem; opacity: 0.8; line-height: 1; }
.pt-placeholder { background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.625rem; color: #64748b; aspect-ratio: 1; }
.periodic-table-info { padding: 12px 16px; background: #f8fafc; border-radius: 10px; font-size: 0.875rem; color: #334155; min-height: 60px; margin-bottom: 12px; }
.periodic-table-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 16px; background: #f8fafc; border-radius: 10px; font-size: 0.8125rem; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 16px; height: 16px; border-radius: 3px; border: 1px solid; }
.legend-swatch.s-block { background: #fee2e2; border-color: #ef4444; }
.legend-swatch.p-block { background: #dbeafe; border-color: #3b82f6; }
.legend-swatch.d-block { background: #fef3c7; border-color: #f59e0b; }
.legend-swatch.f-block { background: #dcfce7; border-color: #10b981; }

/* Responsive */
@media (max-width: 768px) {
  .calc-main-grid { grid-template-columns: 1fr; gap: 20px; }
  .left-panel, .right-panel { padding: 20px; min-height: auto; }
  .ec-calc-wrapper { padding: 0 12px; }
  .calculator-hero h1 { font-size: 1.75rem; }
  .periodic-table-grid { min-width: 720px; }
  .pt-symbol { font-size: 0.625rem; }
  .pt-number { font-size: 0.4rem; }
  .periodic-table-content { padding: 16px; }
  .element-info-card { flex-direction: column; text-align: center; }
  .element-options { min-width: 300px; }
}
@media (min-width: 769px) {
  .left-panel, .right-panel { box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08); }
  .calculator-hero h1 { font-size: 2.25rem; }
  .calculator-hero p { padding: 0; }
}