/**
 * Common CSS Styles
 * 
 * Shared styles used across all EDA reports.
 * Provides base typography, layout, and reusable components.
 */

/* ====================================
   CSS VARIABLES (Color Palette)
   ==================================== */
:root {
  /* Primary colors */
  --color-primary: #3b82f6;
  --color-primary-dark: #2563eb;
  --color-primary-light: #60a5fa;
  
  /* Secondary colors */
  --color-secondary: #8b5cf6;
  --color-secondary-dark: #7c3aed;
  
  /* Neutral colors */
  --color-text: #1f2937;
  --color-text-light: #6b7280;
  --color-bg: #ffffff;
  --color-bg-light: #f9fafb;
  --color-bg-dark: #f3f4f6;
  --color-border: #e5e7eb;
  
  /* Status colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ====================================
   RESET & BASE STYLES
   ==================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 
               'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ====================================
   TYPOGRAPHY
   ==================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

h1 {
  font-size: 2.25rem;
  margin-bottom: var(--spacing-lg);
}

h2 {
  font-size: 1.875rem;
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--color-text-light);
}

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

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

code {
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 0.875rem;
  background-color: var(--color-bg-dark);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--color-bg-dark);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--spacing-md);
}

pre code {
  background: none;
  padding: 0;
}

/* ====================================
   LAYOUT
   ==================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.container-fluid {
  width: 100%;
  padding: 0 var(--spacing-lg);
}

.section {
  padding: var(--spacing-2xl) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.section-title {
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
}

.section-description {
  font-size: 1.125rem;
  color: var(--color-text-light);
  max-width: 700px;
  margin: 0 auto;
}

/* ====================================
   GRID SYSTEM
   ==================================== */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

/* Gallery specific grid - only for image galleries */
.interactive-gallery .image-grid.grid-2 {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 1rem !important;
}

/* Regular grid-2 for other sections - keep original behavior */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

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

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

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ====================================
   COMPONENTS - CARDS
   ==================================== */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-md);
}

.card-content {
  color: var(--color-text-light);
}

/* Stat cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-lg);
  margin: var(--spacing-xl) 0;
}

.stat-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
}

.stat-card h3 {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-sm);
  color: white;
  font-weight: 700;
}

.stat-card p {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ====================================
   COMPONENTS - BUTTONS
   ==================================== */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background-color: var(--color-secondary-dark);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

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

/* ====================================
   COMPONENTS - NAVIGATION
   ==================================== */
.navbar {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: var(--spacing-md) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.9);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar .brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.navbar .nav-links {
  display: flex;
  gap: var(--spacing-lg);
}

