/* 
 * Enjoy Karo Yaar - Complete CSS Reset and Design System
 * Based on the design specification document
 * Optimized for Core Web Vitals and Performance
 */

/* Performance Optimizations */
html {
  font-display: swap;
}

/* Reduce layout shifts */
img {
  height: auto;
  width: 100%;
  max-width: 100%;
}

/* Improve paint performance */
* {
  will-change: auto;
}

.card:hover,
.feature-card:hover,
.resource-card:hover {
  will-change: transform, box-shadow;
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* CSS Variables - Color System */
:root {
  /* Core Black & White */
  --primary-black: #000000;
  --primary-white: #FFFFFF;
  --off-white: #FAFAFA;
  --soft-black: #1A1A1A;
  --charcoal: #333333;
  
  /* Warm Accent Colors (10% usage) */
  --accent-blue: #2B5A9E;
  --accent-green: #4A7C59;
  --accent-purple: #6B5B95;
  --warm-beige: #F5F0E8;
  
  /* Status Colors */
  --crisis-red: #D32F2F;
  --warning-amber: #F57C00;
  --success-green: #388E3C;
  --info-blue: #1976D2;
  
  /* Responsive Breakpoints */
  --mobile: 320px;
  --mobile-lg: 425px;
  --tablet: 768px;
  --desktop: 1024px;
  --desktop-lg: 1440px;
}

/* CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base Styles */
html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Verdana', 'Arial', sans-serif;
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--soft-black);
  background: var(--primary-white);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography System */
.heading-primary {
  font-family: 'Bookish', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--soft-black);
}

.text-body {
  font-family: 'Verdana', 'Arial', sans-serif;
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.text-crisis {
  font-family: 'Arial', sans-serif;
  font-size: 20px;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Typography Scale */
.text-h1 { 
  font-size: 32px; 
  line-height: 1.2; 
}

.text-h2 { 
  font-size: 28px; 
  line-height: 1.3; 
}

.text-h3 { 
  font-size: 24px; 
  line-height: 1.4; 
  font-family: 'Verdana', 'Arial', sans-serif;
}

.text-h4 { 
  font-size: 20px; 
  line-height: 1.4; 
  font-family: 'Verdana', 'Arial', sans-serif;
}

.text-lg { 
  font-size: 20px; 
  line-height: 1.6; 
}

.text-base { 
  font-size: 18px; 
  line-height: 1.6; 
}

.text-sm { 
  font-size: 16px; 
  line-height: 1.5; 
}

.text-xs { 
  font-size: 14px; 
  line-height: 1.4; 
}

/* Container System */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container { 
    padding: 0 40px; 
  }
}

@media (min-width: 1024px) {
  .container { 
    padding: 0 60px; 
  }
}

/* Grid Layout */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

/* Mobile: All columns full width */
@media (max-width: 767px) {
  .grid { 
    grid-template-columns: 1fr; 
  }
  [class*="col-span-"] { 
    grid-column: span 1; 
  }
}

/* Icon Styles */
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 24px; height: 24px; }
.icon-lg { width: 32px; height: 32px; }
.icon-xl { width: 48px; height: 48px; }

/* Navigation icons */
.nav-icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* Feature icons */
.feature-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 24px;
  color: var(--accent-blue);
  stroke-width: 1.5;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Bottom navigation icons */
.bottom-nav-item i {
  width: 20px;
  height: 20px;
  margin-bottom: 4px;
}

/* Chat widget icon */
.crisis-chat i {
  width: 18px;
  height: 18px;
  margin-right: 8px;
}

