/* ===================================================================
   EU AI Act Annotated - Custom Styles
   =================================================================== */

/* Root variables for consistent theming */
:root {
  --cross-ref-bg: #e8f4f8;
  --cross-ref-border: #0066cc;
  --commentary-bg: #fff4e6;
  --commentary-border: #cc6600;
  --recital-color: #70ad47;
  --article-color: #2e75b5;
  --highlight-color: #ffeb3b;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] {
  --cross-ref-bg: #1a2332;
  --cross-ref-border: #4a9eff;
  --commentary-bg: #2d2416;
  --commentary-border: #ff9933;
}

/* ===================================================================
   Cross-Reference Boxes
   =================================================================== */

.admonition.info {
  border-left-color: var(--cross-ref-border);
  background-color: var(--cross-ref-bg);
}

.admonition.info > .admonition-title {
  background-color: var(--cross-ref-border);
  color: white;
}

.admonition.info > .admonition-title::before {
  background-color: white;
}

/* ===================================================================
   Commentary Boxes
   =================================================================== */

.admonition.note {
  border-left-color: var(--commentary-border);
  background-color: var(--commentary-bg);
}

.admonition.note > .admonition-title {
  background-color: var(--commentary-border);
  color: white;
}

/* ===================================================================
   Implementation/Practical Guidance Boxes
   =================================================================== */

.admonition.tip {
  border-left-color: #4caf50;
}

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

/* ===================================================================
   Article and Recital Styling
   =================================================================== */

.article-number {
  color: var(--article-color);
  font-weight: 600;
  font-size: 1.1em;
}

.recital-number {
  color: var(--recital-color);
  font-weight: 600;
  font-size: 1.1em;
}

/* Official text styling */
.official-text {
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.8;
  text-align: justify;
  margin: 1.5em 0;
  padding: 1em;
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
}

[data-md-color-scheme="slate"] .official-text {
  background-color: rgba(255, 255, 255, 0.03);
}

/* ===================================================================
   Tags and Badges
   =================================================================== */

.article-tags {
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-tag {
  display: inline-block;
  background: #f0f0f0;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
  color: #666;
}

[data-md-color-scheme="slate"] .article-tag {
  background: #2d3748;
  color: #a0aec0;
}

/* Tag colors by category */
.tag-high-risk { background-color: #ffebee; color: #c62828; }
.tag-prohibited { background-color: #fce4ec; color: #880e4f; }
.tag-transparency { background-color: #e3f2fd; color: #1565c0; }
.tag-governance { background-color: #f3e5f5; color: #6a1b9a; }
.tag-penalties { background-color: #fff3e0; color: #e65100; }

/* ===================================================================
   Navigation Enhancements
   =================================================================== */

/* Breadcrumbs styling */
.md-path {
  color: var(--md-default-fg-color--light);
}

/* Table of contents highlighting */
.md-nav__link--active {
  font-weight: 600;
}

/* ===================================================================
   Search Enhancement
   =================================================================== */

.md-search-result__article {
  padding: 1rem;
}

.md-search-result mark {
  background-color: var(--highlight-color);
  color: #000;
  font-weight: 600;
}

/* ===================================================================
   Tables
   =================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.9em;
}

table thead th {
  background-color: var(--article-color);
  color: white;
  font-weight: 600;
  padding: 0.75rem;
  text-align: left;
}

table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

[data-md-color-scheme="slate"] table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
}

[data-md-color-scheme="slate"] table td {
  border-bottom-color: #404040;
}

/* ===================================================================
   Links and Cross-References
   =================================================================== */

a.cross-ref {
  color: var(--cross-ref-border);
  text-decoration: none;
  border-bottom: 1px dotted var(--cross-ref-border);
  transition: all 0.2s;
}

a.cross-ref:hover {
  border-bottom-style: solid;
  background-color: var(--cross-ref-bg);
  padding: 0 2px;
}

/* Internal article links */
a[href*="/article-"],
a[href*="/recital-"] {
  font-weight: 500;
}

/* ===================================================================
   Highlight on Target (when jumping to section)
   =================================================================== */

:target {
  animation: highlight 2s ease;
  scroll-margin-top: 3.5rem;
}

@keyframes highlight {
  0% { background-color: var(--highlight-color); }
  100% { background-color: transparent; }
}

/* ===================================================================
   Collapsible Sections
   =================================================================== */

details {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 0.5rem;
  margin: 1rem 0;
  background-color: rgba(0, 0, 0, 0.01);
}

[data-md-color-scheme="slate"] details {
  border-color: #404040;
  background-color: rgba(255, 255, 255, 0.02);
}

summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem;
  user-select: none;
}

summary:hover {
  background: rgba(0, 0, 0, 0.03);
}

[data-md-color-scheme="slate"] summary:hover {
  background: rgba(255, 255, 255, 0.05);
}

details[open] summary {
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 0.5rem;
}

/* ===================================================================
   Print Styles
   =================================================================== */

@media print {
  .md-header,
  .md-sidebar,
  .md-footer,
  .md-dialog,
  .md-typeset .admonition-title::before {
    display: none !important;
  }
  
  .md-content {
    max-width: 100%;
  }
  
  .official-text {
    font-size: 11pt;
    line-height: 1.6;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  /* Don't print URLs for internal links */
  a[href^="#"]:after,
  a[href^="/"]:after {
    content: "";
  }
}

/* ===================================================================
   Responsive Adjustments
   =================================================================== */

@media screen and (max-width: 76.1875em) {
  .md-typeset {
    font-size: 0.9em;
  }
}

@media screen and (max-width: 44.9375em) {
  .official-text {
    text-align: left;
    font-size: 0.95em;
  }
  
  table {
    font-size: 0.8em;
  }
}

/* ===================================================================
   Homepage Specific Styles
   =================================================================== */

.hero-section {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 8px;
  margin: 2rem 0;
}

.hero-section h1 {
  font-size: 2.5em;
  margin-bottom: 1rem;
}

.hero-section p {
  font-size: 1.2em;
  opacity: 0.9;
}

/* Feature cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.feature-card {
  padding: 1.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
  transition: transform 0.2s, box-shadow 0.2s;
}

[data-md-color-scheme="slate"] .feature-card {
  background-color: #1e293b;
  border-color: #334155;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-card h3 {
  color: var(--article-color);
  margin-top: 0;
}

/* ===================================================================
   Accessibility Enhancements
   =================================================================== */

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
summary:focus {
  outline: 2px solid var(--article-color);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--article-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* ===================================================================
   Custom Scrollbar (webkit browsers)
   =================================================================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

[data-md-color-scheme="slate"] ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ===================================================================
   Loading States
   =================================================================== */

.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ===================================================================
   Utility Classes
   =================================================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.font-bold { font-weight: 600; }
.font-mono { font-family: 'Roboto Mono', monospace; }
