/* ============================================
   COMPREHENSIVE RESPONSIVE STYLES
   Mobile-first approach with breakpoints for all devices
   ============================================ */

/* ============================================
   BASE RESPONSIVE UTILITIES
   ============================================ */

/* Ensure all images are responsive by default */
img {
  max-width: 100%;
  height: auto;
}

/* Responsive container adjustments */
@media (max-width: 1440px) {
  .container {
    max-width: 1200px;
    padding: 0 32px;
  }
}

@media (max-width: 1200px) {
  .container {
    max-width: 100%;
    padding: 0 24px;
  }
}

/* ============================================
   TABLET LANDSCAPE: 769px - 1024px
   ============================================ */
@media (max-width: 1024px) {
  /* Navigation adjustments */
  .navbar .container {
    gap: 20px;
  }
  
  .main-nav a {
    font-size: 0.9rem;
    padding: 8px 12px;
  }
  
  /* Hero section */
  .hero h1 {
    font-size: 3rem;
    line-height: 1.2;
  }
  
  .hero p {
    font-size: 1.125rem;
  }
  
  /* Grids - 2 columns */
  .seva-grid,
  .seva-cards-grid,
  .events-grid,
  .membership-plans,
  .membership-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }
  
  /* About section */
  .about {
    gap: 32px;
  }
  
  .about-img {
    max-height: 400px;
  }
}

/* ============================================
   TABLET PORTRAIT: 481px - 768px
   ============================================ */
@media (max-width: 768px) {
  /* Typography scaling */
  html {
    font-size: 15px;
  }
  
  h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  h2 {
    font-size: 1.75rem;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 1.25rem;
  }
  
  /* Container padding */
  .container {
    padding: 0 20px;
  }
  
  /* ========== HEADER/NAVIGATION ========== */
  .navbar {
    padding: 12px 0;
  }
  
  .navbar .container {
    flex-wrap: wrap;
    gap: 12px;
  }
  
  .logo {
    gap: 10px;
  }
  
  .logo img {
    width: 40px;
    height: 40px;
  }
  
  .logo h2 {
    font-size: 1.125rem;
  }
  
  .logo p {
    font-size: 0.75rem;
  }
  
  .mobile-menu-toggle {
    display: flex;
    order: 2;
  }
  
  .main-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 4;
    background: white;
    padding: 16px 0;
    gap: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-top: 12px;
    border-radius: 8px;
  }
  
  .main-nav.active {
    display: flex;
  }
  
  .main-nav a {
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
  }
  
  .main-nav a:last-child {
    border-bottom: none;
  }
  
  .donate-btn {
    order: 3;
    padding: 8px 16px;
    font-size: 0.875rem;
  }
  
  /* ========== HERO SECTION ========== */
  .hero {
    padding: 80px 0 60px;
    min-height: auto;
  }
  
  .hero h1 {
    font-size: 2.5rem;
  }
  
  .hero p {
    font-size: 1rem;
    margin-bottom: 28px;
  }
  
  .hero-btns {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }
  
  .hero-btns .btn {
    width: 100%;
    padding: 14px 24px;
  }
  
  /* ========== SECTIONS ========== */
  .section {
    padding: 50px 0;
  }
  
  /* About section */
  .about {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .about .left,
  .about .right {
    text-align: center;
  }
  
  /* ========== GRIDS ========== */
  .seva-grid,
  .seva-cards-grid,
  .events-grid,
  .membership-plans,
  .membership-cards-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  /* ========== FORMS ========== */
  .form-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  label {
    font-size: 0.9rem;
  }
  
  input, select, textarea {
    font-size: 1rem;
    padding: 12px 14px;
  }
  
  /* Membership forms */
  .membership-form-section {
    padding: 32px 20px;
  }
  
  .membership-form-header {
    padding: 24px 20px;
  }
  
  .membership-form-header h2 {
    font-size: 1.5rem;
  }
  
  /* ========== CARDS ========== */
  .card {
    padding: 24px;
  }
  
  .plan-card {
    padding: 32px 24px;
  }
  
  /* ========== QUICK DONATE ========== */
  .quick-donate {
    padding: 50px 20px;
  }
  
  .quick-donate-card {
    padding: 32px 24px;
  }
  
  .quick-donate-card h2 {
    font-size: 1.75rem;
  }
  
  .quick-donate-form {
    flex-direction: column;
    gap: 12px;
  }
  
  .quick-donate-form .custom-amount,
  .quick-donate-form .btn {
    width: 100%;
    max-width: 100%;
  }
  
  /* ========== FOOTER ========== */
  .footer {
    padding: 40px 0 20px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer h3 {
    font-size: 1.125rem;
  }
  
  /* ========== MODALS ========== */
  .registration-modal-content,
  .modal-content {
    max-width: 95%;
    max-height: 90vh;
    margin: 20px;
  }
  
  .registration-modal-header,
  .modal-header {
    padding: 20px;
  }
  
  .registration-form-section,
  .modal-body {
    padding: 20px;
  }
  
  /* ========== DASHBOARDS ========== */
  .dashboard-container {
    padding: 20px;
  }
  
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .dashboard-stats {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .applications-grid {
    grid-template-columns: 1fr;
  }
  
  /* ========== TABLES ========== */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  /* ========== BUTTONS ========== */
  .btn {
    padding: 12px 24px;
    font-size: 1rem;
  }
  
  .form-actions {
    flex-direction: column-reverse;
    gap: 12px;
  }
  
  .form-actions .btn {
    width: 100%;
  }
}

/* ============================================
   MOBILE LANDSCAPE: 481px - 640px
   ============================================ */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 2.25rem;
  }
  
  /* 2-column grid for cards on mobile landscape */
  .seva-grid,
  .seva-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .seva-icon {
    font-size: 2rem;
  }
}

