/* Event Management Website - Professional Styling */
@import url('https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css');

/* Mobile Alignment Fixes */
* {
  box-sizing: border-box;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* Prevent horizontal scrolling on all devices */
body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Ensure proper mobile viewport handling */
@media screen and (max-width: 768px) {
  html {
    width: 100vw;
    overflow-x: hidden;
  }
  
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
  }
  
  .fixed {
    max-width: 100vw;
  }
  
  /* Fix for container elements that might cause horizontal overflow */
  .max-w-7xl, .max-w-6xl, .max-w-4xl, .max-w-3xl, .max-w-2xl, .max-w-xl {
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Ensure grid elements don't cause overflow */
  .grid {
    grid-template-columns: 1fr !important;
  }
  
  .lg\:grid-cols-2, .lg\:grid-cols-3, .lg\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }
  
  /* Prevent images from causing overflow */
  img {
    max-width: 100% !important;
    height: auto !important;
  }
  
  /* Fix for sections that might cause overflow */
  section {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
}

/* ============================================ */
/* DARK MODE COLOR SCHEME - Comprehensive */
/* ============================================ */
/* 
   Color Hierarchy for Dark Mode:
   - Primary text (headings, important): #F1F5F9 (very high contrast)
   - Secondary text (body, paragraphs): #CBD5E1 (high contrast)
   - Tertiary text (small text, labels): #94A3B8 (meets WCAG AA)
   - Links: #60A5FA (bright, distinctive)
   - Accents: Light variants
   
   Background: #1E293B (Slate 800)
   Contrast ratios: All meet WCAG AA (4.5:1 minimum)
*/

/* Base dark mode text color */
.dark {
  color: #CBD5E1 !important; /* Primary body text */
}

/* Heading hierarchy in dark mode */
.dark h1 {
  color: #F1F5F9 !important; /* Primary heading - near white */
  font-weight: 700;
}

.dark h2 {
  color: #F1F5F9 !important; /* Primary heading */
  font-weight: 700;
}

.dark h3 {
  color: #E2E8F0 !important; /* Secondary heading - slightly lighter */
  font-weight: 600;
}

.dark h4,
.dark h5,
.dark h6 {
  color: #CBD5E1 !important; /* Tertiary heading */
  font-weight: 600;
}

/* Paragraph and body text */
.dark p {
  color: #CBD5E1 !important; /* Primary body text - excellent contrast */
}

.dark span {
  color: inherit; /* Inherit from parent for consistency */
}

.dark div {
  color: #CBD5E1 !important; /* Ensure divs have proper text color */
}

/* Small and auxiliary text */
.dark .text-sm,
.dark .text-xs,
.dark small {
  color: #94A3B8 !important; /* Tertiary text - still readable */
}

.dark label {
  color: #CBD5E1 !important; /* Labels should be readable */
}

/* List items */
.dark li {
  color: #CBD5E1 !important;
}

/* Table content */
.dark td,
.dark th {
  color: #CBD5E1 !important;
}

/* Links in dark mode */
.dark a {
  color: #60A5FA !important; /* Bright blue - easy to spot */
}

.dark a:hover {
  color: #93C5FD !important; /* Lighter on hover */
}

.dark a:visited {
  color: #7C3AED !important; /* Visited links in purple */
}

/* Buttons in dark mode */
.dark button {
  color: #F1F5F9 !important;
}

.dark .btn-primary {
  color: #FFFFFF !important;
}

.dark .btn-secondary {
  color: #FFFFFF !important;
}

/* Form inputs */
.dark input,
.dark textarea,
.dark select {
  color: #F1F5F9 !important; /* Light text in form fields */
  background-color: #0F172A !important; /* Dark background */
  border-color: #334155 !important; /* Slate border */
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #64748B !important; /* Placeholder text - medium gray */
}

/* Navigation */
.dark nav a {
  color: #CBD5E1 !important;
}

.dark nav a:hover {
  color: #F1F5F9 !important;
}

.dark navbar a {
  color: #CBD5E1 !important;
}

/* Mobile menu */
.dark .mobile-menu {
  background: rgba(15, 23, 42, 0.98) !important; /* Very dark background */
}

.dark .mobile-menu a {
  color: #CBD5E1 !important;
}

.dark .mobile-menu a:hover {
  color: #F1F5F9 !important;
}

/* Cards and containers */
.dark .card {
  color: #CBD5E1 !important;
}

.dark .card heading,
.dark .card h1,
.dark .card h2,
.dark .card h3 {
  color: #F1F5F9 !important;
}

.dark .card p,
.dark .card span {
  color: #CBD5E1 !important;
}

/* Sidebar and navigation links */
.dark .sidebar-link {
  color: #CBD5E1 !important;
}

.dark .sidebar-link:hover {
  color: #F1F5F9 !important;
}

/* Dropdowns */
.dark .dropdown-content {
  background: #0F172A !important;
  border: 1px solid #334155 !important;
}

.dark .dropdown-content a {
  color: #CBD5E1 !important;
}

.dark .dropdown-content a:hover {
  color: #F1F5F9 !important;
  background-color: #1E293B !important;
}

/* Text color overrides for Tailwind classes */
.dark .text-gray-900 {
  color: #F1F5F9 !important;
}

.dark .text-gray-800 {
  color: #F1F5F9 !important;
}

.dark .text-gray-700 {
  color: #E2E8F0 !important;
}

.dark .text-gray-600 {
  color: #CBD5E1 !important;
}

.dark .text-gray-500 {
  color: #CBD5E1 !important;
}

.dark .text-gray-400 {
  color: #94A3B8 !important;
}

.dark .text-gray-300 {
  color: #94A3B8 !important;
}

/* Status and semantic colors */
.dark .text-blue-600,
.dark .text-blue-700 {
  color: #60A5FA !important;
}

.dark .text-red-600 {
  color: #FCA5A5 !important;
}

.dark .text-green-600 {
  color: #86EFAC !important;
}

.dark .text-yellow-600 {
  color: #FBBF24 !important;
}

.dark .text-purple-600 {
  color: #D8B4FE !important;
}

/* Icons */
.dark .fas,
.dark .fab,
.dark .far {
  color: #CBD5E1 !important;
}

/* General text and content */
.dark strong,
.dark b {
  color: #F1F5F9 !important;
}

.dark em,
.dark i:not(.fas):not(.fab):not(.far) {
  color: #CBD5E1 !important;
}

/* Code blocks */
.dark code,
.dark pre {
  color: #E2E8F0 !important;
  background-color: #0F172A !important;
}

/* Ensure all remaining text is readable */
.dark *:not(button):not(.btn-primary):not(.btn-secondary) {
  color: #CBD5E1 !important;
}

/* Custom CSS Variables for Color Palette */
:root {
  --primary-color: #4338CA;    /* Indigo */
  --secondary-color: #2563EB;  /* Blue */
  --tertiary-color: #64748B;   /* Slate */
  --accent-color: #F3F4F6;     /* Soft Gray */
  --bg-color: #FFFFFF;         /* White Background */
  --text-color: #1F2937;       /* Dark Gray Text */
  
  /* Dark Mode Colors */
  --dark-bg: #0F172A;
  --dark-surface: #1E293B;
  --dark-text: #F9FAFB;
  --dark-accent: #4B5563;
}

/* Blob animation for background effects */
@keyframes blob {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.9);
  }
  100% {
    transform: translate(0px, 0px) scale(1);
  }
}

