/* Responsive Design */

/* Tablet Styles */
@media screen and (max-width: 1024px) {
  .section-title {
    font-size: 1.8rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .contact-container {
    grid-template-columns: 1fr;
  }
  
  .footer-container {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .hero-btns {
    flex-direction: column;
    align-items: center;
  }
  
  /* Tablet-specific hero adjustments - centered crop */
  .hero-section {
    background-position: center center;
    background-attachment: scroll;
  }
  
  .hero-title {
    font-size: 1.6rem;
  }
  
  .hero-subtitle {
    font-size: 0.8rem;
    padding: 0.7rem 1rem;
  }
  
  /* Specific tablet styling for homepage hero to match services page */
  .hero-section.services-hero {
    padding-top: 4rem; /* Increase for tablet */
  }
  
  /* Apply same tablet styling to all other hero sections */
  .hero-section:not(.services-hero) {
    padding-top: 4rem; /* Consistent tablet positioning */
  }
  
  .hero-section.services-hero .hero-title {
    font-size: 1.8rem;
  }
  
  .hero-section.services-hero .hero-subtitle {
    font-size: 1.2rem;
    font-weight: bold; /* Ensure bold on tablet */
  }
  
  .hero-content {
    margin-top: 1.5rem;
    padding: 0 2rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.3rem;
  }
}

/* Mobile Styles */
@media screen and (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  .nav-menu {
    position: fixed;
    top: 80px;
    right: -100%;
    flex-direction: column;
    background: white;
    width: 100%;
    text-align: right;
    transition: 0.3s;
    box-shadow: 0 10px 27px rgba(0,0,0,0.05);
    padding: 2rem;
    gap: 1.5rem;
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .nav-item {
    margin: 0.5rem 0;
  }
  
  .hamburger {
    display: flex;
  }
  
  .section {
    padding: 3rem 0;
  }
  
  /* Mobile-specific hero adjustments */
  .hero-section {
    background-attachment: scroll;
  }
  
  .hero-content {
    padding: 0 1.5rem;
  }
  
  .section {
    padding: 3rem 0;
  }
  
  /* Mobile-specific hero adjustments */
  .hero-section {
    background-attachment: scroll;
  }
  
  .hero-content {
    padding: 0 1.5rem;
  }
  
  .hero-title {
    font-size: 1.6rem;
  }
  
  .hero-subtitle {
    font-size: 0.85rem;
  }
  
  .section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
  }
  
  /* Revert to grid for other sections */
  .stats-grid,
  .testimonials-wrapper {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .hero-btns {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
    text-align: center;
  }
  
  .floating-buttons {
    bottom: 15px;
    right: 15px;
    gap: 8px;
  }
  
  .btn-contact, .btn-whatsapp {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  
  .testimonial-card {
    padding: 1.5rem;
  }
  
  .testimonial-author img {
    width: 40px;
    height: 40px;
    margin-left: 0.8rem;
  }
  
  .contact-form,
  .calculator-form {
    padding: 1.5rem;
  }
  
  .footer-container {
    grid-template-columns: 1fr;
  }
  
  .social-links {
    justify-content: center;
  }
  
  /* Mobile logo and company name */
  .logo-img {
    height: 50px;
  }
  
  .company-name {
    font-size: 18px;
  }
}

/* Small Mobile Styles */
@media screen and (max-width: 480px) {
  .section-title {
    font-size: 1.3rem;
  }
  
  .service-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
  }
  
  .stat-card {
    padding: 1.5rem 1rem;
    text-align: center;
  }
  
  .testimonial-card::before {
    font-size: 3rem;
    top: -20px;
    right: 10px;
  }
  
  .main-content {
    margin-top: 70px;
  }
  
  .header {
    padding: 0.8rem 0;
  }
  
  .section {
    padding: 2.5rem 0;
  }
  
  /* Small mobile hero adjustments */
  .hero-section {
    min-height: 400px;
    background-attachment: scroll;
  }
  
  .hero-content {
    padding: 0 1rem;
  }
  
  .hero-title {
    font-size: 1.3rem;
  }
  
  .hero-subtitle {
    font-size: 0.7rem;
  }
  
  /* Specific mobile styling for homepage hero to match services page */
  .hero-section.services-hero {
    padding-top: 3.5rem; /* Increase for mobile */
  }
  
  /* Apply same mobile styling to all other hero sections */
  .hero-section:not(.services-hero) {
    padding-top: 3.5rem; /* Consistent mobile positioning */
  }
  
  .hero-section.services-hero .hero-title {
    font-size: 1.5rem;
  }
  
  .hero-section.services-hero .hero-subtitle {
    font-size: 1.1rem;
    font-weight: bold; /* Ensure bold on mobile */
  }
  
  /* Tablet styles for stats */
  @media screen and (min-width: 768px) and (max-width: 1199px) {
    .stat-icon {
      font-size: 3rem;
      margin-bottom: 1.2rem;
    }
    
    .stat-card {
      padding: 1.8rem 1.2rem;
    }
    
    /* Tablet logo and company name */
    .logo-img {
      height: 60px;
    }
    
    .company-name {
      font-size: 20px;
    }
  }
  
  .contact-info {
    align-items: center;
    text-align: center;
  }
  
  .info-item {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
  }
}

/* Large Screen Styles */
@media screen and (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
  
  .section-title {
    font-size: 2.2rem;
  }
  
  /* Large screen hero adjustments - show more of the top content */
  .hero-section {
    background-position: center 20%; /* Show more of the logo/content area */
  }
  
  .hero-content {
    padding: 0 3rem;
  }
  
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.8rem;
  }
  
  .service-card {
    padding: 2.5rem;
  }
  
  .stat-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
  }
  
  .stat-card {
    padding: 2rem;
  }
  
  /* Ensure proper centering for hero section */
  .hero-content {
    max-width: 900px;
    align-items: center;
  }
  
  .hero-btns {
    justify-content: center;
    gap: 2rem;
  }
  
  /* Large screen logo and company name */
  .logo-img {
    height: 80px;
  }
  
  .company-name {
    font-size: 24px;
  }
}

/* Very Large Screen Styles */
@media screen and (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
  
  .hero-title {
    font-size: 4rem;
  }
  
  /* Very large screen hero adjustments - optimal content positioning */
  .hero-section {
    background-position: center 15%; /* Balanced view showing logo and main content */
  }
  
  .hero-content {
    padding: 0 4rem;
  }
}

/* Print Styles */
@media print {
  .floating-buttons,
  .hamburger {
    display: none;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.6;
  }
  
  .section {
    page-break-inside: avoid;
  }
  
  img {
    max-width: 100% !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --shadow-light: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.4);
  }
  
  .card,
  .service-card {
    border: 1px solid var(--color-text);
  }
}

/* Reduced Motion Support */
@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;
  }
}

@media (max-width: 1024px) {

  /* 1) اجعل بطاقة الخدمة "عمودية" وتتوسع تلقائياً حسب المحتوى */
  .service-card,
  .services-card,
  .service-item {
    display: flex;
    flex-direction: column;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden;
  }

  /* 2) إلغاء أي ارتفاع/نسبة ثابتة لحاوية الصورة */
  .service-card .service-image,
  .services-card .service-image,
  .service-item .service-image,
  .service-card .card-image,
  .service-card .service-thumb {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    display: block;
  }

  /* 3) الصورة نفسها: تملأ العرض وتحدد الارتفاع تلقائياً */
  .service-card .service-image img,
  .services-card .service-image img,
  .service-item .service-image img,
  .service-card .card-image img,
  .service-card .service-thumb img {
    width: 100% !important;
    height: auto !important;
    display: block;
    object-fit: unset !important;
    max-height: none !important;
  }

  /* 4) تأكد أن محتوى الكارت يأخذ مكانه تحت الصورة بدون ضغط */
  .service-card .service-content,
  .services-card .service-content,
  .service-item .service-content,
  .service-card .card-content,
  .services-card .card-content {
    flex: 0 0 auto;
  }
}