/* Screen Reader Only Text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus Management */
*:focus {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Button Components */
.btn-primary {
  background: var(--accent-blue);
  color: var(--primary-white);
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 18px;
  font-weight: 600;
  min-height: 48px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  background: #1e4a87;
  transform: translateY(-2px);
}

.btn-primary:focus {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

.btn-secondary {
  background: transparent;
  color: var(--soft-black);
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 18px;
  font-weight: 500;
  min-height: 48px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: var(--warm-beige);
  border-color: var(--soft-black);
}

/* Card Components */
.card {
  background: var(--primary-white);
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card-header {
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Bookish', Georgia, serif;
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--soft-black);
}

.card-body {
  font-size: 18px;
  line-height: 1.6;
  color: var(--charcoal);
}

/* Header Navigation */
.header {
  background: var(--primary-white);
  border-bottom: 1px solid #E0E0E0;
  position: sticky;
  top: 0;
  z-index: 900;
  padding: 16px 0;
}

.nav-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-family: 'Bookish', Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--soft-black);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: var(--soft-black);
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.nav-link:hover {
  background: var(--warm-beige);
}

/* Mobile Navigation */
@media (max-width: 767px) {
  .nav-links {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
  }
}

@media (min-width: 768px) {
  .mobile-menu-toggle {
    display: none;
  }
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary-white);
  border-top: 1px solid #E0E0E0;
  padding: 12px 0;
  z-index: 900;
  display: none;
}

@media (max-width: 767px) {
  .bottom-nav {
    display: flex;
    justify-content: space-around;
  }
  
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    min-width: 48px;
    min-height: 48px;
    text-decoration: none;
    color: var(--charcoal);
    font-size: 12px;
  }
  
  .bottom-nav-item:hover {
    color: var(--accent-blue);
  }
  
  body {
    padding-bottom: 80px;
  }
}

