/* Responsive Design Styles */

/* Enhanced Mobile Navigation */
.mobile-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.mobile-nav.active {
  display: flex;
  opacity: 1;
}

.mobile-nav-content {
  background: var(--card);
  width: 100%;
  max-width: 320px;
  height: 100%;
  position: relative;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.mobile-nav.active .mobile-nav-content {
  transform: translateX(0);
}

.mobile-nav-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary);
  color: var(--primary-foreground);
}

.mobile-nav-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition);
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-nav-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-nav-links {
  padding: 1rem 0;
  flex: 1;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: var(--foreground);
  text-decoration: none;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  font-weight: var(--font-weight-medium);
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  background: var(--muted);
  color: var(--primary);
}

.mobile-nav-link i {
  margin-right: 0.75rem;
  font-size: 1.125rem;
  min-width: 20px;
}

/* Mobile Toggle Button */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--foreground);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}

.mobile-toggle:hover {
  background: var(--muted);
}

.mobile-toggle.active {
  color: var(--primary);
}

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
    padding: 0 2rem;
  }
  
  .hero-title {
    font-size: 4rem;
  }
  
  .section-title {
    font-size: 3rem;
  }
  
  .grid-responsive-lg {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktop (1024px to 1199px) */
@media (max-width: 1199px) {
  .popular-posts-grid {
    grid-template-columns: 1fr;
  }
  
  .popular-posts-sidebar {
    flex-direction: row;
    overflow-x: auto;
    gap: 1.5rem;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
  }
  
  .sidebar-post {
    min-width: 300px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }
  
  .grid-responsive-lg {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet (768px to 1023px) */
@media (max-width: 1023px) {
  /* Layout adjustments */
  .hero-section {
    padding: 6rem 0 4rem;
  }
  
  .section {
    padding: 4rem 1rem;
  }
  
  /* Typography scaling */
  .hero-title {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  
  .section-title {
    font-size: 2rem;
    line-height: 1.3;
  }
  
  .section-subtitle {
    font-size: 1rem;
  }
  
  /* Grid layouts */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  
  .books-grid,
  .posts-grid,
  .opportunities-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  .grid-responsive-lg {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Component specific */
  .hero-actions {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  
  .hero-actions .btn {
    width: 100%;
    max-width: 300px;
  }
  
  .video-thumbnail-wrapper {
    height: 350px;
  }
  
  .video-play-button {
    width: 70px;
    height: 70px;
    font-size: 1.75rem;
  }
  
  /* Card adjustments */
  .card-content {
    padding: 1.5rem;
  }
}

/* Mobile Navigation Breakpoint */
@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
  }
  
  .nav-menu {
    display: none;
  }
  
  .nav-actions .search-toggle,
  .nav-actions .prayer-toggle {
    display: none;
  }
  
  .header-search {
    max-width: none;
    margin-right: 1rem;
  }
  
  /* Header adjustments */
  .header {
    padding: 1rem 0;
  }
  
  .header-content {
    gap: 1rem;
  }
  
  .header-logo {
    font-size: 1.25rem;
  }
}

/* Mobile Large (481px to 767px) */
@media (max-width: 767px) {
  /* Spacing adjustments */
  .section {
    padding: 3rem 1rem;
  }
  
  .hero-section {
    padding: 4rem 0 3rem;
  }
  
  /* Typography */
  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .section-title {
    font-size: 1.75rem;
    line-height: 1.3;
  }
  
  .section-subtitle {
    font-size: 0.95rem;
  }
  
  /* Layout changes */
  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .about-stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .posts-grid,
  .books-grid {
    grid-template-columns: 1fr;
  }
  
  .grid-responsive-lg {
    grid-template-columns: 1fr;
  }
  
  /* Card adjustments */
  .card-content,
  .book-content,
  .post-content {
    padding: 1.5rem;
  }
  
  /* Video adjustments */
  .video-thumbnail-wrapper {
    height: 300px;
  }
  
  .video-play-button {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  /* Button adjustments */
  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  /* Form adjustments */
  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .form-actions .btn {
    width: 100%;
  }
}

/* Mobile Small (320px to 480px) */
@media (max-width: 480px) {
  /* Minimal spacing */
  .section {
    padding: 2.5rem 1rem;
  }
  
  .hero-section {
    padding: 3rem 0 2rem;
  }
  
  .container {
    padding: 0 0.75rem;
  }
  
  /* Typography scaling */
  .hero-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  
  .section-title {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  .section-subtitle {
    font-size: 0.9rem;
  }
  
  /* Button and form adjustments */
  .btn {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }
  
  .btn-sm {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }
  
  .hero-actions .btn {
    margin-bottom: 0.5rem;
  }
  
  /* Modal adjustments */
  .modal {
    padding: 0.5rem;
  }
  
  .modal-content {
    width: 100%;
    max-height: 95vh;
  }
  
  .modal-header,
  .modal-body {
    padding: 1rem;
  }
  
  /* Footer adjustments */
  .footer-bottom-content {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .footer-bottom-links {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  /* Card content */
  .card-content {
    padding: 1rem;
  }
  
  /* Toast notifications */
  .toast-container {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
  }
  
  /* Mobile nav adjustments */
  .mobile-nav-content {
    max-width: 100%;
  }
  
  .mobile-nav-link {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }
  
  /* Grid spacing */
  .grid {
    gap: 1rem;
  }
  
  /* Video responsive */
  .video-thumbnail-wrapper {
    height: 250px;
  }
  
  .video-play-button {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
}

/* Extra Small Mobile (under 320px) */
@media (max-width: 319px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .section {
    padding: 2rem 0.5rem;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .section-title {
    font-size: 1.25rem;
  }
  
  .btn {
    padding: 0.75rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .modal-header,
  .modal-body {
    padding: 0.75rem;
  }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    padding: 2rem 0 1.5rem;
  }
  
  .section {
    padding: 2rem 1rem;
  }
  
  .modal-content {
    max-height: 80vh;
  }
  
  .video-thumbnail-wrapper {
    height: 200px;
  }
}

/* Print styles */
@media print {
  .header,
  .footer,
  .modal,
  .toast-container,
  .loading-screen,
  .mobile-nav,
  .mobile-toggle {
    display: none !important;
  }
  
  .section {
    padding: 1rem 0;
    break-inside: avoid;
  }
  
  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  * {
    color: #000 !important;
    background: #fff !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .card {
    border-width: 2px;
  }
  
  .btn {
    border-width: 2px;
  }
  
  .badge {
    border: 1px solid currentColor;
  }
  
  .mobile-nav-link {
    border-bottom-width: 2px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .video-thumbnail-wrapper:hover .video-thumbnail,
  .card:hover,
  .book-card:hover .book-image,
  .post-card:hover .post-image {
    transform: none;
  }
  
  .mobile-nav-content {
    transition: none;
  }
  
  .mobile-nav {
    transition: none;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .card:hover,
  .mobile-nav-link:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  
  /* Increase touch targets */
  .btn {
    min-height: 48px;
    padding: 1rem 1.5rem;
  }
  
  .mobile-nav-link {
    min-height: 64px;
    padding: 1.25rem 1.5rem;
  }
  
  .mobile-toggle,
  .modal-close {
    min-height: 48px;
    min-width: 48px;
  }
}

/* Dark mode preferences */
@media (prefers-color-scheme: dark) {
  .loading-screen {
    background: var(--background);
  }
}

/* Focus improvements for keyboard navigation */
@media (hover: none) {
  *:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
  }
}