/**
 * Base Module Styles - Matches Cogito site design system
 * Use this as the foundation for all interactive modules
 * 
 * Import this file first, then add module-specific styles
 */

/* ===== COLOR PALETTE (matches src/styles/input.css) ===== */
:root {
  /* Background colors */
  --bg: #eeeeee;
  --bg-light: #cbcdcd;
  
  /* Text colors */
  --text: #41474e;
  --text-secondary: #44475a;
  --text-light: #646868;
  
  /* Accent colors */
  --accent: #d26878;
  --accent-light: #e08f67;
  --link: #5690af;
  
  /* Semantic colors */
  --red: #d26878;
  --dimRed: #623039;
  --orange: #e08f67;
  --dimOrange: #926048;
  --yellow: #fffae1;
  --dimYellow: #d5c5a1;
  --green: #56afa0;
  --dimGreen: #22453f;
  --blue: #5690af;
  --dimBlue: #223844;
  --purple: #9271d6;
  --dimPurple: #47356c;
  --grey: #cbcdcd;
  --dimGrey: #646868;
  
  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  
  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

/* Dark mode support */
.dark {
  --bg: #222529;
  --bg-light: #464949;
  --text: #d6d6d6;
  --text-secondary: #e6e6e6;
  --text-light: #dbd5bc;
  --accent: #78b6ad;
  --accent-light: #87c9e5;
  --link: #e2aea2;
  --red: #cd909b;
  --dimRed: #684249;
  --orange: #e2aea2;
  --dimOrange: #704941;
  --yellow: #dbd5bc;
  --dimYellow: #6f6847;
  --green: #78b6ad;
  --dimGreen: #3e615c;
  --blue: #87c9e5;
  --dimBlue: #38494f;
  --purple: #b07cf3;
  --dimPurple: #5e406a;
  --grey: #cbcdcd;
  --dimGrey: #464949;
}

/* ===== BASE RESETS ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== BODY ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  padding: var(--spacing-lg) var(--spacing-sm);
  overflow-x: hidden; /* No horizontal scrollbar */
  overflow-y: auto; /* Allow vertical scrolling if needed (shouldn't be visible in iframe) */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

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

a {
  color: var(--link);
  text-decoration: none;
  transition: opacity var(--transition-base);
}

a:hover {
  opacity: 0.8;
}

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

/* ===== SECTION ===== */
.section {
  margin-bottom: var(--spacing-xl);
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--text);
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: var(--spacing-lg);
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-lg);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  font-size: 0.95rem;
}

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

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  opacity: 0.9;
}

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

.btn-outline:hover {
  background: var(--bg-light);
}

/* ===== FORM CONTROLS ===== */
.control-group {
  margin-bottom: var(--spacing-md);
}

.control-group label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
  color: var(--text);
}

.control-group input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.control-group input[type="text"],
.control-group input[type="number"],
.control-group select {
  width: 100%;
  padding: var(--spacing-sm);
  border: 1px solid var(--grey);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

/* ===== CHARTS/VISUALIZATIONS ===== */
.chart-container {
  position: relative;
  margin-top: var(--spacing-lg);
  background: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ===== UTILITY CLASSES ===== */
.text-center {
  text-align: center;
}

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.hidden {
  display: none;
}

/* ===== LOADING STATE ===== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--grey);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  body {
    padding: var(--spacing-md) var(--spacing-xs);
  }
  
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .card {
    padding: var(--spacing-md);
  }
}