/* Form Components */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--soft-black);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  background: var(--primary-white);
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(43, 90, 158, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-input.error {
  border-color: var(--crisis-red);
}

.form-error {
  color: var(--crisis-red);
  font-size: 16px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Hero Section */
.hero {
  padding: 80px 0;
  background: linear-gradient(135deg, rgba(250, 250, 250, 0.95) 0%, rgba(245, 240, 232, 0.95) 100%), 
              url('../images/hero/diverse-youth-talking.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 70vh;
  display: flex;
  align-items: center;
}

.hero-content {
  text-align: center;
}

.hero-title {
  font-family: 'Bookish', Georgia, serif;
  font-size: 48px;
  line-height: 1.2;
  color: var(--soft-black);
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 24px;
  color: var(--charcoal);
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .hero-title { 
    font-size: 32px; 
  }
  
  .hero-subtitle { 
    font-size: 20px; 
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    width: 100%;
    max-width: 280px;
  }
}

/* Section Styling */
.section {
  padding: 60px 0;
}

.section-title {
  font-family: 'Bookish', Georgia, serif;
  font-size: 32px;
  line-height: 1.2;
  text-align: center;
  margin-bottom: 48px;
  color: var(--soft-black);
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
  margin-top: 48px;
}

.feature-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--primary-white);
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  position: relative;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Feature card with background images */
.feature-card.with-image {
  background-size: cover;
  background-position: center;
  color: var(--primary-white);
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.feature-card.with-image::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.feature-card.with-image * {
  position: relative;
  z-index: 2;
}

.feature-card.with-image .feature-icon {
  color: var(--primary-white);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 24px;
  display: block;
}

.feature-card h3 {
  font-family: 'Bookish', Georgia, serif;
  font-size: 24px;
  margin-bottom: 16px;
  color: var(--soft-black);
}

.feature-card p {
  color: var(--charcoal);
  line-height: 1.6;
}

/* Search and Filter Components */
.search-bar {
  background: var(--primary-white);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 32px;
}

.search-input-group {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.search-input {
  flex: 1;
  padding: 14px 16px;
  font-size: 18px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
}

.search-btn {
  background: var(--accent-blue);
  color: var(--primary-white);
  border: none;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}

.filter-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tag {
  background: transparent;
  border: 2px solid #E0E0E0;
  color: var(--charcoal);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}

.filter-tag.active,
.filter-tag:hover {
  background: var(--accent-blue);
  color: var(--primary-white);
  border-color: var(--accent-blue);
}

/* Resource Cards */
.resource-card {
  background: var(--primary-white);
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resource-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.resource-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.resource-title {
  font-family: 'Bookish', Georgia, serif;
  font-size: 24px;
  color: var(--soft-black);
  margin: 0;
}

.resource-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  background: var(--warm-beige);
  color: var(--soft-black);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
}

.resource-info {
  margin-bottom: 16px;
}

.resource-specialty {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--charcoal);
}

.resource-location {
  color: var(--charcoal);
  margin-bottom: 8px;
}

.resource-rating {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stars {
  color: var(--warning-amber);
  font-size: 16px;
}

.rating-text {
  color: var(--charcoal);
  font-size: 14px;
}

.resource-actions {
  display: flex;
  gap: 12px;
}

/* Crisis Support Styles */
.crisis-header {
  text-align: center;
  background: var(--crisis-red);
  color: var(--primary-white);
  padding: 40px 20px;
  border-radius: 12px;
  margin-bottom: 32px;
}

.crisis-title {
  font-family: 'Bookish', Georgia, serif;
  font-size: 36px;
  margin-bottom: 16px;
}

.crisis-subtitle {
  font-size: 20px;
  opacity: 0.9;
}

.emergency-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.emergency-card {
  background: var(--primary-white);
  border: 2px solid var(--crisis-red);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.emergency-card.urgent {
  background: var(--crisis-red);
  color: var(--primary-white);
}

.emergency-card h2 {
  font-family: 'Bookish', Georgia, serif;
  font-size: 32px;
  margin-bottom: 12px;
}

.contact-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Crisis Chat Widget */
.crisis-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--accent-blue);
  color: var(--primary-white);
  border-radius: 50px;
  padding: 16px 20px;
  box-shadow: 0 4px 12px rgba(43, 90, 158, 0.3);
  z-index: 1000;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-weight: 600;
}

.crisis-chat:hover {
  background: #1e4a87;
  transform: scale(1.05);
}

/* Footer */
.footer {
  background: var(--soft-black);
  color: var(--primary-white);
  padding: 40px 0;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
}

.footer-section h3 {
  font-family: 'Bookish', Georgia, serif;
  font-size: 20px;
  margin-bottom: 16px;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: 8px;
}

.footer-section a {
  color: var(--primary-white);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-section a:hover {
  opacity: 1;
}

.footer-bottom {
  border-top: 1px solid var(--charcoal);
  margin-top: 32px;
  padding-top: 16px;
  text-align: center;
  opacity: 0.6;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

/* Section Background Images */
.section-with-bg {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

.section-with-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(250, 250, 250, 0.92);
  z-index: 1;
}

.section-with-bg .container {
  position: relative;
  z-index: 2;
}

/* Image optimization */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  loading: lazy;
}

/* Lazy loading placeholder - Fixed to show images by default */
img[loading="lazy"] {
  opacity: 1;
  transition: opacity 0.3s;
}

img[loading="lazy"].loading {
  opacity: 0.8;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

.image-hero {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 12px;
}

.image-feature {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 16px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .hero {
    background-attachment: scroll;
  }
  
  .section-with-bg {
    background-attachment: scroll;
  }
}

@media (max-width: 480px) {
  .search-input-group {
    flex-direction: column;
  }
  
  .resource-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .resource-actions {
    flex-direction: column;
  }
  
  .hero-title {
    font-size: 28px;
  }
  
  .section-title {
    font-size: 28px;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
  
  .feature-card.with-image {
    min-height: 250px;
  }
  
  .image-hero {
    height: 250px;
  }
  
  .image-feature {
    height: 150px;
  }
}

/* Print Styles */
@media print {
  .crisis-chat,
  .bottom-nav {
    display: none;
  }
  
  .header {
    position: static;
  }
  
  body {
    color: var(--primary-black);
    background: var(--primary-white);
  }
}