/* Custom CSS for PyAutoDoc Documentation */

/* ============================= */
/* Color Variables               */
/* ============================= */
:root {
  --pydantic-field-color: #0066cc;
  --pydantic-validator-color: #009900;
  --enum-member-color: #cc6600;
  --dataclass-color: #9900cc;
  --custom-border-radius: 8px;
}

/* ============================= */
/* Pydantic Model Styling        */
/* ============================= */
.pydantic.model {
  border-left: 4px solid var(--pydantic-field-color);
  padding-left: 1rem;
  margin: 1rem 0;
}

.pydantic.field {
  background-color: rgba(0, 102, 204, 0.05);
  padding: 0.5rem;
  margin: 0.5rem 0;
  border-radius: var(--custom-border-radius);
}

.pydantic.validator {
  background-color: rgba(0, 153, 0, 0.05);
  border-left: 3px solid var(--pydantic-validator-color);
  padding: 0.5rem;
  margin: 0.5rem 0;
}

/* ============================= */
/* Enum Styling                  */
/* ============================= */
.enum-class {
  border-left: 4px solid var(--enum-member-color);
  padding-left: 1rem;
}

.enum-member {
  background-color: rgba(204, 102, 0, 0.05);
  padding: 0.3rem 0.6rem;
  margin: 0.2rem 0;
  display: inline-block;
  border-radius: var(--custom-border-radius);
}

/* ============================= */
/* Dataclass Styling             */
/* ============================= */
.dataclass {
  border-left: 4px solid var(--dataclass-color);
  padding-left: 1rem;
  margin: 1rem 0;
}

/* ============================= */
/* Toggle Button Enhancements    */
/* ============================= */
.toggle-button {
  background-color: var(--color-brand-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--custom-border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ============================= */
/* Code Block Enhancements       */
/* ============================= */
div.highlight {
  border-radius: var(--custom-border-radius);
  overflow: hidden;
}

/* JSON Schema display */
.autodoc_pydantic_collapsable_json {
  margin: 1rem 0;
}

.autodoc_pydantic_collapsable_json summary {
  cursor: pointer;
  padding: 0.5rem;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--custom-border-radius);
  user-select: none;
}

.autodoc_pydantic_collapsable_json summary:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* ============================= */
/* Inheritance Diagrams          */
/* ============================= */
.graphviz {
  text-align: center;
  margin: 1rem 0;
}

.inheritance-diagram {
  max-width: 100%;
  height: auto;
}

/* ============================= */
/* API Summary Tables            */
/* ============================= */
.autosummary table {
  width: 100%;
  border-collapse: collapse;
}

.autosummary table td {
  padding: 0.5rem;
  vertical-align: top;
}

.autosummary table td:first-child {
  font-family: var(--font-stack--monospace);
  font-weight: 600;
}

/* ============================= */
/* Field Constraints             */
/* ============================= */
.field-constraints {
  font-size: 0.9em;
  color: #666;
  margin-left: 1rem;
}

.field-constraints strong {
  color: #333;
}

/* ============================= */
/* Notes and Warnings            */
/* ============================= */
.admonition.note {
  border-left-color: #0066cc;
}

.admonition.warning {
  border-left-color: #ff9900;
}

.admonition.error {
  border-left-color: #cc0000;
}

/* ============================= */
/* Module Headers                */
/* ============================= */
.module-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2rem;
  border-radius: var(--custom-border-radius);
  margin-bottom: 2rem;
}

.module-header h1 {
  margin: 0;
  color: white;
}

/* ============================= */
/* Responsive Design             */
/* ============================= */
@media (max-width: 768px) {
  .pydantic.model,
  .dataclass,
  .enum-class {
    padding-left: 0.5rem;
    border-left-width: 3px;
  }

  .module-header {
    padding: 1rem;
  }
}

/* ============================= */
/* Dark Mode Support & Fixes     */
/* ============================= */

