/* ============================================
   RaspyRFM Client Documentation Custom Styles
   Enhanced design for better readability and visual appeal
   ============================================ */

:root {
  --sd-color-primary: #1e88e5;
  --sd-color-secondary: #00897b;
  --color-brand-primary: #1e88e5;
  --color-brand-secondary: #00897b;
  --color-accent: #ff6f00;
  --spacing-unit: 1rem;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.18);
}

/* ============================================
   Base Typography and Layout
   ============================================ */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.8em;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-brand-primary);
  border-bottom: 3px solid var(--color-brand-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  color: var(--color-brand-secondary);
  border-bottom: 2px solid var(--color-brand-secondary);
  padding-bottom: 0.4rem;
}

h3 {
  font-size: 1.5rem;
  color: #455a64;
}

a {
  text-decoration: none;
  color: var(--color-brand-primary);
  transition: all 0.2s ease;
}

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

p {
  margin-bottom: 1.2em;
}

/* ============================================
   Code Blocks and Pre-formatted Text
   ============================================ */

code {
  background: rgba(30, 136, 229, 0.08);
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius-sm);
  font-size: 0.9em;
  font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
  color: #d32f2f;
  border: 1px solid rgba(30, 136, 229, 0.15);
}

pre {
  background: linear-gradient(135deg, #f5f7fa 0%, #eef2f7 100%);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  overflow-x: auto;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--color-brand-primary);
  margin: 1.5rem 0;
}

pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 0.9rem;
  color: #263238;
  border: none;
}

.highlight {
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* ============================================
   Lists and Tables
   ============================================ */

ul, ol {
  margin: 1.2em 0;
  padding-left: 2em;
}

li {
  margin-bottom: 0.6em;
  line-height: 1.6;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2rem 0;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

thead {
  background: linear-gradient(135deg, var(--color-brand-primary), var(--color-brand-secondary));
  color: white;
}

thead th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

tbody tr:hover {
  background-color: rgba(30, 136, 229, 0.08);
}

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

/* ============================================
   Hero Card and Callouts
   ============================================ */

.hero-card {
  background: linear-gradient(135deg, rgba(30, 136, 229, 0.12), rgba(0, 137, 123, 0.12));
  border-radius: var(--border-radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  border: 1px solid rgba(30, 136, 229, 0.2);
}

.hero-card .hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-brand-primary);
}

.hero-card .hero-subtitle {
  font-size: 1.2rem;
  margin: 0;
  max-width: 60ch;
  color: #546e7a;
}

.demo-highlight {
  border-radius: var(--border-radius-md);
  background: linear-gradient(120deg, rgba(77, 208, 225, 0.25), rgba(144, 202, 249, 0.25));
  padding: 2rem;
  display: grid;
  gap: 1rem;
  margin: 2rem 0;
  border-left: 4px solid var(--color-brand-primary);
  box-shadow: var(--shadow-md);
}

.demo-highlight h3 {
  margin: 0;
  color: var(--color-brand-primary);
}

/* ============================================
   Figures and Images
   ============================================ */

figure {
  margin: 2.5rem auto;
  text-align: center;
  max-width: 100%;
}

figure img, figure svg {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

figure img:hover, figure svg:hover {
  transform: scale(1.02);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

figcaption {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: #607d8b;
  font-style: italic;
  line-height: 1.5;
}

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

.figure-grid figure {
  border-radius: var(--border-radius-md);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.figure-grid figure:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.figure-grid figcaption {
  font-size: 0.9rem;
  color: #546e7a;
  margin-top: 1rem;
}

.ui-showcase-figure {
  margin: 3rem auto !important;
  max-width: 900px;
  border-radius: var(--border-radius-lg);
  background: radial-gradient(circle at top, rgba(30, 136, 229, 0.08), rgba(30, 136, 229, 0));
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}

.ui-showcase-figure img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.22);
}

.ui-showcase-figure figcaption {
  font-size: 1rem;
  margin-top: 1.2rem;
  color: #546e7a;
}

/* ============================================
   Admonitions and Notes
   ============================================ */

.admonition {
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin: 2rem 0;
  border-left: 4px solid;
  box-shadow: var(--shadow-sm);
}

.admonition.note {
  background: rgba(33, 150, 243, 0.08);
  border-color: #2196f3;
}

.admonition.warning {
  background: rgba(255, 152, 0, 0.08);
  border-color: #ff9800;
}

.admonition.tip {
  background: rgba(76, 175, 80, 0.08);
  border-color: #4caf50;
}

.admonition.danger {
  background: rgba(244, 67, 54, 0.08);
  border-color: #f44336;
}

.admonition-title {
  font-weight: 600;
  margin-bottom: 0.8rem;
  font-size: 1.1rem;
}

/* ============================================
   Cards and Panels
   ============================================ */

.sd-card {
  border-radius: var(--border-radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.sd-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg) !important;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.6rem;
  }
  
  .hero-card {
    padding: 2rem;
  }
  
  .hero-card .hero-title {
    font-size: 1.8rem;
  }
  
  .figure-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  pre {
    padding: 1rem;
  }
}

/* ============================================
   Dark Mode Support
   ============================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --color-brand-primary: #4dd0e1;
    --color-brand-secondary: #90caf9;
  }
  
  .hero-card {
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.25), rgba(0, 137, 123, 0.25));
    border-color: rgba(77, 208, 225, 0.3);
  }
  
  .hero-card .hero-subtitle {
    color: #b0bec5;
  }

  .figure-grid figure {
    background: rgba(38, 50, 56, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  }

  .figure-grid figcaption {
    color: #cfd8dc;
  }

  .demo-highlight {
    background: linear-gradient(120deg, rgba(77, 208, 225, 0.35), rgba(144, 202, 249, 0.35));
  }
  
  .demo-highlight h3 {
    color: var(--color-brand-primary);
  }

  .ui-showcase-figure {
    background: radial-gradient(circle at top, rgba(144, 202, 249, 0.2), rgba(0, 0, 0, 0));
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  }

  .ui-showcase-figure figcaption {
    color: #cfd8dc;
  }
  
  pre {
    background: linear-gradient(135deg, #263238 0%, #1e2a30 100%);
    box-shadow: var(--shadow-lg);
  }
  
  pre code {
    color: #e0e0e0;
  }
  
  code {
    background: rgba(77, 208, 225, 0.15);
    color: #ff6e6e;
    border-color: rgba(77, 208, 225, 0.25);
  }
  
  tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
  }
  
  tbody tr:hover {
    background-color: rgba(77, 208, 225, 0.12);
  }
  
  tbody td {
    border-bottom-color: #37474f;
  }
}

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

@media print {
  .hero-card {
    page-break-inside: avoid;
  }
  
  figure {
    page-break-inside: avoid;
  }
  
  table {
    page-break-inside: avoid;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}
