@import url("./tokens.css");
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---------- Base layout ---------- */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 400 var(--fs-2) / 1.5 var(--font-primary);
  background: var(--bg);
  color: var(--ink);
}

/* page-width wrapper you can reuse inside header/main/footer */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-4);
}

/* Make main fill remaining height so footer sits at bottom on short pages */
.site-main {
  flex: 1;
}

/* Skip link */
.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
}

/* ---------- Typography & links ---------- */
a {
  color: var(--brand);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
a:hover,
a:focus {
  text-decoration: underline;
}

/* Focus ring */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* Enhanced focus states for interactive elements */
.btn:focus-visible,
.nav-toggle:focus-visible,
.main-nav a:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Ensure sufficient color contrast for status indicators */
.status-completed,
.status-active,
.status-pending {
  font-weight: 600;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .timeline-marker {
    border-width: 3px;
  }
  
  .btn {
    border-width: 3px;
  }
}

/* ---------- Header ---------- */

.site-header {
  width: 100%;
  background: var(--bg);
  border-bottom: 1px solid #e9e9e9;
}

/* Top bar: language only */
.header-top {
  background: var(--bg);
  border-bottom: 1px solid #f1f1f1;
  font-size: 0.9rem;
}
.header-top .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.4rem var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-top .top-lang a {
  text-decoration: none;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.95;
}
.header-top .top-lang a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Main bar: brand + nav */
.header-main .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
}
.brand .logo {
  height: 100px;
  width: auto;
  display: block;
}
.brand-text {
  line-height: 1;
}

/* Make header sticky on mobile */
@media (max-width: 900px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
}

/* Primary nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.main-nav a {
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  border: 2px solid transparent; /* reserve space, no jump on hover */
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
.main-nav a:hover,
.main-nav a:focus {
  background: var(--brand);
  color: var(--bg);
  border-color: var(--brand);
  text-decoration: none;
}

.main-nav a.logout-btn {
  background: var(--brand);
  border: 2px solid var(--brand);
  color: var(--bg);
}

.main-nav a.logout-btn:hover {
  text-decoration: underline;
}

/* Mobile nav toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0;
  margin-left: auto;
  cursor: pointer;
  border-radius: var(--border-radius);
  transition: background-color 0.2s ease;
  position: relative;
  z-index: 1001;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}

.nav-toggle:hover {
  background: var(--surface);
}

.nav-toggle .nav-toggle-bar {
  position: absolute;
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform-origin: center;
}

/* Position bars for hamburger state - equal spacing */
.nav-toggle .nav-toggle-bar:nth-child(1) {
  top: calc(50% - 6px);
  left: 50%;
  transform: translate(-50%, -50%);
}

.nav-toggle .nav-toggle-bar:nth-child(2) {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.nav-toggle .nav-toggle-bar:nth-child(3) {
  top: calc(50% + 6px);
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Animated hamburger to X - improved centered animation */
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  top: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Responsive behavior */
@media (max-width: 900px) {
  .header-main .container {
    align-items: center;
  }
  .nav-toggle {
    display: flex;
  }
  .header-main {
    position: relative;
  }
  
  .main-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    gap: 0;
    padding: var(--space-2) 0;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
  }
  
  .main-nav.is-open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }
  
  .main-nav a {
    padding: 0.75rem var(--space-3);
    border: 0;
    margin: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.2s ease;
    border-radius: 0;
  }
  
  .main-nav a:hover,
  .main-nav a:focus {
    background: var(--surface);
    color: var(--brand);
  }
  
  .main-nav a.logout-btn {
    background: var(--brand);
    color: white;
    margin: var(--space-2) var(--space-3);
    border-radius: var(--border-radius);
    text-align: center;
  }
  
  .main-nav a.logout-btn:hover {
    background: var(--brand-hover);
    color: white;  /* Ensure text stays white on hover */
    transform: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--brand);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  filter: brightness(0.95);
}

.btn:active {
  filter: brightness(0.9);
}

/* ---------- Cards & misc ---------- */
.card {
  background: var(--surface, #f5f5f5);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid #e5e5e5;
}
.muted {
  color: #555;
}
.list {
  padding-left: 1.2rem;
}

/* ---------- Footer (full-bleed band) ---------- */
.site-footer {
  background: var(--muted);
  color: var(--bg);
  width: 100%;
  border-top: 1px solid #3a3a3a;
  font-size: 0.9rem;
}

.site-footer .container {
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
}

/* Top: navigation in 3 columns */
.footer-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  text-align: left;
}

.footer-col a {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--bg);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--brand-hover, #d1345b);
  text-decoration: underline;
}

