/**
 * Africa Surveys - Responsive Styles
 * Enhanced responsive design for optimal viewing across all devices
 */

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  /* Larger text on very large screens */
  .hero-content h1 {
    font-size: 3rem;
  }
  
  /* Enhanced grid for large screens */
  .services-grid,
  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Wider content areas */
  .form-container {
    max-width: 900px;
    margin: 0 auto;
  }
}

/* Large Devices (desktops, 992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  .container {
    max-width: 960px;
  }
  
  /* Adjusted grid for large screens */
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Medium Devices (tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .container {
    max-width: 720px;
  }
  
  /* Header adjustments */
  .logo-img {
    height: 35px;
  }
  
  header nav ul li {
    margin: 0 var(--spacing-xs);
  }
  
  header nav ul li a {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.9rem;
  }
  
  /* Section adjustments */
  .section {
    padding: 60px 0;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  /* Grid adjustments */
  .services-grid,
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Hero adjustments */
  .hero-slider {
    height: 500px;
  }
  
  .hero-content h1 {
    font-size: 2.25rem;
  }
  
  .hero-content p {
    font-size: 1.1rem;
  }
  
  /* Footer adjustments */
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
  
  .footer-menus {
    grid-column: span 2;
    margin-top: 30px;
  }
}

/* Small Devices (landscape phones, 576px to 767px) */
@media (min-width: 576px) and (max-width: 767px) {
  .container {
    max-width: 540px;
  }
  
  /* Header adjustments */
  header {
    height: 70px;
  }
  
  .logo-img {
    height: 30px;
  }
  
  /* Mobile navigation */
  .mobile-toggle {
    display: block;
  }
  
  header nav {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-index-dropdown);
  }
  
  :root.dark-mode header nav {
    background-color: var(--neutral-200);
  }
  
  header nav.active {
    height: auto;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
  
  header nav ul {
    flex-direction: column;
    width: 100%;
    padding: 0.75rem 0;
    gap: 0.3rem;
  }
  
  header nav ul li {
    width: 100%;
    margin: 0;
  }
  
  header nav ul li a {
    padding: 1rem 1.5rem;
    width: 100%;
    border-radius: 0;
    font-size: 1.05rem;
  }
  
  /* Special "Become a Panelist" button for mobile */
  header nav ul li:nth-last-child(2) {
    padding: 0.75rem 1.25rem;
  }
  
  header nav ul li:nth-last-child(2) a {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ff7e54 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    padding: 1rem;
    margin: 0.5rem 0;
    box-shadow: 0 4px 12px rgba(255, 90, 95, 0.2);
  }
  
  header nav ul li:nth-last-child(2) a:hover {
    background: linear-gradient(135deg, #ff4b50 0%, #ff6a40 100%);
  }
  
  /* Reset the after element for mobile */
  header nav ul li a::after {
    display: none;
  }
  
  /* Grid adjustments */
  .services-grid,
  .grid,
  .stats .grid,
  .testimonial-grid {
    grid-template-columns: 1fr;
  }
  
  /* Hero adjustments */
  .hero-slider {
    height: 450px;
    margin-top: 70px;
  }
  
  .hero-content {
    padding: var(--spacing-lg);
  }
  
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .hero-content p {
    font-size: 1rem;
  }
  
  .hero-btns {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
  
  /* Section adjustments */
  .section {
    padding: 50px 0;
  }
  
  .section-title {
    font-size: 1.75rem;
  }
  
  .section-subtitle {
    font-size: 1rem;
    margin-bottom: var(--spacing-lg);
  }
  
  /* Button adjustments */
  .btn {
    width: 100%;
  }
  
  /* Slider navigation */
  .slider-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .slider-btn.prev {
    left: var(--spacing-sm);
  }
  
  .slider-btn.next {
    right: var(--spacing-sm);
  }
  
  /* Footer adjustments */
  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
}

/* Extra Small Devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
  .container {
    width: 100%;
    padding: 0 var(--spacing-md);
  }
  
  /* Header adjustments */
  header {
    height: 60px;
  }
  
  .logo-img {
    height: 25px;
  }
  
  /* Mobile navigation - similar to small devices but with smaller dimensions */
  .mobile-toggle {
    display: block;
    font-size: 1.25rem;
  }
  
  header nav {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: 0;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-index-dropdown);
  }
  
  :root.dark-mode header nav {
    background-color: var(--neutral-200);
  }
  
  header nav.active {
    height: auto;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  
  header nav ul {
    flex-direction: column;
    width: 100%;
    padding: 0.5rem 0;
    gap: 0.2rem;
  }
  
  header nav ul li {
    width: 100%;
    margin: 0;
  }
  
  header nav ul li a {
    padding: 0.9rem 1.25rem;
    width: 100%;
    border-radius: 0;
    font-size: 1rem;
  }
  
  /* Special "Become a Panelist" button for mobile */
  header nav ul li:nth-last-child(2) {
    padding: 0.5rem 1rem;
  }
  
  header nav ul li:nth-last-child(2) a {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #ff7e54 100%);
    color: white;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    padding: 0.9rem;
    margin: 0.3rem 0;
    box-shadow: 0 4px 10px rgba(255, 90, 95, 0.2);
    font-size: 0.95rem;
  }
  
  /* Hero adjustments */
  .hero-slider {
    height: 400px;
    margin-top: 60px;
  }
  
  .hero-content {
    padding: var(--spacing-md);
    width: 100%;
  }
  
  .hero-content h1 {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-sm);
  }
  
  .hero-content p {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-md);
  }
  
  /* Slider controls */
  .slider-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  
  .slider-dots {
    bottom: var(--spacing-sm);
  }
  
  .dot {
    width: 8px;
    height: 8px;
  }
  
  /* Section adjustments */
  .section {
    padding: 40px 0;
  }
  
  .section-title {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
  }
  
  .section-subtitle {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-md);
  }
  
  /* Cards and grids */
  .services-grid,
  .grid,
  .stats .grid,
  .testimonial-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .service-card,
  .feature-card,
  .testimonial {
    padding: var(--spacing-md);
  }
  
  .service-icon,
  .feature-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
  }
  
  .service-card h3,
  .feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
  }
  
  /* Stats section */
  .stat-item {
    padding: var(--spacing-md);
  }
  
  .stat-number {
    font-size: 2.25rem;
  }
  
  .stat-label {
    font-size: 0.95rem;
  }
  
  /* Map overlay */
  .map-overlay h3 {
    font-size: 1.5rem;
  }
  
  .map-overlay p {
    font-size: 0.9rem;
  }
  
  /* FAQ section */
  .faq-question {
    padding: var(--spacing-md);
  }
  
  .faq-question h3 {
    font-size: 1rem;
  }
  
  .faq-answer p {
    padding: var(--spacing-md);
    font-size: 0.9rem;
  }
  
  /* Forms */
  .form-container {
    padding: var(--spacing-md);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-group label {
    font-size: 0.9rem;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
  }
  
  /* Footer */
  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
  
  .footer-menus {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }
  
  .footer-menu h4,
  .footer-contact h4 {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
  }
  
  .footer-menu ul li,
  .contact-info li {
    font-size: 0.9rem;
  }
  
  .newsletter-container p {
    font-size: 0.9rem;
  }
}

