/* CSS Custom Properties - Fun & Whimsical Theme */
:root {
  /* Light Theme Colors */
  --primary-color: #ff6b9d;
  --primary-hover: #ff5a8a;
  --secondary-color: #c7f9cc;
  --accent-color: #ffd93d;
  --accent-secondary: #74c0fc;
  --text-primary: #2d1b69;
  --text-secondary: #6b46c1;
  --text-muted: #9ca3af;
  --background: #fef7ff;
  --background-alt: #f0f9ff;
  --background-gradient: linear-gradient(135deg, #fef7ff 0%, #f0f9ff 100%);
  --border-color: #e0e7ff;
  --card-bg: rgba(255, 255, 255, 0.9);
  --header-bg: rgba(255, 255, 255, 0.95);
  --footer-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 249, 255, 0.9));
  
  /* Status Colors */
  --success-color: #10b981;
  --success-color-rgb: 16, 185, 129;
  --warning-color: #f59e0b;
  --warning-color-rgb: 245, 158, 11;
  --error-color: #ef4444;
  --error-color-rgb: 239, 68, 68;
  --info-color: #3b82f6;
  --info-color-rgb: 59, 130, 246;
  
  /* Common Properties */
  --border-radius: 16px;
  --shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.1), 0 2px 4px -1px rgba(139, 92, 246, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(139, 92, 246, 0.15), 0 10px 10px -5px rgba(139, 92, 246, 0.08);
  --shadow-fun: 0 8px 25px rgba(255, 107, 157, 0.2), 0 4px 10px rgba(116, 192, 252, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  --font-mono: 'Courier New', 'Monaco', 'Menlo', monospace;
}

/* Dark Theme Colors */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-color: #ff79c6;
    --primary-hover: #ff92d1;
    --secondary-color: #50fa7b;
    --accent-color: #f1fa8c;
    --accent-secondary: #8be9fd;
    --text-primary: #f8f8f2;
    --text-secondary: #bd93f9;
    --text-muted: #6272a4;
    --background: #282a36;
    --background-alt: #44475a;
    --background-gradient: linear-gradient(135deg, #282a36 0%, #44475a 100%);
    --border-color: #6272a4;
    --card-bg: rgba(68, 71, 90, 0.9);
    --header-bg: rgba(40, 42, 54, 0.95);
    --footer-bg: linear-gradient(135deg, rgba(68, 71, 90, 0.9), rgba(40, 42, 54, 0.9));
    --shadow-fun: 0 8px 25px rgba(255, 121, 198, 0.3), 0 4px 10px rgba(139, 233, 253, 0.2);
    
    /* Status Colors (same for both themes) */
    --success-color: #10b981;
    --success-color-rgb: 16, 185, 129;
    --warning-color: #f59e0b;
    --warning-color-rgb: 245, 158, 11;
    --error-color: #ef4444;
    --error-color-rgb: 239, 68, 68;
    --info-color: #3b82f6;
    --info-color-rgb: 59, 130, 246;
  }
}

