/**
 * Anarivo SPA - Main Stylesheet
 * Global styles, Tailwind configuration, and theme support
 */

/* ============================================
   TAILWIND CONFIGURATION
   ============================================ */

/* Primary color palette - matches original app */
:root {
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;
}

/* ============================================
   THEME SUPPORT
   ============================================ */

/* Default to dark theme - only localStorage "light" enables light */
html {
  color-scheme: dark;
}

html.light {
  color-scheme: light;
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme changes */
.transition-colors {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

/* ============================================
   LAYOUT COMPONENTS
   ============================================ */

/* App container - full height layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Main content area */
.main-content {
  flex: 1;
  overflow-y: auto;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Gradient backgrounds */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-700) 100%);
}

/* Card hover effect */
.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* Button primary gradient */
.btn-primary {
  background-color: var(--primary-600);
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--primary-700);
}

/* Focus ring for accessibility - Tailwind-style focus */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--primary-500), 0 0 0 4px white;
}

.dark .focus-ring:focus,
html.dark .focus-ring:focus {
  box-shadow: 0 0 0 2px var(--primary-500), 0 0 0 4px #1f2937;
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */

.sidebar {
  width: 16rem;
  flex-shrink: 0;
  transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-collapsed {
  width: 4rem;
}

.sidebar-mobile {
  position: fixed;
  z-index: 50;
  transform: translateX(-100%);
}

.sidebar-mobile.open {
  transform: translateX(0);
}

/* Sidebar navigation link */
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  font-weight: 600;
}

.nav-link i {
  width: 1.5rem;
  text-align: center;
  margin-right: 0.75rem;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Mobile sidebar overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Hide sidebar on mobile by default */
@media (max-width: 1023px) {
  .sidebar-desktop {
    display: none;
  }
}

/* Show sidebar on desktop */
@media (min-width: 1024px) {
  .sidebar-mobile {
    display: none;
  }
  
  .sidebar-overlay {
    display: none;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

/* Loading spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .sidebar,
  .sidebar-overlay,
  .no-print {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
  }
}
