/* Age-Based Health Screening Guide - CSS */
/* Neobrutalism design with dark mode support */

/* Global box-sizing */
.age-health-guide-container,
.age-health-guide-container *,
.age-health-guide-container *::before,
.age-health-guide-container *::after {
  box-sizing: border-box;
}

/* Main container with CSS variables */
.age-health-guide-container {
  position: relative;
  max-width: 1180px;
  width: 100%;
  margin: 8px auto;
  padding: 8px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-container);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  line-height: 1.5;
  
  /* Light mode (default) */
  --bg-primary: #f5f5f0;
  --bg-secondary: #fff;
  --bg-section: #fff;
  --border-color: #333;
  --text-primary: #222;
  --text-secondary: #555;
  --text-light: #666;
  --color-accent: #3498db;
  --color-success: #27ae60;
  --color-warning: #f39c12;
  --color-danger: #e74c3c;
  --color-purple: #9b59b6;
  --color-teal: #1abc9c;
  --shadow-sm: 2px 2px 0 rgba(0,0,0,0.1);
  --shadow-md: 4px 4px 0 rgba(0,0,0,0.15);
  --shadow-lg: 8px 8px 0 rgba(0,0,0,0.15);
  --radius-container: 8px;
  --radius-section: 6px;
  --radius-button: 4px;
  --radius-input: 4px;
  --input-focus-bg: #fffacd;
  --title-color: #2c3e50;
  --title-shadow: 2px 2px 0 rgba(255,255,255,0.5);
  --btn-hover-overlay: rgba(0,0,0,0.1);
  --copy-btn-bg: #fff;
  --copy-btn-hover-bg: #f0f0f0;
}

/* Dark mode - manual toggle */
.age-health-guide-container.dark {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-section: #2d2d2d;
  --border-color: #e0e0e0;
  --text-primary: #e8e8e8;
  --text-secondary: #b0b0b0;
  --text-light: #909090;
  --color-accent: #5dade2;
  --color-success: #52c77a;
  --color-warning: #f5b041;
  --color-danger: #ec7063;
  --color-purple: #af7ac5;
  --color-teal: #48d1cc;
  --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
  --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
  --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
  --input-focus-bg: #3a3a3a;
  --title-color: #7fb3d5;
  --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  --btn-hover-overlay: rgba(255,255,255,0.1);
  --copy-btn-bg: #3a3a3a;
  --copy-btn-hover-bg: #4a4a4a;
}

/* System dark mode auto detection */
@media (prefers-color-scheme: dark) {
  .age-health-guide-container:not(.dark):not(.light) {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-section: #2d2d2d;
    --border-color: #e0e0e0;
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --text-light: #909090;
    --color-accent: #5dade2;
    --color-success: #52c77a;
    --color-warning: #f5b041;
    --color-danger: #ec7063;
    --color-purple: #af7ac5;
    --color-teal: #48d1cc;
    --shadow-sm: 2px 2px 0 rgba(255,255,255,0.08);
    --shadow-md: 4px 4px 0 rgba(255,255,255,0.12);
    --shadow-lg: 8px 8px 0 rgba(255,255,255,0.12);
    --input-focus-bg: #3a3a3a;
    --title-color: #7fb3d5;
    --title-shadow: 2px 2px 0 rgba(0,0,0,0.5);
    --btn-hover-overlay: rgba(255,255,255,0.1);
    --copy-btn-bg: #3a3a3a;
    --copy-btn-hover-bg: #4a4a4a;
  }
}

/* Dark mode toggle button */
.dark-mode-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-size: 17.5px;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 10;
}

.dark-mode-toggle:hover {
  transform: translate(0.5px, 0.5px);
  box-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.15);
}

.dark-mode-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* Main title */
.age-health-guide-container h2 {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--title-color);
  margin: 0 0 6px 0;
  padding: 0;
  text-shadow: var(--title-shadow);
}

.subtitle {
  text-align: center;
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0 0 12px 0;
}

/* Main 2-column grid layout */
.main-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

/* Section common styles */
.input-section,
.guide-section,
.lifestyle-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 10px;
  box-shadow: var(--shadow-md);
}

/* Section titles */
.input-section h3,
.guide-section h3,
.lifestyle-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-section h4,
.quick-age-section h4,
.progress-section h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 12px 0 6px 0;
}

/* Input group */
.input-group {
  margin-bottom: 10px;
}

.input-group label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.input-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  font-size: 18px;
  background: var(--bg-section);
  color: var(--text-primary);
  transition: all 0.2s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--input-focus-bg);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Gender buttons */
