/* Responsive Styles for Reziyon PWA */
/* Comprehensive responsive design for all devices: Mobile, Tablet, Laptop, Desktop, TV */

/* ===== DEVICE-SPECIFIC BREAKPOINTS ===== */
/* Mobile: 320px - 767px */
/* Tablet: 768px - 1024px */
/* Laptop: 1025px - 1440px */
/* Desktop: 1441px - 1920px */
/* Large TV/4K: 1921px+ */

/* Base responsive container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Flexible grid system */
.responsive-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ===== LARGE TV AND 4K DISPLAYS (1921px+) ===== */
@media (min-width: 1921px) {
  .container {
    max-width: 1800px;
    padding: 0 3rem;
  }
  
  .nav-container {
    max-width: 1800px;
    padding: 0 3rem;
  }
  
  .hero-text h1 {
    font-size: 5rem;
    line-height: 1.1;
  }
  
  .hero-text p {
    font-size: 1.5rem;
  }
  
  .section-header h2 {
    font-size: 3.5rem;
  }
  
  .features-grid,
  .user-types-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 3rem;
  }
  
  .feature-card,
  .user-type-card {
    padding: 3rem;
  }
  
  .feature-icon,
  .user-type-icon {
    width: 120px;
    height: 120px;
  }
  
  .feature-icon i {
    font-size: 3rem;
  }
  
  .user-type-icon i {
    font-size: 3.5rem;
  }
  
  .btn-large {
    padding: 1.5rem 3rem;
    font-size: 1.3rem;
  }
}

/* ===== DESKTOP DISPLAYS (1441px - 1920px) ===== */
@media (min-width: 1441px) and (max-width: 1920px) {
  .container {
    max-width: 1400px;
    padding: 0 2rem;
  }
  
  .nav-container {
    max-width: 1400px;
    padding: 0 2rem;
  }
  
  .hero-text h1 {
    font-size: 4rem;
  }
  
  .hero-text p {
    font-size: 1.3rem;
  }
  
  .section-header h2 {
    font-size: 3rem;
  }
  
  .features-grid,
  .user-types-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

/* ===== LAPTOP DISPLAYS (1025px - 1440px) ===== */
@media (min-width: 1025px) and (max-width: 1440px) {
  .container {
    max-width: 1200px;
    padding: 0 2rem;
  }
  
  .nav-container {
    padding: 0 2rem;
  }
  
  .hero-content {
    gap: 3rem;
  }
  
  .hero-text h1 {
    font-size: 3.5rem;
  }
  
  .features-grid,
  .user-types-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
  }
}

