:root {
  --bg-dark: #121212;
  --bg-card: #1e1e1e;
  --bg-row-alt: #181818;
  --text-light: #e0e0e0;
  --border-color: #333;
  --accent-blue: #00d4ff;
}

body {
  margin: 0;
  background: var(--bg-dark);
  color: var(--text-light);
  font-family: Arial, Helvetica, sans-serif;
}

.wrapper { padding: 20px; }
.controls { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.quality-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.quality-tabs button {
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-light);
  cursor: pointer;
}
.quality-tabs button.active {
  background: linear-gradient(135deg, #00d4ff 0%, #016478 100%);
  border-color: var(--accent-blue);
}

.bpt-table { width: 100%; border-collapse: collapse; }
.bpt-table th, .bpt-table td { padding: 8px; border: 1px solid var(--border-color); }
.bpt-table thead { background: var(--bg-card); }
.bpt-table tbody tr:nth-child(odd) { background: var(--bg-card); }
.bpt-table tbody tr:nth-child(even) { background: var(--bg-row-alt); }
.actions { white-space: nowrap; }
.bpt-table .rank-col { text-align: center; }
.bpt-table .rank-col a { color: #fff !important; }
.bpt-table td.name-col { text-align: right; }
.bpt-table th.name-col { text-align: left; }
.sort-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  margin-right: 4px;
}
.bpt-table .symbol-col {
  text-align: center;
  font-size: 26px;
  padding: 0px;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 80px;
  color: #00d4ff;
}
.bpt-table thead .symbol-col {
  font-size: inherit;
  padding: 8px;
}
.bpt-table .value-col { text-align: left; }
.copyable { cursor: pointer; }
.fundamental-col { display: none; }
.bpt-table.editing .fundamental-col { display: table-cell; }
.bpt-table.editing td { padding: 0; }
.bpt-table.editing td input,
.bpt-table.editing td select { width: 100%; box-sizing: border-box; padding: 8px; }

.btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(135deg, #00d4ff 0%, #016478 100%);
  cursor: pointer;
  font-size: 14px;
}
.btn-small { font-size: 12px; padding: 2px 6px; }
.btn:hover { opacity: 0.9; }

.modal { position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.7); display:flex; align-items:center; justify-content:center; z-index:4000; }
.modal.hidden { display:none; }
  .modal-content { background: var(--bg-card); padding:20px; border-radius:4px; max-height:90vh; overflow:auto; width:900px; }
  .form-grid { display:flex; flex-direction:column; gap:10px; }
  .form-grid label { display:flex; flex-direction:column; }
  input, select, textarea { background:#333; color:#fff; border:1px solid var(--border-color); border-radius:4px; padding:4px; }
  .modal-actions { margin-top:10px; display:flex; justify-content:flex-end; gap:10px; }

  .hidden { display:none; }

  #dimension-search,
  #quality-search { margin-bottom:4px; }

#save-confirmation .modal-content { position:relative; }
#details-modal .modal-content { position:relative; width:90%; max-width:600px; }
.close-modal { position:absolute; top:10px; right:10px; background:none; border:none; color:#fff; font-size:20px; cursor:pointer; }
  #confirmation-details,
  #details-list { list-style:none; padding-left:0; }
  #confirmation-details li,
  #details-list li { margin-bottom:5px; }

  /* Modal form layout mirroring details page */
  .modal-content .columns { display:flex; gap:20px; }
  .modal-content .column { flex:1; display:flex; flex-direction:column; gap:20px; }
  .modal-content .box { background: var(--bg-card); border:1px solid var(--border-color); padding:10px; border-radius:4px; }
  .modal-content .box h2 { margin-top:0; }
  .modal-content .form-grid label { font-weight:bold; }
  .modal-content .form-grid label.checkbox { flex-direction:row; align-items:center; font-weight:normal; }
  .modal-content .form-grid input[disabled],
  .modal-content .form-grid textarea[disabled],
  .modal-content .form-grid select[disabled] { background:#222; color:#aaa; }

/* Calculator popout */
.calc-trigger-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(45deg, #00d4ff, #4fc3f7);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
  z-index: 1000;
}

.calc-trigger-btn:hover {
  transform: scale(1.05);
}

.scroll-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: linear-gradient(45deg, #00d4ff, #4fc3f7);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
  z-index: 3000;
}

.scroll-toggle-btn:hover {
  transform: scale(1.05);
}


.popout-overlay {
  position: fixed;
  top: 0;
  right: 0;
  width: 66.6667%; /* slide-out width (2/3 of page) */
  height: 100%;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 2000;
  display: flex;
}

.popout-overlay.active {
  transform: translateX(0);
}


.calculator-window {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px 0 0 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  padding: 20px;
  position: relative;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 30px;
  height: 30px;
  background: #ff4757;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}

.close-btn:hover { background: #ff3742; }

.sidebar {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 15px;
  overflow-y: auto;
}

.main-calc {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.calc-header h2 {
  margin: 0;
  color: #00d4ff;
  font-size: 24px;
  margin-bottom: 5px;
}

.calc-header p {
  margin: 0;
  color: #b0b0b0;
  font-size: 14px;
}

.calc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.header-links {
  display: flex;
  gap: 15px;
}

.header-links a {
  color: var(--text-light);
  text-decoration: none;
}

.header-links a:hover {
  text-decoration: none;
}

.header-links a:visited {
  text-decoration: none;
}

.equation-builder { display:flex; flex-direction:column; gap:10px; }

.equation-input {
  width: 100%;
  min-height: 80px;
  padding: 15px;
  background: rgba(255,255,255,0.1);
  border: 2px solid #4fc3f7;
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  font-family: 'Courier New', monospace;
  resize: vertical;
}

.equation-display {
  background: #1e2a5a;
  color: #00d4ff;
  padding: 20px;
  border-radius: 8px;
  font-size: 24px;
  font-family: 'Times New Roman', serif;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #4fc3f7;
}

.control-buttons { display:flex; gap:10px; }

.btn-primary {
  background: linear-gradient(45deg, #00d4ff, #4fc3f7);
  color: #fff;
}

.btn-secondary { background:#6c757d; color:#fff; }

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
}

.result-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 15px;
}

.result-card h4 {
  margin: 0 0 10px;
  color: #00d4ff;
  font-size: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calc-output .main-result {
  font-size: 22px;
  text-align: center;
}

.dimensional-check {
  font-family: monospace;
  background: rgba(0, 212, 255, 0.1);
  padding: 10px;
  border-radius: 4px;
  border-left: 4px solid #00d4ff;
}

.dimensional-check.error {
  background: rgba(220,53,69,0.2);
  border-left-color: #dc3545;
}

.variable-list { list-style:none; padding:0; }

.variable-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 14px;
}

/* Style for computational roles section where role appears under variable */
.variable-list li.role-item {
  flex-direction: column;
  align-items: flex-start;
}

.variable-role {
  font-size: 12px;
  color: #b0b0b0;
  font-style: italic;
  margin-top: 3px;
  padding-left: 0;
}

.variable-list li a {
    color: #e0e0e0;
    font-weight: 0;
    text-decoration: none;
}

.role-list { list-style:none; padding:0; }

.role-list li {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 14px;
}

.role-list li a {
  color: #e0e0e0;
  font-weight: 0;
  text-decoration: none;
}

.variable-symbol { font-size:18px; font-weight:bold; }
.variable-unit {
  font-size: 11px;
  background: rgba(255,255,255,0.1);
  padding: 2px 5px;
  border-radius: 3px;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.symbol-btn {
  padding: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
}

.symbol-btn:hover {
  background: rgba(0,212,255,0.2);
  border-color: #00d4ff;
}

.sidebar h3 {
  margin: 0 0 10px;
  color: #00d4ff;
  font-size: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 5px;
}

.operator-section-header {
  margin: 10px 0 5px;
  color: #ccc;
  font-size: 14px;
}

.nothing-output {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 20px;
}

.interpretation {
  background: rgba(255,193,7,0.15);
  border: 1px solid rgba(255,193,7,0.3);
  border-radius: 6px;
  padding: 12px;
  color: #ffc107;
  font-size: 14px;
  line-height: 1.4;
}

/* Variables Used section headers */
.variables-section {
  margin-bottom: 15px;
}

.section-header {
  color: var(--accent-blue);
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px 0;
  padding: 4px 8px;
  background: rgba(0, 212, 255, 0.1);
  border-left: 3px solid var(--accent-blue);
  border-radius: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copy-section-btn {
  font-size: 11px;
  padding: 2px 6px;
  margin-left: 8px;
}

.variables-section .variable-list {
  margin: 0;
  padding-left: 0;
}

