/* Custom Styles for Education Website */

/* Navigation fixes */
nav {
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  transition: all 0.3s ease;
  background: white !important;
}

.dark nav {
  background: #0f172a !important;
}

.navbar-scrolled {
  background: white !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
}

.dark .navbar-scrolled {
  background: #0f172a !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

/* Professional Color Palette */
:root {
  --primary-color: #2563eb;      /* Blue - Primary */
  --secondary-color: #7c3aed;    /* Purple - Secondary */
  --accent-color: #059669;       /* Green - Accent */
  --neutral-color: #6b7280;      /* Gray - Neutral */
  
  /* Light theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --border-color: #475569;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* RTL Support */
[dir="rtl"] .navbar-brand {
  margin-right: 0;
  margin-left: auto;
}

[dir="rtl"] .dropdown-menu {
  left: auto;
  right: 0;
}

/* Fix logo spacing in RTL */
[dir="rtl"] .flex.items-center.space-x-2 > :not(:first-child) {
  margin-right: 0.5rem !important;
  margin-left: 0 !important;
}

[dir="rtl"] .flex.items-center.space-x-2 > :first-child {
  margin-right: 0 !important;
}

[dir="rtl"] .flex.items-center.space-x-2 {
  --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]) {
  margin-right: calc(0.5rem * var(--tw-space-x-reverse)) !important;
  margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))) !important;
}

/* Fix logo spacing in RTL */
[dir="rtl"] .flex.items-center.space-x-2 > :not(:first-child) {
  margin-right: 0.5rem !important;
  margin-left: 0 !important;
}

[dir="rtl"] .flex.items-center.space-x-2 > :first-child {
  margin-right: 0 !important;
}

[dir="rtl"] .flex.items-center.space-x-2 {
  --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]) {
  margin-right: calc(0.5rem * var(--tw-space-x-reverse)) !important;
  margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse))) !important;
}

/* Fix dropdown positioning in RTL mode */
[dir="rtl"] .dropdown .dropdown-content {
  transform-origin: top right;
  left: auto !important;
  right: 0 !important;
}

/* Fix dropdown positioning for all dropdowns in RTL */
[dir="rtl"] .dropdown-content {
  left: auto !important;
  right: 0 !important;
}

/* Fix specific dropdown positioning in RTL */
[dir="rtl"] .dropdown:nth-child(1) .dropdown-content,
[dir="rtl"] .dropdown:nth-child(6) .dropdown-content {
  left: auto !important;
  right: 0 !important;
  transform-origin: top right;
}

/* Ensure dropdowns remain visible in RTL mode */
[dir="rtl"] .dropdown-content {
  right: 0 !important;
  left: auto !important;
  z-index: 1000 !important;
}

/* Custom animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.8s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 0.8s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.6s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.8s ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-slide-in-left {
  animation: slideInLeft 0.8s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.8s ease-out;
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out;
}

/* Animation delays */
.animation-delay-500ms {
  animation-delay: 0.5s;
  animation-fill-mode: both;
}

.animation-delay-1s {
  animation-delay: 1s;
  animation-fill-mode: both;
}

.animation-delay-1-5s {
  animation-delay: 1.5s;
  animation-fill-mode: both;
}

.animation-delay-2s {
  animation-delay: 2s;
  animation-fill-mode: both;
}

.animation-delay-2-5s {
  animation-delay: 2.5s;
  animation-fill-mode: both;
}

.animation-delay-3s {
  animation-delay: 3s;
  animation-fill-mode: both;
}

.animation-delay-3-5s {
  animation-delay: 3.5s;
  animation-fill-mode: both;
}

.animation-delay-4s {
  animation-delay: 4s;
  animation-fill-mode: both;
}

/* Custom Utilities */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.bg-gradient-secondary {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-white {
  background: linear-gradient(135deg, #ffffff, #e0e7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-hover {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow);
}

.card-hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
}

.card-hover:hover::before {
  left: 100%;
}

.btn-primary {
  @apply bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-6 rounded-lg transition-all duration-300 transform hover:scale-105;
}

.btn-secondary {
  @apply bg-purple-600 hover:bg-purple-700 text-white font-semibold py-3 px-6 rounded-lg transition-all duration-300 transform hover:scale-105;
}

.btn-accent {
  @apply bg-green-600 hover:bg-green-700 text-white font-semibold py-3 px-6 rounded-lg transition-all duration-300 transform hover:scale-105;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* Mobile menu transition */
.mobile-menu {
  transition: all 0.3s ease-in-out;
  transform: translateX(-100%);
  background-color: white !important;
  left: 0;
  right: auto;
  max-height: 100vh;
  overflow-y: auto;
}

.dark .mobile-menu {
  background-color: #0f172a !important;
}

.mobile-menu.active {
  transform: translateX(0);
}

/* RTL support for mobile menu */
[dir="rtl"] .mobile-menu {
  transform: translateX(100%);
  left: auto !important;
  right: 0 !important;
}

[dir="rtl"] .mobile-menu.active {
  transform: translateX(0);
}

/* RTL support for mobile menu button */
[dir="rtl"] .flex.items-center.justify-between {
  flex-direction: row-reverse;
}

[dir="rtl"] #mobile-menu-btn {
  margin-left: 0;
  margin-right: auto;
  order: -1;
}

/* Ensure mobile menu button is on the left in RTL mode */
[dir="rtl"] .flex.items-center.justify-between > #mobile-menu-btn {
  order: -1;
  margin-right: auto;
  margin-left: 0;
}

/* RTL support for mobile menu items */
[dir="rtl"] .mobile-menu nav a {
  text-align: right;
}

[dir="rtl"] #mobile-direction-toggle {
  flex-direction: row-reverse;
}