.gender-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.gender-btn {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  background: var(--bg-section);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.gender-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
  background: var(--btn-hover-overlay);
}

.gender-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.gender-btn.active {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* Quick age selection */
.quick-age-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.quick-age-btn {
  padding: 6px 10px;
  background: var(--color-success);
  color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.quick-age-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
  filter: brightness(1.1);
}

.quick-age-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.quick-age-btn.active {
  background: var(--color-warning);
  border-color: var(--color-warning);
}

/* Current info display */
.current-info {
  background: var(--bg-section);
  border: 1px solid var(--color-success);
  border-radius: var(--radius-section);
  padding: 10px;
  margin-top: 12px;
}

.info-text {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Progress section */
.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--color-success), var(--color-teal));
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
}

/* Guide section header */
.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.age-badge {
  font-size: 16px;
  color: var(--color-accent);
  background: var(--bg-section);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--color-accent);
  margin-left: 6px;
}

.guide-controls {
  display: flex;
  gap: 4px;
}

.control-btn {
  padding: 4px 10px;
  background: var(--color-purple);
  color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-button);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}

.control-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0,0,0,0.1);
  filter: brightness(1.1);
}

.control-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* Health cards container */
.health-cards-container {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  background: var(--bg-section);
  padding: 8px;
}

/* Scrollbar styling */
.health-cards-container::-webkit-scrollbar {
  width: 8px;
}

.health-cards-container::-webkit-scrollbar-track {
  background: var(--bg-section);
  border-radius: 4px;
}

.health-cards-container::-webkit-scrollbar-thumb {
  background: var(--text-light);
  border-radius: 4px;
}

.health-cards-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Welcome message */
.welcome-message {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.welcome-icon {
  margin-bottom: 12px;
}

.welcome-icon svg {
  color: var(--color-accent);
}

.welcome-message h4 {
  font-size: 20px;
  color: var(--text-primary);
  margin: 0 0 10px 0;
  font-weight: 600;
}

.welcome-message p {
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

/* Health card */
.health-card {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  margin-bottom: 6px;
  transition: all 0.2s;
}

.health-card:last-child {
  margin-bottom: 0;
}

.health-card.expanded {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.card-header {
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.card-header:hover {
  background: var(--btn-hover-overlay);
}

.health-card.expanded .card-header {
  background: var(--input-focus-bg);
}

.card-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.card-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-frequency {
  font-size: 16px;
  color: var(--text-secondary);
  background: var(--bg-section);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.card-priority {
  font-size: 14px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 600;
}

.priority-high {
  background: #fed7d7;
  color: #c53030;
}

.priority-medium {
  background: #fef5e7;
  color: #dd6b20;
}

.priority-low {
  background: #e6fffa;
  color: #38b2ac;
}

.card-expand {
  transition: transform 0.2s;
}

.health-card.expanded .card-expand {
  transform: rotate(180deg);
}

/* Card content */
.card-content {
  display: none;
  padding: 10px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-section);
}

.health-card.expanded .card-content {
  display: block;
}

.content-section {
  margin-bottom: 10px;
}

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

.content-section h5 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.content-section p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.section-icon {
  width: 14px;
  height: 14px;
}

/* Lifestyle section */
.lifestyle-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.lifestyle-tip {
  background: var(--bg-section);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-section);
  padding: 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.lifestyle-tip-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.lifestyle-tip-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.empty-message {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  font-size: 16px;
  grid-column: 1 / -1;
}

/* Notice */
.notice {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 10px;
  background: var(--bg-section);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-section);
  line-height: 1.5;
  margin-top: 8px;
}

.notice strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Animation */
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Responsive design */
@media (max-width: 768px) {
  .age-health-guide-container {
    padding: 6px;
    margin: 6px auto;
  }

  .age-health-guide-container h2 {
    font-size: 22px;
    margin-bottom: 4px;
  }

  .subtitle {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .main-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .health-cards-container {
    max-height: 350px;
  }

  .guide-controls {
    flex-direction: column;
    gap: 3px;
  }

  .control-btn {
    font-size: 14px;
    padding: 4px 8px;
  }

  .lifestyle-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .age-health-guide-container {
    padding: 4px;
  }

  .age-health-guide-container h2 {
    font-size: 20px;
  }

  .subtitle {
    font-size: 13px;
  }

  .input-section h3,
  .guide-section h3,
  .lifestyle-section h3 {
    font-size: 16px;
  }

  .quick-age-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .quick-age-btn {
    font-size: 14px;
    padding: 5px 8px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-frequency {
    font-size: 14px;
  }

  .health-cards-container {
    max-height: 280px;
  }
}