/* ============================================================================
   BioForge v2 — Base Styles & Reset
   Modern reset, global typography, scrollbars, focus, and utility classes
   ============================================================================ */

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Remove default list styles */
ul,
ol {
  list-style: none;
}

/* Reset form elements to inherit font */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

/* Default styling for bare form elements (not using .form-input etc) */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="tel"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: var(--spacing-2, 8px) var(--spacing-3, 12px);
  background: var(--bg-input, #fff);
  border: 1px solid var(--border-input, #d1d5db);
  border-radius: var(--radius-md, 6px);
  font-size: var(--text-sm, 14px);
  color: var(--text-primary, #1a202c);
  transition: border-color 0.15s;
  box-sizing: border-box;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input:not([type]):focus,
select:focus,
textarea:focus {
  border-color: var(--accent, #ff9900);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.12);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary, #a0aec0);
}
select {
  appearance: auto;
  cursor: pointer;
}
textarea {
  resize: vertical;
  min-height: 80px;
}
label {
  display: block;
  font-size: var(--text-sm, 14px);
  font-weight: var(--font-medium, 500);
  color: var(--text-primary, #1a202c);
  margin-bottom: var(--spacing-1, 4px);
}
/* Exclude radio/checkbox from block styling */
input[type="radio"],
input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: revert;
  background: revert;
  appearance: auto;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* --------------------------------------------------------------------------
   Selection
   -------------------------------------------------------------------------- */

::selection {
  background-color: var(--accent-light);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: var(--accent-light);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Scrollbar Styling
   -------------------------------------------------------------------------- */

/* Webkit / Blink */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--gray-400);
}

/* Dark theme scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background-color: var(--gray-300);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background-color: var(--gray-400);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

[data-theme="dark"] * {
  scrollbar-color: var(--gray-300) transparent;
}

/* --------------------------------------------------------------------------
   Focus
   -------------------------------------------------------------------------- */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* --------------------------------------------------------------------------
   Headings
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h1 {
  font-size: var(--text-4xl);
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-2xl);
  letter-spacing: -0.015em;
}
/* Form section headers — scoped to avoid affecting sidebar/card h3 elements */
form h3 {
  font-size: var(--text-lg, 18px);
  margin-bottom: var(--spacing-3, 12px);
  padding-bottom: var(--spacing-2, 8px);
  border-bottom: 1px solid var(--border-primary, #e2e8f0);
  color: var(--text-primary, #1a202c);
  font-weight: var(--font-semibold, 600);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-md);
}

/* --------------------------------------------------------------------------
   Inline Text Elements
   -------------------------------------------------------------------------- */

strong, b {
  font-weight: var(--font-semibold);
}

small {
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   Code & Preformatted
   -------------------------------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--bg-surface-raised);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background-color: var(--bg-surface-raised);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--leading-relaxed);
  border: 1px solid var(--border-secondary);
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* --------------------------------------------------------------------------
   Horizontal Rule
   -------------------------------------------------------------------------- */

hr {
  border: none;
  border-top: 1px solid var(--border-secondary);
  margin: var(--space-7) 0;
}

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */

img {
  max-width: 100%;
  display: block;
}

svg {
  display: inline-block;
  vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Paragraph Spacing
   -------------------------------------------------------------------------- */

p {
  line-height: var(--leading-relaxed);
}

p + p {
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Text overflow */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Flexbox */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-row {
  display: flex;
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.items-stretch {
  align-items: stretch;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-end {
  justify-content: flex-end;
}

/* Grid */
.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Gap */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-7 { gap: var(--space-7); }
.gap-8 { gap: var(--space-8); }

/* Text alignment */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

/* Display */
.hidden {
  display: none;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.inline-flex {
  display: inline-flex;
}

/* Positioning */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.sticky {
  position: sticky;
}

/* Overflow */
.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

/* Width */
.w-full {
  width: 100%;
}

/* Cursor */
.pointer {
  cursor: pointer;
}

/* Opacity */
.opacity-50 {
  opacity: 0.5;
}

.opacity-70 {
  opacity: 0.7;
}