[dir="rtl"] #mobile-direction-icon {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* RTL support for admin dashboard header */
[dir="rtl"] header .flex.items-center.justify-between {
  flex-direction: row-reverse;
}

[dir="rtl"] header .flex.items-center.space-x-4:first-child {
  order: 2;
}

[dir="rtl"] header .flex.items-center.space-x-4:last-child {
  order: 1;
}

[dir="rtl"] header .flex.items-center.space-x-4 > :not([hidden]) ~ :not([hidden]) {
  margin-right: calc(1rem * var(--tw-space-x-reverse)) !important;
  margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))) !important;
}

/* Additional RTL support for header elements */
[dir="rtl"] header .flex.items-center.space-x-4 {
  --tw-space-x-reverse: 1;
}

/* Dropdown animations - improved for stability */
.dropdown-content {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  min-width: 12rem;
  /* Add padding to create a larger hover area */
  padding: 0.5rem 0;
}

.dropdown-content.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Add a small triangle/arrow to dropdowns for better UX */
.dropdown-content:before {
  content: '';
  position: absolute;
  top: -8px;
  left: 20px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid white;
  z-index: 1001;
}

.dark .dropdown-content:before {
  border-bottom-color: #1e293b;
}

/* RTL specific dropdown animations */
[dir="rtl"] .dropdown-content {
  transform: translateY(-10px) translateX(0);
}

[dir="rtl"] .dropdown-content.visible {
  transform: translateY(0) translateX(0);
}

/* Fix spacing between navbar items in RTL */
[dir="rtl"] .md\:flex.items-center.space-x-8 > :not(:first-child) {
  margin-right: 2rem !important;
  margin-left: 0 !important;
}

[dir="rtl"] .md\:flex.items-center.space-x-8 > :first-child {
  margin-right: 0 !important;
}

/* Ensure proper spacing in RTL mode */
[dir="rtl"] .md\:flex.items-center.space-x-8 {
  --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-8 > :not([hidden]) ~ :not([hidden]) {
  margin-right: calc(2rem * var(--tw-space-x-reverse)) !important;
  margin-left: calc(2rem * calc(1 - var(--tw-space-x-reverse))) !important;
}

/* Fix spacing between login button and RTL toggle in RTL mode */
[dir="rtl"] .md\:flex.items-center.space-x-4 > :not(:first-child) {
  margin-right: 1rem !important;
  margin-left: 0 !important;
}

[dir="rtl"] .md\:flex.items-center.space-x-4 > :first-child {
  margin-right: 0 !important;
}

[dir="rtl"] .md\:flex.items-center.space-x-4 {
  --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-4 > :not([hidden]) ~ :not([hidden]) {
  margin-right: calc(1rem * var(--tw-space-x-reverse)) !important;
  margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))) !important;
}

/* Ensure dropdowns work properly in RTL - Enhanced positioning */
[dir="rtl"] .dropdown-content {
  left: auto !important;
  right: 0 !important;
  transform: translateX(0) !important;
}

/* Fix dropdown positioning in RTL for home and dashboard dropdowns */
[dir="rtl"] .dropdown:nth-child(1) .dropdown-content,
[dir="rtl"] .dropdown:nth-child(6) .dropdown-content {
  right: 0 !important;
  left: auto !important;
  transform: translateX(0) !important;
}

/* Ensure dropdowns are visible and clickable in RTL */
[dir="rtl"] .dropdown-content {
  z-index: 1000 !important;
  min-width: 12rem !important;
  right: 0 !important;
  left: auto !important;
}

/* Fix spacing for dropdown trigger elements in RTL */
[dir="rtl"] .dropdown-trigger.flex.items-center.space-x-1 > :not(:first-child) {
  margin-right: 0.25rem !important;
  margin-left: 0 !important;
}

[dir="rtl"] .dropdown-trigger.flex.items-center.space-x-1 > :first-child {
  margin-right: 0 !important;
}

[dir="rtl"] .dropdown-trigger.flex.items-center.space-x-1 {
  --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-1 > :not([hidden]) ~ :not([hidden]) {
  margin-right: calc(0.25rem * var(--tw-space-x-reverse)) !important;
  margin-left: calc(0.25rem * calc(1 - var(--tw-space-x-reverse))) !important;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  
  .section-padding {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Image styling */
img {
  transition: all 0.3s ease;
}

img:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Additional responsive adjustments */
@media (max-width: 768px) {
  .animate-fade-in-up,
  .animate-fade-in-left,
  .animate-fade-in-right,
  .animate-scale-in {
    animation: none;
  }
  
  .animation-delay-500ms,
  .animation-delay-1s,
  .animation-delay-1-5s,
  .animation-delay-2s,
  .animation-delay-2-5s,
  .animation-delay-3s,
  .animation-delay-3-5s,
  .animation-delay-4s {
    animation-delay: 0s;
  }
}

/* Direction toggle button styling */
#direction-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 0.5rem;
  background-color: #f1f5f9 !important;
  transition: all 0.3s ease;
  cursor: pointer;
}

.dark #direction-toggle {
  background-color: #1e293b !important;
}

#direction-toggle:hover {
  background-color: #e2e8f0 !important;
}

.dark #direction-toggle:hover {
  background-color: #334155 !important;
}

#direction-icon {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile direction toggle button */
#mobile-direction-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background-color: #f1f5f9;
  transition: all 0.3s ease;
  margin-top: 1.5rem;
  cursor: pointer;
}

.dark #mobile-direction-toggle {
  background-color: #1e293b;
}

#mobile-direction-toggle:hover {
  background-color: #e2e8f0;
}

.dark #mobile-direction-toggle:hover {
  background-color: #334155;
}

#mobile-direction-icon {
  font-size: 1.5rem;
  margin-right: 0.5rem;
}
