/**
 * Modern responsive styles for Assyrian Business Directory
 * Complementing the new design system
 */

/* Base responsive rules */
html {
  font-size: 16px;
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
  html {
    font-size: 14px;
  }
  
  /* Tighter container padding on small screens */
  .container {
    padding-right: 1rem;
    padding-left: 1rem;
  }
  
  /* Hero section adjustments */
  .hero-section {
    padding: 2.5rem 0 2rem !important;
    margin-bottom: 2rem;
    text-align: center;
  }
  
  .hero-section h1 {
    font-size: 1.75rem !important;
    line-height: 1.2;
  }
  
  .hero-section .lead {
    font-size: 1rem !important;
    margin-bottom: 1.5rem;
  }
  
  .hero-section .search-form {
    margin-left: auto;
    margin-right: auto;
  }
  
  .hero-section .search-form .form-control {
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
  }
  
  .hero-section .search-form .btn {
    padding: 0 1rem !important;
  }
  
  /* Card and component spacing */
  .g-4 {
    --bs-gutter-y: 1rem;
  }
  
  /* Card layout */
  .business-card .card-header-image {
    height: 120px;
  }
  
  .business-logo {
    width: 70px;
    height: 70px;
  }
  
  /* Section headers */
  .section-title {
    font-size: 1.25rem !important;
  }
  
  /* Navigation */
  .site-header {
    height: auto;
  }
  
  .navbar-brand img {
    height: 36px;
  }
  
  /* Footer */
  .site-footer {
    padding: 3rem 0 1.5rem;
    text-align: center;
  }
  
  .site-footer h5::after {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .footer-links {
    margin-bottom: 2rem;
  }
  
  .social-links {
    justify-content: center;
    margin-bottom: 1.5rem;
  }
  
  /* CTA section */
  .cta-section {
    padding: 2.5rem 1rem;
    margin: 2rem 0;
  }
  
  .cta-section h2 {
    font-size: 1.5rem;
  }
  
  .cta-icon {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }
  
  /* Map section */
  .home-map-container {
    height: 250px;
  }
  
  .map-business-list {
    max-height: 250px;
  }
  
  /* Category links */
  .category-links {
    justify-content: center;
  }
  
  .category-links .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }
  
  /* Theme toggle position */
  .theme-toggle {
    top: 0.75rem;
    right: 4.25rem;
  }
  
  .theme-toggle .btn {
    width: 34px;
    height: 34px;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  /* Hero section */
  .hero-section {
    padding: 3rem 0 2.5rem;
    margin-bottom: 2.5rem;
  }
  
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .hero-section .search-form .form-control {
    padding: 1rem 1.25rem;
  }
  
  .hero-section .search-form .btn {
    padding: 0 1.25rem;
  }
  
  /* Card layout */
  .business-card .card-header-image {
    height: 140px;
  }
  
  /* Map section */
  .home-map-container {
    height: 300px;
  }
  
  /* CTA section */
  .cta-section {
    padding: 3rem 1.5rem;
  }
  
  .cta-section h2 {
    font-size: 1.75rem;
  }
  
  /* Theme toggle position */
  .theme-toggle {
    top: 1rem;
    right: 5rem;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Header adjustments */
  .navbar .container {
    max-width: 95%;
  }
  
  /* Hero section */
  .hero-section {
    padding: 4rem 0 3rem;
  }
  
  .hero-section h1 {
    font-size: 2.25rem;
  }
  
  /* Adjusted layout for tablets */
  .col-md-6 {
    width: 100%;
  }
  
  .row-cols-md-2 > * {
    width: 50%;
  }
  
  /* Map container */
  .map-container {
    height: 400px;
  }
  
  /* Card layout */
  .business-card .card-header-image {
    height: 160px;
  }
  
  /* CTA section */
  .cta-section h2 {
    font-size: 2rem;
  }
  
  /* Navbar collapse */
  .navbar-collapse {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
  }
  
  .navbar-nav {
    margin-left: 0;
  }
  
  .navbar-nav .nav-link::after {
    display: none;
  }
  
  .navbar .d-flex[action="search.php"] {
    margin: 1rem 0;
    max-width: 100%;
  }
  
  .user-actions, .language-selector {
    margin-top: 1rem;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Hero section */
  .hero-section {
    padding: 5rem 0 4rem;
  }
  
  .hero-section h1 {
    font-size: 2.5rem;
  }
  
  /* Card layout */
  .row-cols-lg-4 > * {
    width: 33.333333%;
  }
  
  /* Map container */
  .home-map-container {
    height: 450px;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .hero-section {
    padding: 6rem 0 5rem;
  }
  
  .hero-section h1 {
    font-size: 3rem;
  }
  
  /* Larger containers on big screens for better content display */
  .container {
    max-width: 1200px;
  }
}

/* Common responsive fixes */

/* Make forms more touch-friendly on mobile */
@media (max-width: 767.98px) {
  .form-control, .btn {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
  }
  
  /* Adjust spacing for smaller screens */
  .mb-5 {
    margin-bottom: 2rem !important;
  }
  
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  /* Fix table responsiveness */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Center content in mobile view */
  .text-center-mobile {
    text-align: center;
  }
  
  /* Login/register buttons responsiveness */
  .login-register-buttons {
    width: auto;
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .login-register-buttons .btn {
    padding: 0.5rem 0.875rem;
  }
  
  /* Adjust navbar spacing */
  .navbar {
    padding: 0.5rem 0;
  }
  
  /* Section headers on mobile */
  .section-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  
  /* Adjust animations for better performance on mobile */
  @media (prefers-reduced-motion: reduce) {
    [data-aos] {
      transition-duration: 0s !important;
      transform: none !important;
      opacity: 1 !important;
    }
  }
}

/* RTL language support */
html[dir="rtl"] {
  /* Adjust elements for RTL languages */
  .navbar-nav {
    margin-right: 2rem;
    margin-left: 0;
  }
  
  .navbar-nav .nav-item {
    margin-left: 0.25rem;
    margin-right: 0;
  }
  
  .section-title::after {
    right: 0;
    left: auto;
  }
  
  .footer-links li a:hover {
    transform: translateX(-5px);
  }
  
  .navbar .d-flex[action="search.php"] {
    margin-right: auto;
    margin-left: 1rem;
  }
  
  .language-selector {
    margin-right: 0.75rem;
    margin-left: 0;
  }
  
  .card-header .dropdown-menu {
    left: 0;
    right: auto;
  }
  
  /* Fix icons & badges in RTL */
  .me-1, .me-2, .me-3 {
    margin-right: 0 !important;
  }
  
  .me-1 {
    margin-left: 0.25rem !important;
  }
  
  .me-2 {
    margin-left: 0.5rem !important;
  }
  
  .me-3 {
    margin-left: 1rem !important;
  }
  
  .ms-1, .ms-2, .ms-3 {
    margin-left: 0 !important;
  }
  
  .ms-1 {
    margin-right: 0.25rem !important;
  }
  
  .ms-2 {
    margin-right: 0.5rem !important;
  }
  
  .ms-3 {
    margin-right: 1rem !important;
  }
}

/* Reduced animation for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print styles */
@media print {
  /* Hide navigation, footer, and unnecessary elements */
  .site-header,
  .site-footer,
  .theme-toggle,
  .scroll-to-top,
  .hero-section,
  .cta-section,
  .map-section {
    display: none !important;
  }
  
  /* Ensure content is visible */
  body {
    color: #000;
    background: #fff;
  }
  
  /* Expand containers for better print layout */
  .container {
    max-width: none;
    width: 100%;
  }
  
  /* Show full URLs in links */
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  /* Optimize card display for print */
  .card {
    break-inside: avoid;
    border: 1px solid #ddd;
    box-shadow: none !important;
  }
  
  /* Ensure page breaks are clean */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    break-after: avoid;
  }
  
  img {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Fix print margins */
  @page {
    margin: 2cm;
  }
}

/**
 * Updated responsive styles for Assyrian Business Directory
 * With fixes for navigation at all breakpoints
 */

/* Base responsive rules */
html {
  font-size: 16px;
}

/* ===== MEDIA QUERIES - MOBILE FIRST APPROACH ===== */

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
  html {
    font-size: 14px;
  }
  
  /* Container padding */
  .container {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }
  
  /* Navigation specific fixes */
  .navbar-brand img {
    height: 32px;
  }
  
  .login-register-buttons .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
  
  /* Hero section */
  .hero-section {
    padding: 2.5rem 0 2rem !important;
    margin-bottom: 2rem;
    text-align: center;
  }
  
  .hero-section h1 {
    font-size: 1.75rem !important;
    line-height: 1.2;
  }
  
  .hero-section .search-form .form-control {
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
  }
  
  /* Section headers */
  .section-title {
    font-size: 1.25rem !important;
  }
  
  /* Card adjustments */
  .business-card .card-header-image {
    height: 120px;
  }
  
  .business-logo {
    width: 70px;
    height: 70px;
  }
  
  /* Map section */
  .home-map-container {
    height: 250px;
  }
  
  /* CTA section */
  .cta-section {
    padding: 2.5rem 1rem;
    margin: 2rem 0;
  }
  
  .cta-section h2 {
    font-size: 1.5rem;
  }
  
  .cta-icon {
    width: 80px;
    height: 80px;
    font-size: 2rem;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  /* Navigation specific fixes */
  .navbar-brand img {
    height: 36px;
  }
  
  /* Hero section */
  .hero-section {
    padding: 3rem 0 2.5rem;
    margin-bottom: 2.5rem;
  }
  
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .hero-section .search-form .form-control {
    padding: 1rem 1.25rem;
  }
  
  /* Card layout */
  .business-card .card-header-image {
    height: 140px;
  }
  
  /* Map section */
  .home-map-container {
    height: 300px;
  }
  
  /* CTA section */
  .cta-section {
    padding: 3rem 1.5rem;
  }
  
  .cta-section h2 {
    font-size: 1.75rem;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Navigation fixes */
  .navbar .d-flex[action="search.php"] {
    max-width: 180px;
  }
  
  /* Hero section */
  .hero-section {
    padding: 4rem 0 3rem;
  }
  
  .hero-section h1 {
    font-size: 2.25rem;
  }
  
  /* Map container */
  .map-container {
    height: 400px;
  }
  
  /* Card layout */
  .business-card .card-header-image {
    height: 160px;
  }
  
  /* CTA section */
  .cta-section h2 {
    font-size: 2rem;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Navigation spacing */
  .navbar-nav .nav-link {
    padding: 0.5rem 0.625rem;
  }
  
  .navbar .d-flex[action="search.php"] {
    max-width: 200px;
  }
  
  /* Hero section */
  .hero-section {
    padding: 5rem 0 4rem;
  }
  
  .hero-section h1 {
    font-size: 2.5rem;
  }
  
  /* Map container */
  .home-map-container {
    height: 450px;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  /* Navigation spacing */
  .navbar-nav .nav-link {
    padding: 0.5rem 0.875rem;
  }
  
  .navbar .d-flex[action="search.php"] {
    max-width: 250px;
  }
  
  /* Hero section */
  .hero-section {
    padding: 6rem 0 5rem;
  }
  
  .hero-section h1 {
    font-size: 3rem;
  }
  
  /* Larger containers on big screens for better content display */
  .container {
    max-width: 1200px;
  }
}

/* ===== SPECIFIC COMPONENT FIXES ===== */

/* Navbar collapse behavior for all screen sizes */
@media (max-width: 991.98px) {
  .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
  }
  
  .navbar-nav {
    flex-direction: column;
    width: 100%;
  }
  
  .navbar-nav .nav-item {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }
  
  .navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    display: block;
  }
  
  .navbar-nav .nav-link::after {
    display: none;
  }
  
  /* Center align buttons when collapsed */
  .user-actions {
    justify-content: center;
  }
}

/* Make forms more touch-friendly on mobile */
@media (max-width: 767.98px) {
  .form-control, .btn {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
  }
  
  /* Adjust spacing for smaller screens */
  .mb-5 {
    margin-bottom: 2rem !important;
  }
  
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }
  
  /* Center content in mobile view */
  .text-center-mobile {
    text-align: center;
  }
  
  /* Login/register buttons responsiveness */
  .login-register-buttons {
    width: auto;
    flex-direction: row;
    gap: 0.375rem;
  }
  
  /* Footer adjustments */
  .site-footer {
    padding: 3rem 0 1.5rem;
  }
  
  .footer-links {
    margin-bottom: 2rem;
  }
  
  .social-links {
    justify-content: center;
    margin-bottom: 1.5rem;
  }
}

/* RTL language support */
html[dir="rtl"] {
  /* Adjust elements for RTL languages */
  .navbar-nav {
    margin-left: 0;
    margin-right: 0;
  }
  
  .navbar-nav .nav-item {
    margin-left: 0.5rem;
    margin-right: 0;
  }
  
  .navbar .d-flex[action="search.php"] {
    margin-right: auto;
    margin-left: 1rem;
  }
  
  .language-selector {
    margin-right: 0.5rem;
    margin-left: 0;
  }
  
  .section-title::after {
    right: 0;
    left: auto;
  }
  
  /* Fix icons & badges in RTL */
  .me-1, .me-2, .me-3 {
    margin-right: 0 !important;
  }
  
  .me-1 {
    margin-left: 0.25rem !important;
  }
  
  .me-2 {
    margin-left: 0.5rem !important;
  }
  
  .me-3 {
    margin-left: 1rem !important;
  }
  
  .ms-1, .ms-2, .ms-3 {
    margin-left: 0 !important;
  }
  
  .ms-1 {
    margin-right: 0.25rem !important;
  }
  
  .ms-2 {
    margin-right: 0.5rem !important;
  }
  
  .ms-3 {
    margin-right: 1rem !important;
  }
  
  /* Flip icons when needed */
  .fa-arrow-left {
    transform: scaleX(-1);
  }
  
  .fa-arrow-right {
    transform: scaleX(-1);
  }
}