.animate-blob {
  animation: blob 7s infinite;
}

.animation-delay-2000 {
  animation-delay: 2s;
}

.animation-delay-4000 {
  animation-delay: 4s;
}

/* Dark Mode Styles */
.dark {
  --bg-color: var(--dark-bg);
  --text-color: var(--dark-text);
  --accent-color: var(--dark-accent);
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .rtl-flip {
  transform: scaleX(-1);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: all 0.3s ease;
}

/* Custom Components */
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-primary:hover {
  background-color: #312E81;
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(49, 46, 129, 0.3);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--text-color);
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background-color: #1D4ED8;
  transform: translateY(-2px);
}

/* Navigation Styles */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  transition: background 0.3s ease;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.dark .navbar {
  background: rgba(31, 41, 55, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Improve navigation link visibility */
.navbar a {
  color: #374151; /* good contrast in light mode */
  transition: color 0.2s ease;
}

.navbar a:hover {
  color: var(--primary-color);
}

/* Disable brand-name underline effect on hover */
.navbar .group-hover\:underline {
  text-decoration: none !important;
}

/* Keep CTA text readable in navbar when link hover styles apply */
.navbar a.btn-primary,
.navbar a.btn-primary:hover,
.navbar a.btn-primary:focus {
  color: #FFFFFF !important;
}

.dark .navbar a {
  color: #F3F4F6 !important; /* high contrast white text in dark mode */
}

.dark .navbar a:hover {
  color: #93C5FD !important; /* high-contrast hover */
}

/* Navigation Active State - blue Highlighting */
.navbar a.active,
.navbar a.active:hover {
  color: var(--primary-color) !important;
  font-weight: 600;
}

.mobile-menu a.active,
.mobile-menu a.active:hover {
  color: var(--primary-color) !important;
  font-weight: 600;
  background-color: rgba(67, 56, 202, 0.1);
}

.dark .navbar a.active,
.dark .navbar a.active:hover {
  color: #93C5FD !important;
}

.dark .mobile-menu a.active,
.dark .mobile-menu a.active:hover {
  color: #BFDBFE !important;
  background-color: rgba(37, 99, 235, 0.2);
}

.dropdown {
  position: relative;
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  min-width: 200px;
}

.dark .dropdown-content {
  background: var(--dark-surface);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.dropdown:hover .dropdown-content {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Hero Section */
.hero-gradient {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1d0596 100%);
}

/* Card Styles */
.card {
  background: var(--bg-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 1px solid var(--accent-color);
}

.dark .card {
  background: var(--dark-surface);
  border-color: var(--dark-accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Carousel Styles */
.carousel-container {
  position: relative;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease;
}

.carousel-slide {
  flex: 0 0 100%;
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.fade-in.animate {
  opacity: 1;
  transform: translateY(0);
}

.slide-in-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.6s ease;
}

.slide-in-left.animate {
  opacity: 1;
  transform: translateX(0);
}

.slide-in-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.6s ease;
}

.slide-in-right.animate {
  opacity: 1;
  transform: translateX(0);
}

/* Counter Animation */
.counter {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Form Styles */
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--accent-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-color);
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dark .form-input {
  background: var(--dark-surface);
  border-color: var(--dark-accent);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 4rem; /* 64px - height of navbar */
  left: 0;
  right: 0;
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 40;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.mobile-menu.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Ensure mobile menu works properly on all pages */
@media (max-width: 1023px) {
  .mobile-menu {
    position: fixed !important;
    top: 4rem !important;
    left: 0 !important;
    right: 0 !important;
    max-height: calc(100vh - 4rem) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  /* Prevent horizontal scrolling when mobile menu is open */
  body.mobile-menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
  }
}

/* Mobile menu links */
.mobile-menu a {
  padding: 12px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: block;
  color: #1F2937; /* dark text for light mode */
}

.mobile-menu a:hover {
  background-color: rgba(37, 99, 235, 0.12);
  color: var(--primary-color);
}

/* Keep Register CTA text visible inside mobile menu */
.mobile-menu a.btn-primary,
.mobile-menu a.btn-primary:hover,
.mobile-menu a.btn-primary:focus {
  color: #FFFFFF !important;
}

.dark .mobile-menu {
  background: rgba(31, 41, 55, 0.98);
  backdrop-filter: blur(10px);
}

.dark .mobile-menu a {
  color: #F9FAFB !important; /* bright white text for dark mode */
}

.dark .mobile-menu a:hover {
  background-color: rgba(37, 99, 235, 0.22);
  color: #BFDBFE !important;
}

/* Mobile menu button animation */
.mobile-menu-toggle {
  transition: transform 0.2s ease;
}

.mobile-menu-toggle:active {
  transform: scale(0.95);
}

/* Improve mobile menu for touch devices */
@media (max-width: 768px) {
  .mobile-menu {
    padding: 1rem;
  }
  
  .mobile-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: 1rem;
  }
  
  .mobile-menu .btn-primary {
    margin-top: 1rem;
    text-align: center;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Dashboard Sidebar */
.sidebar {
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

/* RTL Dashboard Support */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

[dir="rtl"] .sidebar.collapsed {
    transform: translateX(100%);
}

[dir="rtl"] .sidebar-toggle {
    right: auto;
    left: 1rem;
}

/* Mobile RTL improvements */
@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        max-width: 280px;
        z-index: 50;
    }
    
    [dir="rtl"] .sidebar {
        right: 0;
        left: auto;
    }
    
    /* RTL mobile sidebar transforms */
    [dir="rtl"] .sidebar.-translate-x-full {
        transform: translateX(0);
    }
    
    [dir="rtl"] .sidebar.translate-x-full {
        transform: translateX(100%);
    }
    
    /* Prevent horizontal scroll on mobile RTL */
    .grid {
        min-width: 0;
    }
    
    .card {
        min-width: 0;
        overflow: hidden;
    }
    
    /* RTL text alignment fixes */
    [dir="rtl"] .text-left {
        text-align: right;
    }
    
    [dir="rtl"] .text-right {
        text-align: left;
    }
}

/* Responsive grid improvements */
@media (max-width: 640px) {
    .grid-cols-2 {
        gap: 0.75rem;
    }
    
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* Prevent horizontal scrolling on mobile */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .max-w-7xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .max-w-4xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .max-w-6xl {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* RTL flex direction fixes */
[dir="rtl"] .space-x-reverse > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .p-6 {
        padding: 1rem;
    }
    
    .gap-6 {
        gap: 1rem;
    }
    
    .text-lg {
        font-size: 1rem;
        line-height: 1.5rem;
    }
    
    /* Fix for mobile alignment issues */
    section {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .card {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* RTL text flow */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] input,
[dir="rtl"] textarea {
    text-align: right;
}

/* RTL Layout Fixes */
[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-4 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-8 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

/* RTL Header Logo Fixes */
[dir="rtl"] .logo-container {
    flex-direction: row-reverse;
}

/* RTL Social Icons */
[dir="rtl"] .social-icons {
    flex-direction: row-reverse;
}

/* RTL Navigation */
[dir="rtl"] .nav-links {
    flex-direction: row-reverse;
}

/* RTL Button Icons */
[dir="rtl"] .btn-icon-left {
    flex-direction: row-reverse;
}

/* RTL Dropdown Chevrons */
[dir="rtl"] .dropdown-chevron {
    transform: scaleX(-1);
}

/* RTL Mobile Menu */
[dir="rtl"] .mobile-menu {
    left: 0;
    right: 0;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .carousel-slide {
    flex: 0 0 100%;
  }
  
  .counter {
    font-size: 2rem;
  }
}

/* Smooth transitions for theme switching */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--accent-color);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #312E81;
}

/* Optimize for 360px width mobile devices */
@media (max-width: 375px) {
  /* Reduce navbar padding on very small screens */
  .navbar {
    padding: 0.5rem 0.5rem !important;
  }
  
  /* Logo section adjustment */
  .navbar .flex.items-center.space-x-3 {
    gap: 0.5rem !important;
  }
  
  /* Logo icon size */
  .navbar .w-12.h-12 {
    width: 2.5rem !important;
    height: 2.5rem !important;
  }
  
  /* Logo text size */
  .navbar .text-2xl {
    font-size: 1.25rem !important;
  }
  
  /* Navigation buttons container */
  .navbar > div > div:last-child {
    gap: 0.5rem !important;
  }
  
  /* Theme and menu toggle buttons - reduce padding */
  #rtl-toggle,
  #theme-toggle,
  #mobile-menu-toggle {
    padding: 0.375rem !important;
    width: 2rem !important;
    height: 2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Icon size in navbar buttons */
  #rtl-toggle i,
  #theme-toggle i,
  #mobile-menu-toggle i {
    font-size: 0.875rem !important;
  }
  
  /* Ensure max-width container doesn't overflow */
  .navbar .max-w-7xl {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}