.navbar .nav-links a {
  color: var(--color-text-light);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.navbar .nav-links a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* ====================================
   COMPONENTS - CHARTS
   ==================================== */
.chart-container {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin: var(--spacing-xl) 0;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

.chart-wrapper {
  position: relative;
  height: 400px;
}

canvas {
  max-width: 100%;
  height: auto;
}

/* ====================================
   COMPONENTS - TABLES
   ==================================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-xl) 0;
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

thead {
  background-color: var(--color-bg-dark);
}

th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-light);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover {
  background-color: var(--color-bg-light);
}

/* ====================================
   COMPONENTS - ALERTS
   ==================================== */
.alert {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  margin: var(--spacing-md) 0;
  border-left: 4px solid;
}

.alert-info {
  background-color: #dbeafe;
  border-color: var(--color-info);
  color: #1e40af;
}

.alert-success {
  background-color: #d1fae5;
  border-color: var(--color-success);
  color: #065f46;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: var(--color-warning);
  color: #92400e;
}

.alert-error {
  background-color: #fee2e2;
  border-color: var(--color-error);
  color: #991b1b;
}

/* ====================================
   COMPONENTS - FOOTER
   ==================================== */
.footer {
  background-color: var(--color-bg-dark);
  border-top: 1px solid var(--color-border);
  padding: var(--spacing-2xl) 0;
  margin-top: var(--spacing-2xl);
  text-align: center;
}

.footer p {
  color: var(--color-text-light);
  margin: 0;
}

/* ====================================
   UTILITIES
   ==================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
.p-4 { padding: var(--spacing-xl); }

/* ====================================
   RESPONSIVE
   ==================================== */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .navbar .nav-links {
    gap: var(--spacing-md);
  }
  
  .stat-card h3 {
    font-size: 2rem;
  }
}

/* ====================================
   PRINT STYLES
   ==================================== */
@media print {
  .navbar,
  .footer {
    display: none;
  }
  
  .card,
  .chart-container {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ====================================
   COMPONENTS - IMAGE GALLERY
   ==================================== */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-lg) 0;
}

.image-item {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  background: white;
}

.image-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.image-item:hover img {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  color: white;
  padding: 12px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
}

.image-item:hover .image-overlay {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.image-caption {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.4;
}

.image-caption small {
  font-size: 0.75rem;
  opacity: 0.8;
  font-weight: 400;
}

.image-caption div {
  color: #1f2937;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
  font-weight: 600;
}

.image-caption strong {
  color: #fbbf24;
  font-weight: 600;
}

/* Gallery sections */
.gallery-section {
  margin-bottom: 3rem;
}

.gallery-section:last-child {
  margin-bottom: 0;
}

    /* Responsive image gallery */
    @media (max-width: 768px) {
      .image-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
      }
    }

    @media (max-width: 480px) {
      .image-gallery {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
      }
    }

    /* ====================================
       INTERACTIVE GALLERY STYLES
       ==================================== */
    .interactive-gallery {
      margin: 2rem 0;
    }

    .species-section {
      margin-bottom: 3rem;
      padding: 1.5rem;
      background: #f8f9fa;
      border-radius: 12px;
      border: 1px solid #e9ecef;
    }

    .species-header {
      text-align: center;
      margin-bottom: 1.5rem;
      color: #2c3e50;
      font-size: 1.5rem;
      font-weight: 600;
      padding-bottom: 0.5rem;
      border-bottom: 2px solid #3498db;
    }

    .breed-selector {
      background: white;
      border-radius: 8px;
      padding: 1.5rem;
      margin-bottom: 1.5rem;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .selector-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1rem;
      flex-wrap: wrap;
      gap: 1rem;
    }

    .selector-header span {
      font-weight: 600;
      color: #2c3e50;
      font-size: 1rem;
    }

    .select-all-btn, .select-none-btn {
      background: #3498db;
      color: white;
      border: none;
      padding: 0.5rem 1rem;
      border-radius: 6px;
      cursor: pointer;
      font-size: 0.875rem;
      font-weight: 500;
      transition: all 0.2s ease;
    }

    .select-all-btn:hover, .select-none-btn:hover {
      background: #2980b9;
      transform: translateY(-1px);
    }

    .select-none-btn {
      background: #e74c3c;
    }

    .select-none-btn:hover {
      background: #c0392b;
    }

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

    .breed-checkbox {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
      padding: 0.75rem;
      border-radius: 6px;
      transition: all 0.2s ease;
      background: #f8f9fa;
      border: 1px solid #e9ecef;
    }

    .breed-checkbox:hover {
      background: #e9ecef;
      border-color: #3498db;
      transform: translateY(-1px);
    }

    .breed-checkbox input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: #3498db;
      cursor: pointer;
    }

    .breed-checkbox span {
      font-size: 0.9rem;
      font-weight: 500;
      color: #2c3e50;
      user-select: none;
    }

    .breed-checkbox:has(input:checked) {
      background: #e3f2fd;
      border-color: #3498db;
      box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
    }

    .breed-checkbox:has(input:checked) span {
      color: #1976d2;
      font-weight: 600;
    }

    /* Collapsible panels */
    .collapsible-content {
      margin-top: 1rem;
    }

    .collapsible-btn {
      background: #3498db;
      color: white;
      border: none;
      padding: 0.75rem 1rem;
      border-radius: 6px;
      cursor: pointer;
      font-size: 0.9rem;
      font-weight: 500;
      transition: all 0.2s ease;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      width: 100%;
      margin-bottom: 1rem;
    }

    .collapsible-btn:hover {
      background: #2980b9;
      transform: translateY(-1px);
    }

    .collapsible-icon {
      font-size: 0.8rem;
      transition: transform 0.2s ease;
    }

    .collapsible-text {
      flex: 1;
      text-align: left;
    }

    .collapsible-panel {
      display: none; /* Hidden by default */
      transition: all 0.3s ease;
    }

    .collapsible-panel.show {
      display: grid;
    }

    /* Interactive image grid */
    .interactive-gallery .image-grid {
      display: flex;
      flex-direction: column;
      gap: 2rem;
      transition: all 0.3s ease;
      min-height: 200px;
    }

    /* Breed rows */
    .breed-row {
      background: white;
      border-radius: 12px;
      padding: 1.5rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      border: 1px solid #e9ecef;
    }

    .breed-row-title {
      margin: 0 0 1rem 0;
      color: #2c3e50;
      font-size: 1.2rem;
      font-weight: 600;
      padding-bottom: 0.5rem;
      border-bottom: 2px solid #3498db;
    }

    .breed-images {
      display: flex;
      flex-wrap: wrap;
      gap: 1rem;
      justify-content: flex-start;
    }

    .breed-images .image-item {
      flex: 0 0 calc(25% - 0.75rem);
      min-width: 200px;
    }

    .interactive-gallery .image-item {
      position: relative;
      overflow: hidden;
      border-radius: 12px;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      transition: all 0.3s ease;
      cursor: pointer;
      background: white;
      animation: fadeInUp 0.5s ease;
    }

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

    .interactive-gallery .image-item:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }

    .interactive-gallery .image-item img {
      width: 100%;
      height: 200px;
      object-fit: cover;
      transition: transform 0.3s ease;
    }

    .interactive-gallery .image-item:hover img {
      transform: scale(1.05);
    }

    .interactive-gallery .image-overlay {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      background: linear-gradient(transparent, rgba(0,0,0,0.85));
      color: white;
      padding: 12px;
      transform: translateY(100%);
      transition: transform 0.3s ease;
      backdrop-filter: blur(4px);
      opacity: 0;
      visibility: hidden;
    }

    .interactive-gallery .image-item:hover .image-overlay {
      transform: translateY(0);
      opacity: 1;
      visibility: visible;
    }

    .interactive-gallery .image-caption {
      margin: 0;
      font-size: 0.875rem;
      font-weight: 500;
      text-align: left;
      line-height: 1.4;
    }

    .interactive-gallery .image-caption div {
      color: #1f2937;
      text-shadow: 0 1px 2px rgba(255,255,255,0.8);
      font-weight: 600;
    }

    .interactive-gallery .image-caption strong {
      color: #fbbf24;
      font-weight: 600;
    }

    /* Responsive interactive gallery */
    @media (max-width: 768px) {
      .checkbox-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
      }

      .breed-checkbox {
        padding: 0.5rem;
      }

      .selector-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
      }

      .breed-images .image-item {
        flex: 0 0 calc(50% - 0.5rem);
        min-width: 150px;
      }

      .breed-row {
        padding: 1rem;
      }

      .breed-row-title {
        font-size: 1rem;
      }
    }

    @media (max-width: 480px) {
      .checkbox-grid {
        grid-template-columns: 1fr;
      }

      .breed-images .image-item {
        flex: 0 0 calc(100% - 0.5rem);
        min-width: 100%;
      }

      .species-section {
        padding: 1rem;
      }

      .breed-selector {
        padding: 1rem;
      }

      .breed-row {
        padding: 0.75rem;
      }

      .breed-row-title {
        font-size: 0.9rem;
      }
    }

