/* PeThoria Shared Styles - Dark Mode, Notifications, Responsive Design */

/* CSS Variables for Theme Management */
:root {
  /* Light theme colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-tertiary: #718096;
  --border-color: #e2e8f0;
  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --success-color: #48bb78;
  --warning-color: #ed8936;
  --error-color: #f56565;
  --info-color: #4299e1;
}

[data-theme="dark"] {
  /* Dark theme colors - cute and beautiful */
  --bg-primary: #1a1625;
  --bg-secondary: #2d1b3d;
  --bg-tertiary: #3e2449;
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --text-tertiary: #a0aec0;
  --border-color: #4a3458;
  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --success-color: #68d391;
  --warning-color: #fbb040;
  --error-color: #fc8181;
  --info-color: #63b3ed;
}

/* Mobile-First Base Styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  overflow-x: hidden;
}

/* Mobile App-like Container */
.mobile-container {
  max-width: 100vw;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Enhanced Mobile Navigation */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-theme="dark"] .mobile-nav {
  background: rgba(26, 22, 37, 0.95);
}

.mobile-nav-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Mobile Content Padding */
.mobile-content {
  padding-top: 80px; /* Account for fixed nav */
  padding-bottom: 80px; /* Account for potential bottom nav */
  padding-left: 1rem;
  padding-right: 1rem;
  min-height: calc(100vh - 160px);
}