/* ===== TABLET STYLES (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
  .nav-container {
    padding: 0 1.5rem;
  }
  
  .hero-content {
    gap: 3rem;
  }
  
  .hero-text h1 {
    font-size: 3rem;
  }
  
  .features-grid,
  .user-types-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  .container {
    padding: 0 1.5rem;
  }
}

/* ===== TABLET PORTRAIT AND SMALL LAPTOP (768px - 1024px) ===== */
@media (max-width: 1024px) and (min-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  
  .hero-card {
    max-width: 500px;
    margin: 0 auto;
  }
  
  .features-grid,
  .user-types-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* ===== MOBILE AND SMALL TABLET (320px - 767px) ===== */
@media (max-width: 767px) {
  /* Navigation */
  .nav-menu {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: white;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 2rem;
    transition: var(--transition);
    box-shadow: var(--shadow-medium);
  }
  
  .nav-menu.active {
    left: 0;
  }
  
  .nav-menu .nav-link {
    padding: 1rem 0;
    font-size: 1.1rem;
  }
  
  .nav-auth {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
  }
  
  .nav-toggle {
    display: flex;
  }
  
  .nav-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }
  
  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }
  
  /* Hero Section */
  .hero {
    padding: 5rem 1rem 2rem;
    min-height: auto;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  .hero-text h1 {
    font-size: 2.5rem;
  }
  
  .hero-text p {
    font-size: 1.1rem;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .hero-card {
    max-width: 100%;
    padding: 1.5rem;
  }
  
  /* Sections */
  .container {
    padding: 0 1rem;
  }
  
  .section-header h2 {
    font-size: 2rem;
  }
  
  .features,
  .user-types {
    padding: 3rem 0;
  }
  
  .features-grid,
  .user-types-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .feature-card,
  .user-type-card {
    padding: 2rem;
  }
  
  /* Enhanced Modal Responsiveness */
  .modal {
    padding: 1rem;
    overflow-y: auto;
  }
  
  .modal-content {
    width: 95%;
    margin: 2rem auto;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  
  .modal-header {
    padding: 1.5rem 1.5rem 1rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
  }
  
  .form {
    padding: 1rem 1.5rem 1.5rem;
    flex: 1;
    overflow-y: auto;
  }
  
  .form-group {
    margin-bottom: 1.25rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.875rem;
    font-size: 1rem;
    min-height: 44px;
  }
  
  .btn-full {
    margin-top: 1rem;
    padding: 1rem;
    font-size: 1.1rem;
    min-height: 48px;
  }
  
  /* Buttons */
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .btn-large {
    width: 100%;
    max-width: 300px;
  }
}

/* ===== SMALL MOBILE DEVICES (320px - 480px) ===== */
@media (max-width: 480px) {
  .nav-container {
    padding: 0 1rem;
  }
  
  .nav-brand {
    font-size: 1.3rem;
  }
  
  .hero {
    padding: 4rem 0.5rem 2rem;
  }
  
  .hero-text h1 {
    font-size: 2rem;
  }
  
  .hero-text p {
    font-size: 1rem;
  }
  
  .hero-card {
    padding: 1rem;
  }
  
  .current-time {
    font-size: 1.2rem;
    padding: 0.75rem;
  }
  
  .next-prayer {
    padding: 0.75rem;
  }
  
  .next-prayer .prayer-name {
    font-size: 1.1rem;
  }
  
  .prayer-item {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .section-header h2 {
    font-size: 1.8rem;
  }
  
  .section-header p {
    font-size: 1rem;
  }
  
  .feature-card,
  .user-type-card {
    padding: 1.5rem;
  }
  
  .feature-icon,
  .user-type-icon {
    width: 60px;
    height: 60px;
  }
  
  .feature-icon i {
    font-size: 1.5rem;
  }
  
  .user-type-icon i {
    font-size: 2rem;
  }
  
  .modal {
    padding: 0.5rem;
  }
  
  .modal-content {
    margin: 1rem auto;
    width: 98%;
    max-height: calc(100vh - 2rem);
    border-radius: 8px;
  }
  
  .modal-header {
    padding: 1rem;
  }
  
  .modal-header h2 {
    font-size: 1.3rem;
  }
  
  .form {
    padding: 0.5rem 1rem 1rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.75rem;
    font-size: 1rem;
    min-height: 44px;
  }
  
  .btn-full {
    padding: 1rem;
    font-size: 1rem;
    min-height: 48px;
    position: sticky;
    bottom: 0;
    background: var(--primary-color);
    margin-top: 1.5rem;
  }
  
  /* Masjid fields responsive */
  #masjidFields {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
  }
  
  #masjidFields .form-group:first-child {
    margin-top: 0.5rem;
  }
}

/* ===== MODAL LANDSCAPE OPTIMIZATIONS ===== */
@media (orientation: landscape) and (max-height: 600px) {
  .modal {
    padding: 0.25rem;
  }
  
  .modal-content {
    margin: 0.5rem auto;
    max-height: calc(100vh - 1rem);
    width: 95%;
    max-width: 600px;
  }
  
  .modal-header {
    padding: 0.75rem 1rem 0.5rem;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
  
  .form {
    padding: 0.5rem 1rem;
    max-height: calc(100vh - 4rem);
  }
  
  .form-group {
    margin-bottom: 0.75rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.6rem;
  }
  
  .btn-full {
    padding: 0.75rem;
    margin-top: 1rem;
  }
}

/* ===== GENERAL LANDSCAPE ORIENTATION OPTIMIZATIONS ===== */
@media (orientation: landscape) and (max-height: 500px) {
  .hero {
    min-height: auto;
    padding: 2rem 1rem;
  }
  
  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  
  .hero-text h1 {
    font-size: 2rem;
  }
  
  .nav-menu {
    height: calc(100vh - 60px);
  }
}

/* ===== ULTRA-WIDE DISPLAYS (21:9 aspect ratio) ===== */
@media (min-aspect-ratio: 21/9) {
  .hero-content {
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
  }
  
  .features-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* ===== FOLDABLE AND DUAL SCREEN DEVICES ===== */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .hero-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== HIGH DPI DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-card,
  .feature-card,
  .user-type-card {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  }
  
  .btn {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  }
}

/* Footer Responsive */
@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }
  
  .footer-right {
    justify-content: center;
  }
  
  .footer-links {
    justify-content: center;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .footer {
    padding: 1.5rem 0 1rem;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 1rem;
  }
  
  .footer-brand {
    font-size: 1.3rem;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .nav-toggle,
  .hero-buttons,
  .btn,
  .modal {
    display: none !important;
  }
  
  .hero {
    min-height: auto;
    padding: 2rem 0;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .section-header h2 {
    font-size: 18pt;
    margin-bottom: 1rem;
  }
  
  .feature-card,
  .user-type-card {
    break-inside: avoid;
    margin-bottom: 1rem;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000000;
    --text-primary: #000000;
    --text-secondary: #333333;
    --background: #ffffff;
    --border-color: #000000;
  }
  
  .btn-outline {
    border-width: 3px;
  }
  
  .feature-card,
  .user-type-card {
    border: 2px solid var(--border-color);
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #E1E8ED;
    --text-secondary: #8899A6;
    --text-light: #657786;
    --background: #15202B;
    --background-light: #192734;
    --background-dark: #0F1419;
    --border-color: #38444D;
  }
  
  .navbar {
    background: rgba(21, 32, 43, 0.95);
  }
  
  .hero {
    background: linear-gradient(135deg, #192734 0%, #15202B 100%);
  }
  
  .hero-card,
  .feature-card,
  .user-type-card,
  .modal-content {
    background: var(--background-light);
    border: 1px solid var(--border-color);
  }
  
  .loading-screen {
    background: linear-gradient(135deg, var(--background-dark), var(--background));
  }
}
