/* Custom styles for English Learning App */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  text-align: right;
}

.ltr {
  direction: ltr;
  text-align: left;
}

/* Story Card Animations */
.story-card {
  transition: all 0.3s ease;
  transform: scale(1);
}

.story-card:hover {
  transform: scale(1.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.story-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.story-card.completed::after {
  content: '✅';
  position: absolute;
  top: -8px;
  right: -8px;
  background: #10b981;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Tooltip Styles */
.tooltip {
  position: relative;
  cursor: pointer;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  background-color: #1f2937;
  color: white;
  text-align: center;
  border-radius: 8px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  transition: opacity 0.3s;
  font-size: 14px;
  white-space: nowrap;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

/* Progress Bar */
.progress-bar {
  background: linear-gradient(90deg, #0ea5e9 0%, #0369a1 100%);
  height: 8px;
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Animated Background */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
  100% { transform: translateY(0px); }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.7);
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .story-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .card-bg {
    background: rgba(15, 23, 42, 0.8);
  }
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Word highlight effect */
.word-highlight {
  background: linear-gradient(120deg, #a8edea 0%, #fed6e3 100%);
  padding: 2px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.word-highlight:hover {
  background: linear-gradient(120deg, #fed6e3 0%, #a8edea 100%);
  transform: scale(1.05);
}

/* Sidebar animations and enhanced responsive design */
.sidebar-item {
  transition: all 0.2s ease;
}

.sidebar-item:hover {
  background: rgba(59, 130, 246, 0.2);
  padding-right: 1.5rem;
}

/* Enhanced sidebar behavior */
.sidebar {
  transition: transform 0.3s ease-in-out;
}

/* Desktop sidebar toggle */
@media (min-width: 1024px) {
  .sidebar {
    position: static;
    transform: translateX(0);
  }
  
  .sidebar.desktop-hidden {
    transform: translateX(100%);
    position: fixed !important;
    right: 0;
    top: 70px;
    z-index: 50;
    box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.1);
  }
  
  .main-content {
    transition: margin-right 0.3s ease-in-out;
  }
}

/* Mobile sidebar behavior */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 70px;
    right: 0;
    height: calc(100vh - 70px);
    z-index: 50;
    box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
  }
  
  .main-content {
    margin-right: 0 !important;
    width: 100%;
  }
}

/* Button hover effects */
.btn-primary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}