/* Dark mode overrides for your original design */
[data-theme="dark"] {
  /* Background overrides */
  --tw-gradient-from: #1a1625;
  --tw-gradient-to: #2d1b3d;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}

[data-theme="dark"] body {
  background: linear-gradient(to bottom right, #1a1625, #2d1b3d, #3e2449) !important;
}

[data-theme="dark"] .bg-white {
  background-color: var(--bg-secondary) !important;
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .bg-gray-50 {
  background-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bg-gradient-to-br {
  background: linear-gradient(to bottom right, var(--bg-primary), var(--bg-secondary), var(--bg-tertiary)) !important;
}

/* Header and navigation dark mode */
[data-theme="dark"] header {
  background-color: rgba(26, 22, 37, 0.9) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .text-gray-700 {
  color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-gray-600 {
  color: var(--text-tertiary) !important;
}

[data-theme="dark"] .text-gray-900 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-800 {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .text-gray-500 {
  color: var(--text-tertiary) !important;
}

/* Mobile-Optimized Feature Cards */
.feature-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  width: 100%;
}

.feature-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

[data-theme="dark"] .feature-card {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary)) !important;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

[data-theme="dark"] .feature-card:hover {
  box-shadow: 0 20px 40px rgba(139, 92, 246, 0.2);
  transform: translateY(-2px);
}

/* Coming soon cards */
[data-theme="dark"] .coming-soon {
  background: linear-gradient(45deg, var(--bg-tertiary), var(--bg-secondary)) !important;
  color: var(--text-tertiary) !important;
  border: 2px dashed var(--border-color) !important;
}

/* Footer dark mode */
[data-theme="dark"] .bg-gray-900 {
  background-color: #0f0c15 !important;
}

[data-theme="dark"] .border-gray-800 {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .text-gray-400 {
  color: var(--text-tertiary) !important;
}

/* Gradient sections remain beautiful in dark mode */
[data-theme="dark"] .hero-gradient {
  background: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
}

/* Stats and counters */
[data-theme="dark"] .stats-counter {
  color: var(--accent-secondary) !important;
}

/* Testimonial cards in hero gradient section */
[data-theme="dark"] .testimonial-card {
  background: rgba(139, 92, 246, 0.15) !important;
  backdrop-filter: blur(15px);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

/* Mobile-Optimized Theme Toggle Button */
.theme-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 1001;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  touch-action: manipulation;
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
  transform: scale(0.95);
}

[data-theme="dark"] .theme-toggle {
  background: var(--accent-secondary);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Mobile-Optimized Notification System */
.notification-container {
  position: fixed;
  top: 70px;
  left: 1rem;
  right: 1rem;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.notification {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  pointer-events: auto;
  transform: translateY(-100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 100%;
  max-width: 400px;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification.hide {
  transform: translateY(-100px);
  opacity: 0;
}

.notification-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  flex-shrink: 0;
}

.notification-icon.success { background: var(--success-color); }
.notification-icon.warning { background: var(--warning-color); }
.notification-icon.error { background: var(--error-color); }
.notification-icon.info { background: var(--info-color); }

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.notification-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.notification-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Dark mode notification enhancements */
[data-theme="dark"] .notification {
  background: rgba(45, 27, 61, 0.95);
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.1);
}

/* Mobile-Optimized Quick Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .stat-card:hover {
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.1);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: white;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-change.positive { color: var(--success-color); }
.stat-change.negative { color: var(--error-color); }

/* Mobile-Optimized Card Styles */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .card:hover {
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.1);
}

.card-header {
  padding: 1.25rem 1.25rem 0 1.25rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.card-body {
  padding: 1.25rem;
}

/* Mobile-Optimized Button Enhancements */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 48px; /* Touch-friendly minimum height */
  touch-action: manipulation;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

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

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

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn.loading {
  opacity: 0.8;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
  
  .notification-container {
    top: 70px;
    left: 0.75rem;
    right: 0.75rem;
  }
  
  .card-header {
    padding: 1rem 1rem 0 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }

  .feature-card {
    padding: 1.25rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Mobile-specific grid layouts */
  .mobile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .mobile-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .mobile-content {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .feature-card {
    padding: 1rem;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.8125rem;
  }

  .card-title {
    font-size: 1rem;
  }

  .notification {
    padding: 0.875rem;
  }
}

/* Activity Indicators */
.activity-indicator {
  position: relative;
}

.activity-indicator::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--success-color);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

/* Progress Bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Mobile-Friendly Tooltips */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  margin-bottom: 8px;
}

.tooltip:hover::before {
  opacity: 1;
}

/* Touch-friendly tap targets */
.tap-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes bounceIn {
  0% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

.fade-in { animation: fadeIn 0.6s ease-out; }
.slide-in { animation: slideIn 0.6s ease-out; }
.bounce-in { animation: bounceIn 0.8s ease-out; }

/* Dark mode specific cute enhancements */
[data-theme="dark"] {
  /* Make scrollbars pretty in dark mode */
  scrollbar-width: thin;
  scrollbar-color: var(--accent-secondary) var(--bg-secondary);
}

[data-theme="dark"] *::-webkit-scrollbar {
  width: 8px;
}

[data-theme="dark"] *::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

[data-theme="dark"] *::-webkit-scrollbar-thumb {
  background: var(--accent-secondary);
  border-radius: 4px;
}

[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Selection colors in dark mode */
[data-theme="dark"] *::selection {
  background: var(--accent-secondary);
  color: var(--bg-primary);
}

/* Focus indicators */
[data-theme="dark"] *:focus {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

/* Input and form elements */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  padding: 0.75rem !important;
  border-radius: 8px !important;
  font-size: 1rem !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  border-color: var(--accent-secondary) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
}

/* Mobile input optimization */
input, textarea, select {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  padding: 0.75rem !important;
  border-radius: 8px !important;
  font-size: 16px !important; /* Prevents zoom on iOS */
  width: 100%;
  transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
  outline: none;
}

/* Safe area insets for iPhone X+ */
@supports (padding: max(0px)) {
  .mobile-nav {
    padding-top: max(0.75rem, env(safe-area-inset-top));
    height: max(60px, calc(60px + env(safe-area-inset-top)));
  }
  
  .mobile-content {
    padding-top: max(80px, calc(80px + env(safe-area-inset-top)));
    padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
  
  .theme-toggle {
    top: max(15px, calc(15px + env(safe-area-inset-top)));
    right: max(15px, calc(15px + env(safe-area-inset-right)));
  }
} 