/* 📖 ATASÖZÜ STORIES - Ana Sayfa Slider */

:root {
  --story-primary: #4ECDC4;
  --story-secondary: #FF6B9D;
  --story-accent: #FFD93D;
  --story-bg: rgba(255,255,255,0.95);
  --story-shadow: 0 8px 25px rgba(0,0,0,0.2);
  --story-border-radius: 20px;
  --story-transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stories Container */
.stories-container {
  width: 100%;
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
  position: sticky;
  top: 20px;
  z-index: 10;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
  border-radius: 25px;
  padding: 25px;
  margin: 20px auto;
  /* Touch event'leri container'da handle et */
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* Container'ı scroll isolation yap */
  isolation: isolate;
  overflow: hidden;
}

.stories-header {
  text-align: center;
  margin-bottom: 25px;
}

.stories-title {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 8px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.stories-subtitle {
  font-size: 1rem;
  color: var(--light-text);
  font-style: italic;
}

.stories-subtitle i {
  color: var(--story-accent);
  margin-right: 5px;
}

/* Stories Slider */
.stories-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--story-border-radius);
  background: var(--story-bg);
  backdrop-filter: blur(10px);
  box-shadow: var(--story-shadow);
  padding: 0px;
  /* Scroll containment - slider içindeki scroll ana sayfayı etkilemesin */
  contain: layout style paint;
  /* Touch boundary oluştur - SADECE yatay pan */
  touch-action: pan-x;
  /* Overscroll behavior - kesinlikle contain */
  overscroll-behavior: contain;
  /* Isolation'ı güçlendir */
  isolation: isolate;
  /* Z-index ile layering */
  z-index: 1;
}

.stories-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  padding: 10px 0;
  -webkit-overflow-scrolling: touch;
  /* Sayfa scroll'unu etkilemesin diye */
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  /* Scroll momentum */
  scroll-snap-stop: always;
  /* Performance için */
  will-change: scroll-position;
}

.stories-track::-webkit-scrollbar {
  display: none;
}

.story-card {
  min-width: 280px;
  max-width: 320px;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: var(--story-transition);
  scroll-snap-align: center;
  cursor: pointer;
  position: relative;
}

.story-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.story-card.seen {
  opacity: 0.7;
  filter: grayscale(30%);
}

.story-card.seen:hover {
  opacity: 1;
  filter: grayscale(0%);
}

/* Story Content */
.story-header {
  background: linear-gradient(135deg, var(--story-primary), var(--story-secondary));
  padding: 15px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.story-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.story-type {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(5px);
}

.story-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: white;
  margin: 10px 0 5px 0;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  line-height: 1.3;
}

.story-subtitle {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
  font-style: italic;
  margin-top: 5px;
}

.story-body {
  padding: 20px 15px;
  background: white;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.story-meaning {
  font-size: 1rem;
  color: var(--dark-text);
  line-height: 1.5;
  margin-bottom: 15px;
  font-weight: 500;
}

.story-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid #eee;
}

.story-date {
  font-size: 0.8rem;
  color: var(--light-text);
  display: flex;
  align-items: center;
  gap: 5px;
}

.story-date i {
  color: var(--story-accent);
}

.story-action {
  background: linear-gradient(135deg, var(--story-primary), var(--story-secondary));
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  transition: var(--story-transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.story-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

/* Progress Indicators */
.stories-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 0 20px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(78, 205, 196, 0.3);
  transition: var(--story-transition);
  cursor: pointer;
}

.progress-dot.active {
  background: var(--story-primary);
  transform: scale(1.4);
}

.progress-dot.seen {
  background: var(--story-secondary);
}

/* Navigation Buttons */
.stories-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.9);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--story-transition);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 10;
  backdrop-filter: blur(5px);
}

.stories-nav:hover {
  background: white;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.stories-nav.prev {
  left: 10px;
}

.stories-nav.next {
  right: 10px;
}

.stories-nav i {
  color: var(--story-primary);
  font-size: 1.2rem;
}

/* Loading Animation */
.story-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  font-size: 1.2rem;
  color: var(--light-text);
}

.story-loading i {
  animation: spin 2s linear infinite;
  margin-right: 10px;
  color: var(--story-accent);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Empty State */
.stories-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--light-text);
}

.stories-empty i {
  font-size: 3rem;
  color: var(--story-accent);
  margin-bottom: 15px;
  display: block;
}

.stories-empty h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: var(--dark-text);
}

.stories-empty p {
  font-size: 1rem;
  line-height: 1.5;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .stories-container {
    padding: 0 15px;
  }

  .stories-title {
    font-size: 1.5rem;
  }

  .stories-subtitle {
    font-size: 0.9rem;
  }

  .story-card {
    min-width: 250px;
    max-width: 280px;
  }

  .story-title {
    font-size: 1.2rem;
  }

  .story-meaning {
    font-size: 0.9rem;
  }

  .stories-nav {
    width: 35px;
    height: 35px;
  }

  .stories-nav i {
    font-size: 1rem;
  }
}

/* Accessibility */
.story-card:focus {
  outline: 2px solid var(--story-primary);
  outline-offset: 2px;
}

.stories-nav:focus {
  outline: 2px solid var(--story-primary);
  outline-offset: 2px;
}

/* Notification Animations */
@keyframes slideInNotification {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutNotification {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .stories-slider {
    background: rgba(0,0,0,0.1);
  }

  .story-card {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
  }

  .story-body {
    background: rgba(255,255,255,0.05);
  }

  .story-meaning {
    color: rgba(255,255,255,0.9);
  }
}

/* Print Styles */
@media print {
  .stories-container {
    display: none;
  }
}

/* Story Modal */
.story-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
  animation: fadeInModal 0.3s ease;
}

.story-modal-content {
  background: white;
  border-radius: var(--story-border-radius);
  max-width: 400px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: slideInModal 0.3s ease;
  position: relative;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInModal {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.story-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--light-text);
  cursor: pointer;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--story-transition);
  z-index: 10;
}

.story-modal-close:hover {
  background: rgba(0,0,0,0.1);
  color: var(--dark-text);
}

.story-modal-header {
  background: linear-gradient(135deg, var(--story-primary), var(--story-secondary));
  color: white;
  padding: 25px 20px 20px 20px;
  text-align: center;
  border-radius: var(--story-border-radius) var(--story-border-radius) 0 0;
}

.story-modal-header h3 {
  font-size: 1.3rem;
  margin: 0 0 10px 0;
  line-height: 1.3;
}

.story-modal-type {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  backdrop-filter: blur(5px);
}

.story-modal-body {
  padding: 25px 20px;
}

.story-modal-meaning {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--dark-text);
  margin-bottom: 25px;
}

.story-modal-actions {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

.story-modal-search,
.story-modal-share {
  padding: 12px 20px;
  border: none;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
  transition: var(--story-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.story-modal-search {
  background: linear-gradient(135deg, var(--story-primary), var(--story-secondary));
  color: white;
}

.story-modal-search:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

.story-modal-share {
  background: #25D366;
  color: white;
}

.story-modal-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4);
}

/* Mobile Modal */
@media (max-width: 768px) {
  .story-modal-content {
    width: 95%;
    max-width: none;
    margin: 20px;
  }

  .story-modal-header {
    padding: 20px 15px 15px 15px;
  }

  .story-modal-header h3 {
    font-size: 1.1rem;
  }

  .story-modal-body {
    padding: 20px 15px;
  }
}