/* Explicit Dark Theme Override */
[data-theme="dark"] {
  --primary-color: #ff79c6;
  --primary-hover: #ff92d1;
  --secondary-color: #50fa7b;
  --accent-color: #f1fa8c;
  --accent-secondary: #8be9fd;
  --text-primary: #f8f8f2;
  --text-secondary: #bd93f9;
  --text-muted: #6272a4;
  --background: #282a36;
  --background-alt: #44475a;
  --background-gradient: linear-gradient(135deg, #282a36 0%, #44475a 100%);
  --border-color: #6272a4;
  --card-bg: rgba(68, 71, 90, 0.9);
  --header-bg: rgba(40, 42, 54, 0.95);
  --footer-bg: linear-gradient(135deg, rgba(68, 71, 90, 0.9), rgba(40, 42, 54, 0.9));
  --shadow-fun: 0 8px 25px rgba(255, 121, 198, 0.3), 0 4px 10px rgba(139, 233, 253, 0.2);
  
  /* Status Colors */
  --success-color: #10b981;
  --success-color-rgb: 16, 185, 129;
  --warning-color: #f59e0b;
  --warning-color-rgb: 245, 158, 11;
  --error-color: #ef4444;
  --error-color-rgb: 239, 68, 68;
  --info-color: #3b82f6;
  --info-color-rgb: 59, 130, 246;
}

/* Explicit Light Theme Override */
[data-theme="light"] {
  --primary-color: #ff6b9d;
  --primary-hover: #ff5a8a;
  --secondary-color: #c7f9cc;
  --accent-color: #ffd93d;
  --accent-secondary: #74c0fc;
  --text-primary: #2d1b69;
  --text-secondary: #6b46c1;
  --text-muted: #9ca3af;
  --background: #fef7ff;
  --background-alt: #f0f9ff;
  --background-gradient: linear-gradient(135deg, #fef7ff 0%, #f0f9ff 100%);
  --border-color: #e0e7ff;
  --card-bg: rgba(255, 255, 255, 0.9);
  --header-bg: rgba(255, 255, 255, 0.95);
  --footer-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 249, 255, 0.9));
  --shadow-fun: 0 8px 25px rgba(255, 107, 157, 0.2), 0 4px 10px rgba(116, 192, 252, 0.15);
  
  /* Status Colors */
  --success-color: #10b981;
  --success-color-rgb: 16, 185, 129;
  --warning-color: #f59e0b;
  --warning-color-rgb: 245, 158, 11;
  --error-color: #ef4444;
  --error-color-rgb: 239, 68, 68;
  --info-color: #3b82f6;
  --info-color-rgb: 59, 130, 246;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: 1.6;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--background-gradient);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Fun background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(255, 107, 157, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(116, 192, 252, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(255, 217, 61, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.main-header {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--secondary-color);
  box-shadow: var(--shadow-fun);
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.header-left {
  flex-shrink: 0;
}

.header-center {
  flex: 1;
  text-align: center;
}

.header-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-taco-btn {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  border: 3px solid #ff6b35;
  border-radius: 8px;
  width: 3rem;
  height: 3rem;
  display: none; /* Hidden by default until authenticated */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
  position: relative;
  overflow: hidden;
}

.mobile-taco-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
  border-color: #e55a2b;
}

.mobile-taco-btn .taco {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-taco-btn .taco-shell {
  width: 1.8rem;
  height: 1.2rem;
  background: linear-gradient(135deg, #deb887, #cd853f);
  border-radius: 0 0 1rem 1rem;
  position: relative;
  border: 2px solid #8b4513;
  border-top: none;
  overflow: hidden;
}

.mobile-taco-btn .taco-filling {
  position: absolute;
  width: 100%;
  height: 3px;
  border-radius: 2px;
}

.mobile-taco-btn .taco-filling:nth-child(1) {
  background: #228b22;
  top: 2px;
  left: 0;
}

.mobile-taco-btn .taco-filling:nth-child(2) {
  background: #ff6347;
  top: 6px;
  left: 0;
}

.mobile-taco-btn .taco-filling:nth-child(3) {
  background: #ffd700;
  top: 10px;
  left: 0;
}

.mobile-taco-btn.menu-open {
  animation: taco-wiggle 0.3s ease-in-out;
}

@keyframes taco-wiggle {
  0%, 100% { transform: scale(1.1); }
  25% { transform: scale(1.15) rotate(-5deg); }
  75% { transform: scale(1.15) rotate(5deg); }
}

@media (min-width: 1024px) {
  .mobile-taco-btn {
    display: none !important; /* Force hide on wide screens regardless of JavaScript */
  }
}

/* App Layout for side menu */
.app-layout {
  display: flex;
  min-height: calc(100vh - 80px); /* Adjust for header height */
}

@media (min-width: 1024px) {
  .app-layout {
    max-width: 1200px;
    margin: 0 auto;
  }
  
  .main-content {
    flex: 1;
    margin-left: 0; /* Taco menu handles its own spacing */
  }
}

/* Mobile layout - reserve space for lightning handle only when authenticated */
@media (max-width: 1023px) {
  body.authenticated .main-content {
    width: calc(100vw - 30px); /* Reserve 30px for lightning handle */
    max-width: calc(100vw - 30px);
  }
  
  body.authenticated .container {
    max-width: calc(100vw - 60px); /* Account for handle + padding */
    padding: 0 1rem;
  }
}

/* Portrait mobile - ensure proper spacing */
@media (max-width: 768px) and (orientation: portrait) {
  body.authenticated .main-content {
    width: calc(100vw - 30px);
    max-width: calc(100vw - 30px);
  }
  
  body.authenticated .container {
    max-width: calc(100vw - 50px);
    padding: 0 0.75rem;
  }
}

.site-title {
  font-size: 1.75rem;
  font-weight: 900;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-secondary), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  text-shadow: 0 2px 4px rgba(255, 107, 157, 0.2);
  transform: rotate(-1deg);
  display: inline-block;
}


/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 0;
}

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

.content-section.hidden {
  display: none;
}

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-10deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.05) rotate(5deg);
  }
  70% {
    transform: scale(0.9) rotate(-2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.content-section {
  animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.post-area {
  margin-bottom: 2rem;
}

.posts-container {
  margin-top: 1rem;
}

/* Friends Page */
.friends-page {
  width: 100%;
}

.friends-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .friends-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
}

/* Footer */
.main-footer {
  background: var(--footer-bg);
  backdrop-filter: blur(10px);
  border-top: 2px solid var(--secondary-color);
  padding: 2rem 0;
  margin-top: auto;
  position: relative;
}

.main-footer::before {
  content: '✨ 🎉 💫 🌟 ✨';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--background);
  padding: 0 1rem;
  font-size: 1.2rem;
  animation: sparkle 3s infinite;
}

@keyframes sparkle {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.1); }
}

.main-footer p {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  animation: fadeIn 0.5s ease-in-out;
}

.loading-content h2 {
  color: var(--primary-color);
  margin: 1rem 0 0.5rem;
  font-size: 1.5rem;
}

.loading-content p {
  color: var(--text-muted);
  margin: 0;
}

.loading-content .spinner {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

.text-muted {
  color: var(--text-muted);
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Responsive Design */
@media (max-width: 768px) {
  .header-container {
    padding: 0.75rem 1rem;
  }
  
  .container {
    padding: 0 0.75rem;
  }
  
  .main-content {
    padding: 1rem 0;
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 1.25rem;
  }
  
}