/* Landscape orientation for mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
  .hero-slider {
    height: 300px;
  }
  
  .hero-content {
    padding: var(--spacing-md);
  }
  
  .hero-content h1 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
  }
  
  .hero-content p {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
  }
  
  .hero-btns {
    gap: var(--spacing-xs);
  }
  
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  header nav.active {
    max-height: 80vh;
  }
}

/* High-DPI Screens */
@media (min-resolution: 192dpi), (-webkit-min-device-pixel-ratio: 2) {
  /* Optimize images for high-DPI displays */
  .logo-img,
  .service-icon img,
  .feature-icon img {
    transform: translateZ(0); /* Hardware acceleration */
  }
}

/* Print styles */
@media print {
  @page {
    size: auto;
    margin: 0.5in;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.3;
    background: #fff;
    color: #000;
  }
  
  .container {
    max-width: 100%;
    width: 100%;
  }
  
  a {
    color: #000;
    text-decoration: underline;
  }
  
  a::after {
    content: " (" attr(href) ")";
    font-size: 80%;
  }
  
  /* Hide non-essential elements */
  header, 
  .mobile-toggle,
  .hero-slider,
  .slider-btn,
  .slider-dots,
  .footer,
  .newsletter-container,
  .contact-form-container,
  .social-links {
    display: none !important;
  }
  
  /* Optimize content for printing */
  .section {
    padding: 1em 0;
    page-break-inside: avoid;
  }
  
  .section-title {
    font-size: 18pt;
  }
  
  .section-subtitle {
    font-size: 14pt;
  }
  
  .services-grid,
  .grid,
  .testimonial-grid {
    display: block;
  }
  
  .service-card,
  .feature-card,
  .testimonial {
    page-break-inside: avoid;
    margin-bottom: 1em;
    border: 1px solid #ccc;
    padding: 1em;
    box-shadow: none;
  }
  
  /* Show URL for important links */
  .service-link::after {
    content: " (more info)";
    font-style: italic;
  }
}