/* Bottom area: legal + language toggle */
.footer-bottom {
  border-top: 1px solid #444;
  padding-top: var(--space-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.footer-bottom .legal {
  font-size: 0.8rem;
  opacity: 0.85;
  line-height: 1.4;
}

.footer-lang {
  font-size: 0.85rem;
  opacity: 0.85;
  text-align: right;
}

.footer-lang a {
  color: var(--bg);
  text-decoration: none;
  font-weight: 600;
}

.footer-lang a:hover {
  text-decoration: underline;
}

/* Collapse layout on small screens */
@media (max-width: 640px) {
  .footer-nav {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

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

/* ---------- Dashboard Styles ---------- */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.welcome-card {
  background: linear-gradient(135deg, var(--brand) 0%, #d1345b 100%);
  color: white;
  border: none;
}

.welcome-card h1 {
  color: white;
  margin-bottom: var(--space-2);
}

.welcome-card .muted {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
}

/* Timeline Styles */
.timeline {
  position: relative;
  padding-left: var(--space-4);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 1.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--muted);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
}

.timeline-marker {
  position: absolute;
  left: -2.5rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--muted);
  border: 3px solid var(--bg);
  z-index: 1;
}

.timeline-item.completed .timeline-marker {
  background: var(--success, #28a745);
}

.timeline-item.active .timeline-marker {
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
}

.timeline-content {
  flex: 1;
  padding-left: var(--space-3);
}

.timeline-content h3 {
  margin: 0 0 var(--space-1) 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.timeline-date {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 var(--space-1) 0;
}

.timeline-description {
  margin: 0;
  color: var(--ink);
}

/* Report Cards */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.report-card {
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  transition: all 0.2s ease;
}

.report-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-3);
}

.report-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.report-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-draft {
  background: var(--warning-bg, #fff3cd);
  color: var(--warning, #856404);
}

.status-final {
  background: var(--success-bg, #d4edda);
  color: var(--success, #155724);
}

.status-amended {
  background: var(--info-bg, #d1ecf1);
  color: var(--info, #0c5460);
}

.report-meta {
  margin-bottom: var(--space-3);
}

.report-meta p {
  margin: 0 0 var(--space-1) 0;
  font-size: 0.9rem;
  color: var(--ink);
}

.report-meta strong {
  color: var(--ink);
  font-weight: 600;
}

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

.btn-primary {
  background: var(--brand);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-hover, #d1345b);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-secondary {
  background: var(--brand);
  color: var(--usw-white);
  border-color: var(--border);
}

/* .btn-secondary:hover {
  background: var(--brand-hover);
  border-color: var(--ink);
} */

.reports-summary {
  text-align: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--muted);
}

.reports-summary .muted {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .timeline {
    padding-left: var(--space-3);
  }
  
  .timeline-marker {
    left: -2rem;
  }
  
  .reports-grid {
    grid-template-columns: 1fr;
  }
  
  .report-header {
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
  }
  
  .report-actions {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .timeline::before {
    left: 1rem;
  }
  
  .timeline-marker {
    left: -1.5rem;
  }
  
  .timeline {
    padding-left: var(--space-2);
  }
}

/* ---------- Page-specific styles ---------- */

/* Admin Dashboard Styles */
.admin-dashboard {
  margin-top: 2rem;
}

.metrics-section {
  margin-bottom: 2rem;
}

.metrics-section h3 {
  color: var(--brand);
  border-bottom: 2px solid var(--brand-light);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-item {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.metric-item h4 {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
  margin: 0 0 0.25rem 0;
  line-height: 1;
}

.metric-target {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

/* Responsive adjustments for metrics */
@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .metric-item {
    padding: 0.75rem;
  }
  
  .metric-value {
    font-size: 1.5rem;
  }
}

/* Login page */
.login-page {
  max-width: 500px;
  margin: 4rem auto;
  padding: 0 1rem;
}

.login-card {
  text-align: center;
  padding: 3rem 2rem;
}

.login-card h1 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.login-card p {
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.login-actions {
  margin-top: 2rem;
}

/* Report Viewer */
.report-viewer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.report-title h1 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.report-iframe-container {
  position: relative;
  width: 100%;
  min-height: 800px;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.report-iframe-container iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 800px;
}

.report-watermark {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--muted);
  border-radius: var(--border-radius);
  text-align: center;
}

.report-watermark p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--usw-white);
}

/* Simple mobile menu animations */
@media (max-width: 900px) {
  .main-nav a {
    transition: all 0.2s ease;
  }
}

/* System Status Styles */
.system-status {
  max-width: 800px;
  margin: 0 auto;
}

.status-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

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

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.5rem;
}

.status-indicator.status-healthy {
  background-color: var(--success);
}

.status-indicator.status-unhealthy {
  background-color: var(--warning);
}

.status-indicator.status-error {
  background-color: var(--danger);
}

.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
}

.status-badge.status-healthy {
  background-color: var(--success-bg);
  color: var(--success);
}

.status-badge.status-unhealthy {
  background-color: var(--warning-bg);
  color: var(--warning);
}

.status-badge.status-error {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.status-details h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text-primary);
}

.status-details p {
  margin: 0.25rem 0;
}

.error-message {
  color: var(--danger);
  font-weight: 500;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.info-item h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item p {
  margin: 0;
  font-weight: 500;
  color: var(--text-primary);
}

.contact-details {
  margin-top: 1rem;
}

.contact-details p {
  margin: 0.5rem 0;
}

.contact-details a {
  color: var(--brand);
  text-decoration: none;
}

.contact-details a:hover {
  text-decoration: underline;
}

.actions {
  text-align: center;
  padding: 1rem 0;
}

/* Error Page Styles */
.error-page {
  max-width: 600px;
  margin: 0 auto;
}

.error-message {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--border-radius);
  padding: 1rem;
  margin: 1rem 0;
}

.error-message p {
  margin: 0;
  color: var(--danger);
  font-weight: 500;
}

.actions .btn {
  margin: 0 0.5rem;
}

/* Enhanced 404 Page Styles */
.error-content {
  text-align: center;
  padding: 3rem 0;
}

.error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--brand);
  margin: 0;
  line-height: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.error-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1rem 0 0.5rem 0;
}

.error-description {
  font-size: 1.125rem;
  color: var(--muted);
  margin: 0 0 2rem 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.error-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  transition: all 0.2s ease;
}

.error-actions .btn svg {
  flex-shrink: 0;
}

.error-help {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.error-help p {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .error-code {
    font-size: 4rem;
  }
  
  .error-title {
    font-size: 1.5rem;
  }
  
  .error-description {
    font-size: 1rem;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .error-actions .btn {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }
}

/* ---------- Skeleton Loading Styles ---------- */
.cache-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.cache-toolbar--footer {
  margin-top: var(--space-3);
  margin-bottom: 0;
  border-top: 1px solid var(--border, #e5e5e5);
  padding-top: var(--space-2);
}

.cache-toolbar .cache-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.cache-toolbar .cache-status.cache-status-error {
  color: var(--danger, #b10e1e);
}

.cache-toolbar .cache-refresh {
  white-space: nowrap;
}

.cache-toolbar .cache-refresh.btn {
  padding: 0.4rem 0.75rem;
}

.cache-toolbar .cache-refresh[hidden] {
  display: none;
}

.cache-placeholder {
  color: var(--muted);
}

.cache-placeholder.error-message {
  color: var(--danger, #b10e1e);
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  margin-bottom: 0;
}

.skeleton-title {
  height: 1.5em;
  width: 60%;
  margin-bottom: 0.75rem;
}

.skeleton-subtitle {
  height: 1.2em;
  width: 40%;
  margin-bottom: 0.5rem;
}

.skeleton-card {
  min-height: 150px;
  padding: var(--space-3);
  border-radius: var(--border-radius);
  border: 1px solid var(--muted);
}

.skeleton-button {
  height: 2.5rem;
  width: 120px;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Skeleton variants for dashboard */
.skeleton-timeline-item {
  position: relative;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: flex-start;
  padding-left: var(--space-4);
}

.skeleton-timeline-marker {
  position: absolute;
  left: -2.5rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--muted);
  border: 3px solid var(--bg);
  z-index: 1;
}

.skeleton-timeline-content {
  flex: 1;
  padding-left: var(--space-3);
}

.report-viewer {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.report-iframe-container {
  position: relative;
  min-height: 320px;
  background: #f7f7f7;
  border-radius: var(--radius);
  overflow: hidden;
  transition: background 0.2s ease;
}

.report-iframe-container.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-frame-slot iframe {
  width: 100%;
  height: 800px;
  border: 0;
}

.report-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-3);
  color: #444;
  font-weight: 600;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--brand, #c2185b);
  animation: report-spin 1s linear infinite;
}

@keyframes report-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.report-error {
  margin-top: var(--space-4);
  padding: var(--space-4) var(--space-3);
  background: #fff4f4;
  border: 1px solid #f5c2c7;
  border-radius: var(--radius);
  text-align: center;
  color: #842029;
}

.report-error[hidden] {
  display: none !important;
}

.report-error-actions {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.report-watermark {
  margin-top: var(--space-3);
}

.report-watermark[hidden] {
  display: none !important;
}
.skeleton-report-card {
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: var(--border-radius);
  padding: var(--space-3);
  min-height: 200px;
}

.skeleton-container {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.skeleton-container.hidden {
  opacity: 0;
  pointer-events: none;
  display: none; /* collapse layout space when skeletons are hidden */
}

.content-loaded {
  animation: fade-in 0.4s ease-in;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: #f0f0f0;
  }
  
  .content-loaded {
    animation: none;
  }
}