/* CRITICAL FIXES: White-on-white text issue resolution */
[data-theme="dark"] {
  --pydantic-field-color: #4da6ff;
  --pydantic-validator-color: #66ff66;
  --enum-member-color: #ffaa66;
  --dataclass-color: #cc99ff;
}

/* Force proper text contrast in dark mode */
[data-theme="dark"] .pydantic.field,
[data-theme="dark"] .pydantic.validator,
[data-theme="dark"] .enum-member {
  color: #fff !important;
}

[data-theme="dark"] .pydantic.field {
  background-color: rgba(77, 166, 255, 0.15) !important;
  border: 1px solid rgba(77, 166, 255, 0.3);
}

[data-theme="dark"] .pydantic.validator {
  background-color: rgba(102, 255, 102, 0.15) !important;
  border: 1px solid rgba(102, 255, 102, 0.3);
}

[data-theme="dark"] .enum-member {
  background-color: rgba(255, 170, 102, 0.15) !important;
  border: 1px solid rgba(255, 170, 102, 0.3);
}

/* Fix field constraints visibility */
[data-theme="dark"] .field-constraints {
  color: #ccc !important;
}

[data-theme="dark"] .field-constraints strong {
  color: #fff !important;
}

/* Code block contrast fixes */
[data-theme="dark"] div.highlight {
  background-color: #1e1e1e !important;
  border: 1px solid #333;
}

[data-theme="dark"] div.highlight pre {
  color: #f8f8f2 !important;
  background-color: #1e1e1e !important;
}

/* Fix copy button visibility in dark mode */
[data-theme="dark"] button.copybtn {
  background-color: #333 !important;
  color: #fff !important;
  border: 1px solid #555 !important;
}

[data-theme="dark"] button.copybtn:hover {
  background-color: #444 !important;
}

/* Fix tab content visibility */
[data-theme="dark"] .sd-tab-content {
  background-color: var(--color-background-primary) !important;
  color: var(--color-foreground-primary) !important;
}

/* Fix table styling in dark mode */
[data-theme="dark"] table.docutils {
  border-color: #444 !important;
}

[data-theme="dark"] table.docutils th {
  background-color: #2d2d2d !important;
  color: #fff !important;
  border-color: #444 !important;
}

[data-theme="dark"] table.docutils td {
  border-color: #444 !important;
  color: #ddd !important;
}

/* AutoAPI signature fixes */
[data-theme="dark"] .sig-name {
  color: #79dafa !important;
}

[data-theme="dark"] .sig-paren {
  color: #fff !important;
}

[data-theme="dark"] .sig-param {
  color: #66d9ef !important;
}

/* Navigation fixes for better contrast */
[data-theme="dark"] .bd-sidebar {
  background-color: var(--color-background-secondary) !important;
}

[data-theme="dark"] .bd-sidebar a {
  color: var(--color-foreground-primary) !important;
}

/* Admonition fixes */
[data-theme="dark"] .admonition {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .admonition .admonition-title {
  color: #fff !important;
}

[data-theme="dark"] .admonition p {
  color: #ddd !important;
}

/* Legacy media query support */
@media (prefers-color-scheme: dark) {
  :root {
    --pydantic-field-color: #4da6ff;
    --pydantic-validator-color: #66ff66;
    --enum-member-color: #ffaa66;
    --dataclass-color: #cc99ff;
  }

  .pydantic.field {
    background-color: rgba(77, 166, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(77, 166, 255, 0.3);
  }

  .pydantic.validator {
    background-color: rgba(102, 255, 102, 0.15);
    color: #fff;
    border: 1px solid rgba(102, 255, 102, 0.3);
  }

  .enum-member {
    background-color: rgba(255, 170, 102, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 170, 102, 0.3);
  }

  .field-constraints {
    color: #ccc;
  }

  .field-constraints strong {
    color: #fff;
  }

  /* Code blocks */
  div.highlight {
    background-color: #1e1e1e;
    border: 1px solid #333;
  }

  div.highlight pre {
    color: #f8f8f2;
  }
}