/* ============================================
   MOBILE PORTRAIT: 320px - 480px
   ============================================ */
@media (max-width: 480px) {
  /* Typography */
  html {
    font-size: 14px;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.125rem;
  }
  
  p {
    font-size: 0.95rem;
  }
  
  /* Container */
  .container {
    padding: 0 16px;
  }
  
  /* Hero */
  .hero {
    padding: 60px 0 40px;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 0.95rem;
  }
  
  /* Logo */
  .logo h2 {
    font-size: 1rem;
  }
  
  .logo p {
    font-size: 0.7rem;
  }
  
  /* Buttons */
  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
  
  .donate-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }
  
  /* Sections */
  .section {
    padding: 40px 0;
  }
  
  /* Cards */
  .card {
    padding: 20px;
  }
  
  .seva-icon {
    font-size: 1.75rem;
  }
  
  /* Forms */
  input, select, textarea {
    padding: 10px 12px;
    font-size: 0.95rem;
  }
  
  label {
    font-size: 0.85rem;
  }
  
  /* Quick donate */
  .quick-donate-card {
    padding: 28px 20px;
  }
  
  .quick-donate-card h2 {
    font-size: 1.5rem;
  }
  
  /* Event cards */
  .event-card img {
    height: 180px;
  }
  
  /* Membership cards */
  .plan-price {
    font-size: 2rem;
  }
  
  /* Gallery grid - keep 2 columns */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  /* Amount buttons stack */
  .amount-grid {
    grid-template-columns: 1fr;
  }
  
  /* Dashboard stats */
  .stat-card {
    padding: 20px;
  }
  
  .stat-value {
    font-size: 1.75rem;
  }
  
  /* Modal full screen on small mobile */
  .modal-content,
  .registration-modal-content {
    max-width: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
}

/* ============================================
   EXTRA SMALL MOBILE: 320px and below
   ============================================ */
@media (max-width: 360px) {
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .logo img {
    width: 36px;
    height: 36px;
  }
  
  .logo h2 {
    font-size: 0.95rem;
  }
  
  /* Stack everything */
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .seva-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   RESPONSIVE UTILITY CLASSES
   ============================================ */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  .text-center-mobile {
    text-align: center !important;
  }
  
  .flex-column-mobile {
    flex-direction: column !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
  
  .show-desktop {
    display: block !important;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets for mobile */
  a, button, .btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .card:hover,
  .btn:hover {
    transform: none;
  }
}

/* ============================================
   LANDSCAPE ORIENTATION SPECIFIC
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 40px 0 30px;
    min-height: auto;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .modal-content,
  .registration-modal-content {
    max-height: 95vh;
    overflow-y: auto;
  }
}

/* ============================================
   HIGH RESOLUTION DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders and shadows */
  .card,
  .btn,
  input,
  select {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  header,
  footer,
  .donate-btn,
  .btn,
  .mobile-menu-toggle {
    display: none !important;
  }
  
  .container {
    max-width: 100%;
    padding: 0;
  }
  
  a {
    text-decoration: underline;
  }
  
  .card,
  .section {
    page-break-inside: avoid;
  }
}
