/**
 * COSMOS Super App - Global Styles
 * Unified design system for all categories including Dhruv
 */

:root {
  /* Primary Brand Colors */
  --cosmos-primary: #008080;
  --cosmos-primary-dark: #006666;
  --cosmos-primary-light: #00a3a3;
  --cosmos-secondary: #ff6b6b;
  --cosmos-accent: #ffd166;
  
  /* Category-specific colors */
  --finance-color: #0072bb;
  --shopping-color: #d32f2f;
  --healthcare-color: #388e3c;
  --travel-color: #1976d2;
  --food-color: #ff9800;
  --entertainment-color: #9c27b0;
  --education-color: #5d4037;
  --dhruv-color: #1E40AF;
  --dhruv-secondary: #2563EB;
  
  /* Neutrals */
  --text-dark: #1F2937;
  --text-medium: #4B5563;
  --text-light: #9CA3AF;
  --background-light: #F9FAFB;
  --background-dark: #111827;
  
  /* Semantic Colors */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
  --info: #3B82F6;
}

/* Global Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: var(--text-dark);
  background-color: var(--background-light);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .hide-mobile {
    display: none !important;
  }
}

/* Accessibility Enhancements */
.high-contrast {
  --text-dark: #000000;
  --background-light: #FFFFFF;
}

/* Global Components */
.cosmos-header {
  background-color: var(--cosmos-primary);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cosmos-header-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
}

.cosmos-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cosmos-header-icon {
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

.cosmos-search {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  margin: 12px 16px;
}

.cosmos-search-input {
  background: transparent;
  border: none;
  color: white;
  flex: 1;
  padding: 8px;
}

.cosmos-search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.cosmos-search-button {
  background: white;
  color: var(--cosmos-primary);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cosmos-footer {
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  background-color: white;
  border-top: 1px solid #e5e7eb;
  position: fixed;
  bottom: 0;
  width: 100%;
}

.cosmos-footer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-medium);
  font-size: 0.75rem;
  text-decoration: none;
}

.cosmos-footer-item.active {
  color: var(--cosmos-primary);
}

.cosmos-footer-icon {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 16px;
  padding-bottom: 72px; /* Space for footer */
}

.category-card {
  background-color: white;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.category-card:hover, .category-card:focus {
  transform: translateY(-4px);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.5rem;
}

.category-name {
  font-weight: 600;
  text-align: center;
}

/* Dhruv Specific Styles */
.dhruv-gradient {
  background: linear-gradient(135deg, var(--dhruv-color), var(--dhruv-secondary));
}

.dhruv-container {
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 72px; /* Space for footer */
}

.post-card {
  background-color: white;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.dhruv-sidebar {
  position: sticky;
  top: 0;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --text-dark: #F9FAFB;
    --text-medium: #D1D5DB;
    --text-light: #9CA3AF;
    --background-light: #111827;
    --background-dark: #030712;
  }
  
  body {
    background-color: var(--background-dark);
    color: var(--text-dark);
  }
  
  .category-card, .post-card {
    background-color: #1F2937;
  }
  
  .cosmos-footer {
    background-color: #1F2937;
    border-top-color: #374151;
  }
  
  .cosmos-search {
    background-color: rgba(255, 255, 255, 0.1);
  }
  
  /* Ensure icons are visible in dark mode */
  .fa, .fas, .far, .fab {
    color: currentColor;
  }
  
  /* Improve contrast for interactive elements */
  button, .button {
    background-color: var(--cosmos-primary);
    color: white;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* RTL Language Support for Dhruv */
[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] .ml-auto {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .mr-3 {
  margin-right: 0;
  margin-left: 0.75rem;
}

/* Offline notification */
.offline-notification {
  background-color: var(--warning); 
  color: white;
  padding: 8px 16px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
  font-size: 0.875rem;
}

.offline-notification i {
  margin-right: 8px;
}

/* Improved visibility for all icons */
.icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* TruthScore Verification */
.truth-score {
  display: flex;
  align-items: center;
  background-color: rgba(16, 185, 129, 0.1);
  color: #065f46;
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
}

.truth-score i {
  margin-right: 4px;
  color: #065f46;
}

/* Fix scrolling issues */
main {
  padding-bottom: 80px;
  overflow-x: hidden;
}

.full-height-scroll {
  height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}