/* ================================================================
   EU AI Act Explorer - Two-Panel Layout
   ================================================================ */

/* ========== Layout ========== */
.explorer-container {
  display: flex;
  min-height: calc(100vh - 60px);
  max-width: 100%;
  margin: 0 auto;
}

/* ========== Left Sidebar ========== */
.explorer-sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--surface-bg, #093639);
  border-right: 1px solid var(--border-color, #104f52);
  overflow-y: auto;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border-color, #104f52);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--primary-action, #F0850d);
}

/* Search bar */
.explorer-search {
  position: relative;
  margin-bottom: 0.75rem;
}

.explorer-search input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border-color, #104f52);
  border-radius: 6px;
  background: var(--primary-bg, #072020);
  color: var(--slate-300, #cbd5e1);
  outline: none;
  transition: border-color 0.2s;
}

.explorer-search input::placeholder {
  color: var(--slate-400, #aaabab);
}

.explorer-search input:focus {
  border-color: var(--secondary-accent, #00FFFF);
}

.search-shortcut {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: var(--slate-400, #aaabab);
  background: var(--primary-bg, #072020);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  border: 1px solid var(--border-color, #104f52);
  pointer-events: none;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color, #104f52);
  border-radius: 16px;
  background: transparent;
  color: var(--slate-400, #aaabab);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  border-color: var(--secondary-accent, #00FFFF);
  color: var(--slate-300, #cbd5e1);
}

.filter-tab.active {
  background: var(--secondary-accent, #00FFFF);
  color: var(--primary-bg, #072020);
  border-color: var(--secondary-accent, #00FFFF);
}

/* Assessment CTA in Sidebar */
.sidebar-cta {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color, #104f52);
}

.sidebar-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--primary-action, #F0850d), var(--orange-600, #d67409));
  color: var(--white, #ffffff);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(240, 133, 13, 0.2);
}

.sidebar-cta-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 133, 13, 0.3);
}

.sidebar-cta-button svg {
  flex-shrink: 0;
}

/* Navigation tree */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.nav-group {
  margin-bottom: 0.25rem;
}

.nav-group-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-action, #F0850d);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.nav-group-header:hover {
  background: rgba(240, 133, 13, 0.1);
}

.nav-group-header .icon {
  margin-right: 0.5rem;
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.nav-group.collapsed .nav-group-header .icon {
  transform: rotate(-90deg);
}

.nav-group-content {
  max-height: 10000px;  /* Increased to accommodate all 113 articles */
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s;
}

.nav-group.collapsed .nav-group-content {
  max-height: 0;
  opacity: 0;
}

.nav-item {
  display: block;
  padding: 0.45rem 1.25rem 0.45rem 2.5rem;
  font-size: 0.85rem;
  color: var(--slate-300, #cbd5e1);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(0, 255, 255, 0.05);
  color: var(--secondary-accent, #00FFFF);
}

.nav-item.active {
  background: rgba(0, 255, 255, 0.1);
  color: var(--secondary-accent, #00FFFF);
  border-left-color: var(--secondary-accent, #00FFFF);
}

.nav-subitem {
  padding-left: 3.25rem;
  font-size: 0.8rem;
}

/* Search results overlay */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 400px;
  overflow-y: auto;
  background: var(--primary-bg, #072020);
  border: 1px solid var(--border-color, #104f52);
  border-radius: 6px;
  margin-top: 0.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10;
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #104f52);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(0, 255, 255, 0.05);
}

.search-result-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 3px;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-result-badge.article {
  background: var(--secondary-accent, #00FFFF);
  color: var(--primary-bg, #072020);
}

.search-result-badge.recital {
  background: var(--orange-500, #F0850d);
  color: var(--primary-bg, #072020);
}

.search-result-badge.annex {
  background: var(--slate-600, #1a6266);
  color: var(--slate-100, #f1f5f9);
}

.search-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--slate-100, #f1f5f9);
  margin-bottom: 0.25rem;
}

.search-result-snippet {
  font-size: 0.8rem;
  color: var(--slate-400, #aaabab);
  line-height: 1.4;
}

.search-result-snippet mark {
  background: rgba(0, 255, 255, 0.25);
  color: var(--secondary-accent, #00FFFF);
  font-weight: 600;
  padding: 0 0.15rem;
}

.search-no-results {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--slate-400, #aaabab);
  font-size: 0.9rem;
}

/* ========== Main Content Panel ========== */
.explorer-content {
  flex: 1;
  background: var(--primary-bg, #072020);
  overflow-y: auto;
  padding: 2rem;
}

/* Welcome screen */
.welcome-screen {
  max-width: 800px;
  margin: 0 auto;
}

.welcome-screen h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--slate-100, #f1f5f9);
}

.welcome-screen .subtitle {
  font-size: 1.1rem;
  color: var(--slate-400, #aaabab);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.welcome-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.welcome-stat {
  background: var(--surface-bg, #093639);
  border: 1px solid var(--border-color, #104f52);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.welcome-stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary-accent, #00FFFF);
  display: block;
  margin-bottom: 0.25rem;
}

.welcome-stat-label {
  font-size: 0.85rem;
  color: var(--slate-400, #aaabab);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.quick-access {
  margin-top: 2.5rem;
}

.quick-access h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--slate-100, #f1f5f9);
}

.quick-access-grid {
  display: grid;
  gap: 1rem;
}

.quick-access-card {
  background: var(--surface-bg, #093639);
  border: 1px solid var(--border-color, #104f52);
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.quick-access-card:hover {
  border-color: var(--secondary-accent, #00FFFF);
  box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.1);
  transform: translateY(-2px);
}

.quick-access-card h3 {
  font-size: 1.05rem;
  color: var(--secondary-accent, #00FFFF);
  margin-bottom: 0.5rem;
}

.quick-access-card p {
  font-size: 0.9rem;
  color: var(--slate-400, #aaabab);
  line-height: 1.5;
  margin: 0;
}

/* Content view */
.content-view {
  max-width: 900px;
  margin: 0 auto;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.content-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--slate-400, #aaabab);
}

.content-breadcrumb a {
  color: var(--slate-400, #aaabab);
  text-decoration: none;
  transition: color 0.2s;
}

.content-breadcrumb a:hover {
  color: var(--secondary-accent, #00FFFF);
}

.content-breadcrumb .separator {
  color: var(--border-color, #104f52);
}

.content-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color, #104f52);
}

.content-number {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: var(--secondary-accent, #00FFFF);
  color: var(--primary-bg, #072020);
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.content-title {
  font-size: 2rem;
  margin: 0;
  color: var(--slate-100, #f1f5f9);
  line-height: 1.3;
}

.content-body {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--slate-300, #cbd5e1);
}

.content-body p {
  margin-bottom: 1.25rem;
}

.content-body ol, .content-body ul {
  margin: 1rem 0 1.25rem 1.5rem;
}

.content-body li {
  margin-bottom: 0.5rem;
}

/* Legal-style lists with (a), (b), (c) formatting */
.content-body ul.legal-list {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.content-body ul.legal-list li {
  margin-bottom: 1rem;
  padding-left: 0;
  line-height: 1.6;
}

.content-body a {
  color: var(--secondary-accent, #00FFFF);
  text-decoration: underline;
  text-decoration-color: rgba(0, 255, 255, 0.3);
  transition: text-decoration-color 0.2s;
}

.content-body a:hover {
  text-decoration-color: var(--secondary-accent, #00FFFF);
}

/* Related recitals */
.related-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color, #104f52);
}

.related-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--slate-100, #f1f5f9);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.related-section h3 .icon {
  width: 20px;
  height: 20px;
  transition: transform 0.2s;
}

.related-section.collapsed h3 .icon {
  transform: rotate(-90deg);
}

.related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.recital-chip {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-bg, #093639);
  border: 1px solid var(--border-color, #104f52);
  border-radius: 20px;
  color: var(--slate-300, #cbd5e1);
  cursor: pointer;
  transition: all 0.2s;
}

.recital-chip:hover {
  border-color: var(--orange-500, #F0850d);
  background: rgba(240, 133, 13, 0.1);
  color: var(--orange-500, #F0850d);
}

.recital-content {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--surface-bg, #093639);
  border-left: 3px solid var(--orange-500, #F0850d);
  border-radius: 6px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--slate-300, #cbd5e1);
  display: none;
}

.recital-content.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

/* Navigation arrows */
.content-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color, #104f52);
}

.nav-arrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface-bg, #093639);
  border: 1px solid var(--border-color, #104f52);
  border-radius: 6px;
  color: var(--slate-300, #cbd5e1);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-arrow:hover {
  border-color: var(--secondary-accent, #00FFFF);
  background: rgba(0, 255, 255, 0.05);
  color: var(--secondary-accent, #00FFFF);
}

.nav-arrow .icon {
  width: 18px;
  height: 18px;
}

.nav-arrow.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Copy link button */
.copy-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  margin-top: 1rem;
  background: transparent;
  border: 1px solid var(--border-color, #104f52);
  border-radius: 6px;
  color: var(--slate-400, #aaabab);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-link-btn:hover {
  border-color: var(--secondary-accent, #00FFFF);
  color: var(--secondary-accent, #00FFFF);
}

.copy-link-btn .icon {
  width: 16px;
  height: 16px;
}

.copy-link-btn.copied {
  border-color: var(--green-500, #22c55e);
  color: var(--green-500, #22c55e);
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--slate-400, #aaabab);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color, #104f52);
  border-top-color: var(--secondary-accent, #00FFFF);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.error-state {
  text-align: center;
  padding: 3rem 2rem;
  max-width: 500px;
  margin: 0 auto;
}

.error-state .icon {
  width: 48px;
  height: 48px;
  color: var(--red-500, #ef4444);
  margin-bottom: 1rem;
}

.error-state h2 {
  font-size: 1.5rem;
  color: var(--slate-100, #f1f5f9);
  margin-bottom: 1rem;
}

.error-state p {
  color: var(--slate-400, #aaabab);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.error-state a {
  color: var(--secondary-accent, #00FFFF);
  text-decoration: underline;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
  .explorer-container {
    flex-direction: column;
  }

  .explorer-sidebar {
    width: 100%;
    min-width: 0;
    height: auto;
    max-height: 60vh;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color, #104f52);
  }

  .sidebar-header {
    padding: 1rem;
  }

  .sidebar-header h2 {
    font-size: 1rem;
  }

  .explorer-search input {
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
  }

  .filter-tabs {
    gap: 0.25rem;
  }

  .filter-tab {
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
  }

  .nav-item {
    padding: 0.4rem 1rem 0.4rem 2rem;
    font-size: 0.8rem;
  }

  .nav-subitem {
    padding-left: 2.5rem;
    font-size: 0.75rem;
  }

  .explorer-content {
    padding: 1.5rem 1rem;
  }

  .welcome-screen h1 {
    font-size: 1.75rem;
  }

  .welcome-screen .subtitle {
    font-size: 1rem;
  }

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

  .content-breadcrumb {
    font-size: 0.75rem;
    flex-wrap: wrap;
  }

  .content-title {
    font-size: 1.5rem;
  }

  .content-body {
    font-size: 0.95rem;
  }

  .content-nav {
    flex-direction: column;
    gap: 0.75rem;
  }

  .nav-arrow {
    width: 100%;
    justify-content: center;
  }

  .search-results {
    max-height: 300px;
  }
}

@media (max-width: 480px) {
  .welcome-screen h1 {
    font-size: 1.5rem;
  }

  .welcome-stats {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .content-number {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
  }

  .content-title {
    font-size: 1.25rem;
  }

  .related-chips {
    flex-direction: column;
    align-items: stretch;
  }

  .recital-chip {
    width: 100%;
    text-align: center;
  }
}

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

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--secondary-accent, #00FFFF);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--secondary-accent, #00FFFF);
  outline-offset: 2px;
}
