/* ==========================================================================
   Responsive Styles - Mobile First Approach
   أنماط الاستجابة الشاملة للموبايل - الصرح الشامخ
   ========================================================================== */

/* ==========================================================================
   Extra Large Devices (1200px and below)
   ========================================================================== */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 var(--space-6);
    }

    /* Products layout adjustment */
    .products-layout {
        grid-template-columns: 250px 1fr;
        gap: 2rem;
    }
}

/* ==========================================================================
   Large Devices (1024px and below)
   ========================================================================== */
@media (max-width: 1024px) {

    /* Typography */
    :root {
        --text-5xl: 2.5rem;
        --text-6xl: 3rem;
    }

    /* Section padding */
    .section {
        padding: var(--space-16) 0;
    }

    /* Page Hero */
    .page-hero {
        padding: var(--space-16) 0;
    }

    .page-hero h1 {
        font-size: var(--text-3xl);
    }

    .page-hero p {
        font-size: var(--text-lg);
    }

    /* Hero Intro Company */
    .hero-intro__company {
        font-size: var(--text-3xl);
    }

    /* Category and Service Cards */
    .category-card__image,
    .service-card__image,
    .main-service-card__image {
        width: 160px;
        height: 160px;
    }

    /* Products sidebar switch to top */
    .products-layout {
        grid-template-columns: 1fr;
    }

    .products-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr;
    }

    .sidebar-categories {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sidebar-categories a {
        flex: 0 0 auto;
        padding: 0.75rem 1rem;
    }

    /* Product detail grid */
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .product-detail__image img {
        height: 350px;
    }

    /* Other categories grid */
    .other-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   Medium Devices (768px and below) - Tablets
   ========================================================================== */
@media (max-width: 768px) {

    /* Root Typography adjustments */
    html {
        font-size: 15px;
    }

    /* Container */
    .container {
        padding: 0 var(--space-4);
    }

    /* Section */
    .section {
        padding: var(--space-12) 0;
    }

    /* Section Header */
    .section-header {
        margin-bottom: var(--space-8);
    }

    .section-header__title {
        font-size: var(--text-2xl);
    }

    .section-header__description {
        font-size: var(--text-base);
    }

    /* Page Hero */
    .page-hero {
        padding: var(--space-12) 0;
    }

    .page-hero h1,
    .page-hero h2 {
        font-size: var(--text-2xl);
    }

    .page-hero p {
        font-size: var(--text-base);
    }

    /* Buttons - make them touch-friendly */
    .btn {
        padding: var(--space-3) var(--space-5);
        font-size: var(--text-sm);
        min-height: 44px;
    }

    .btn--lg {
        padding: var(--space-4) var(--space-6);
    }

    /* Hero Intro */
    .hero-intro {
        padding-top: var(--space-10);
        padding-bottom: var(--space-6);
    }

    .hero-intro__company {
        font-size: var(--text-2xl);
    }

    .hero-intro__title {
        font-size: var(--text-lg);
    }

    .hero-intro__description {
        font-size: var(--text-base);
    }

    /* Agent Card */
    .hero-intro__agent-card {
        flex-direction: column;
        padding: var(--space-6);
        gap: var(--space-5);
    }

    .agent-card__logo-wrapper {
        height: 80px;
        width: 80px;
        min-width: 80px;
    }

    .agent-card__name {
        font-size: var(--text-lg);
    }

    /* Category Cards */
    .category-card__image {
        width: 140px;
        height: 140px;
    }

    .category-card__body {
        padding: var(--space-4);
    }

    .category-card__title {
        font-size: var(--text-lg);
    }

    .category-card__description {
        font-size: var(--text-sm);
    }

    /* Service Cards */
    .service-card__image,
    .main-service-card__image {
        width: 140px;
        height: 140px;
    }

    /* Project Cards */
    .project-card__image {
        height: 200px;
    }

    .project-card__body {
        padding: var(--space-4);
    }

    /* News Cards */
    .news-card__image {
        height: 180px;
    }

    .news-card__body {
        padding: var(--space-4);
    }

    .news-card__title {
        font-size: var(--text-base);
    }

    /* About Section */
    .about-video-wrapper {
        padding-bottom: 56.25%;
        border-radius: var(--radius-xl);
    }

    .about-title {
        font-size: var(--text-2xl);
    }

    .about-lead {
        font-size: var(--text-lg);
    }

    .about-text {
        font-size: var(--text-base);
    }

    /* Stats Section */
    .stat-number {
        font-size: var(--text-3xl);
    }

    .stat-label {
        font-size: var(--text-base);
    }

    /* CTA Section */
    .cta-section {
        padding: var(--space-12) 0;
    }

    .cta-content h2 {
        font-size: var(--text-xl);
    }

    .cta-content p {
        font-size: var(--text-base);
    }

    /* Contact Grid */
    .contact-card {
        flex-direction: column;
        text-align: center;
    }

    .contact-card__icon {
        margin: 0 auto;
    }

    /* Quote Form */
    .quote-form-wrapper {
        padding: var(--space-5);
    }

    /* Product Detail */
    .product-detail__image img {
        height: 280px;
    }

    .product-detail__content h2 {
        font-size: var(--text-xl);
    }

    .product-detail__description {
        font-size: var(--text-base);
    }

    /* Product Cards */
    .product-card__image {
        height: 180px;
    }

    .product-card__body {
        padding: var(--space-4);
    }

    /* Single Service/Problem layout */
    .service-main>div,
    .problem-main {
        padding: var(--space-5);
        border-radius: var(--radius-xl);
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Problems Grid */
    .problem-icon {
        width: 180px;
        height: 180px;
    }

    .problem-title {
        font-size: 1.1rem;
    }

    /* Testimonials */
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    .testimonial-card {
        padding: var(--space-6);
    }

    /* Vision Mission */
    .vision-mission__item {
        padding: var(--space-6);
    }

    .vision-mission__icon {
        width: 60px;
        height: 60px;
    }
}

/* ==========================================================================
   Small Devices (576px and below) - Mobile Phones
   ========================================================================== */
@media (max-width: 576px) {

    /* Typography */
    html {
        font-size: 14px;
    }

    /* Container minimal padding */
    .container {
        padding: 0 var(--space-3);
    }

    /* Section */
    .section {
        padding: var(--space-10) 0;
    }

    /* Section Header */
    .section-header__title {
        font-size: var(--text-xl);
    }

    .section-header__subtitle {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-3);
    }

    /* Page Hero */
    .page-hero {
        padding: var(--space-10) 0;
    }

    .page-hero h1 {
        font-size: var(--text-xl);
    }

    .page-hero .breadcrumbs {
        font-size: var(--text-xs);
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Hero Banners */
    .hero-banners {
        height: 50vh;
        min-height: 350px;
    }

    /* Image Only Slide - Show Full Image */
    .hero-slide--image-only .hero-slide__bg {
        background-size: contain;
        background-repeat: no-repeat;
    }

    .hero-slide__subtitle {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-3);
    }

    .hero-slide__title {
        font-size: var(--text-2xl);
    }

    .hero-slide__description {
        font-size: var(--text-sm);
        padding: 0 var(--space-2);
    }

    .hero-slide__content {
        padding: var(--space-4);
    }

    /* Hero Slider Dots */
    .hero-slider__dots {
        bottom: var(--space-4);
    }

    .hero-slider__dot {
        width: 10px;
        height: 10px;
    }

    /* Hero Intro */
    .hero-intro {
        padding-top: var(--space-8);
    }

    .hero-intro__company {
        font-size: var(--text-xl);
    }

    .hero-intro__title {
        font-size: var(--text-base);
    }

    /* Agent Card */
    .hero-intro__agent-card {
        padding: var(--space-4);
        gap: var(--space-4);
    }

    .agent-card__badge {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-4);
    }

    .agent-card__name {
        font-size: var(--text-base);
    }

    .agent-card__logo-wrapper {
        height: 60px;
        width: 60px;
        min-width: 60px;
    }

    /* Category Cards */
    .category-card__image {
        width: 120px;
        height: 120px;
        margin-top: 1rem;
    }

    .category-card__body {
        padding: var(--space-4);
    }

    .category-card__icon {
        width: 50px;
        height: 50px;
    }

    /* Service Cards */
    .service-card,
    .main-service-card {
        border-radius: var(--radius-xl);
    }

    .service-card__image,
    .main-service-card__image {
        width: 120px;
        height: 120px;
        margin-top: 1rem;
    }

    .main-service-card__body {
        padding: var(--space-4);
    }

    .main-service-card__body h2 {
        font-size: var(--text-lg);
    }

    /* Project Cards */
    .project-card__image {
        height: 180px;
    }

    .project-card__body h3 {
        font-size: var(--text-lg);
    }

    /* News Cards */
    .news-card__image {
        height: 160px;
    }

    /* Partners */
    .partners-grid {
        gap: var(--space-6);
    }

    .partner-item img {
        max-height: 80px;
        max-width: 150px;
    }

    .partner-name {
        font-size: var(--text-sm);
    }

    /* Stats */
    .stats-grid {
        gap: var(--space-4);
    }

    .stat-number {
        font-size: var(--text-2xl);
    }

    .stat-label {
        font-size: var(--text-sm);
    }

    .stat-icon svg {
        width: 32px;
        height: 32px;
    }

    /* About Section */
    .about-title {
        font-size: var(--text-xl);
    }

    .about-lead {
        font-size: var(--text-base);
    }

    .about-features li {
        font-size: var(--text-sm);
    }

    /* CTA Section */
    .cta-section {
        padding: var(--space-10) 0;
    }

    .cta-content h2 {
        font-size: var(--text-lg);
    }

    .cta-content p {
        font-size: var(--text-sm);
    }

    .cta-content .btn--white {
        padding: 0.875rem 1.5rem;
        font-size: var(--text-base);
    }

    /* Forms */
    .form-control {
        padding: var(--space-3);
        font-size: var(--text-base);
    }

    .form-label {
        font-size: var(--text-sm);
    }

    /* Product Categories */
    .product-category-card__image {
        height: 180px;
    }

    .product-category-card__body {
        padding: var(--space-4);
    }

    .product-category-card__body h3 {
        font-size: var(--text-lg);
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .product-card__image {
        height: 140px;
    }

    .product-card__body {
        padding: var(--space-3);
    }

    .product-card__body h3 {
        font-size: var(--text-sm);
    }

    .product-card__body p {
        font-size: var(--text-xs);
    }

    /* Product Detail */
    .product-detail__image img {
        height: 220px;
    }

    .product-detail__content h2 {
        font-size: var(--text-lg);
    }

    .product-detail__description {
        font-size: var(--text-sm);
    }

    /* Sidebar Categories */
    .sidebar-categories {
        gap: 0.25rem;
    }

    .sidebar-categories a {
        padding: 0.5rem 0.75rem;
        font-size: var(--text-sm);
    }

    /* Service Page Components */
    .services-page .page-hero,
    .service-page .page-hero {
        padding: 100px 0 40px;
        min-height: auto;
    }

    .services-page .page-hero__content h1,
    .service-page .page-hero__content h1 {
        font-size: var(--text-xl);
    }

    .services-page .page-hero__content p,
    .service-page .page-hero__content p {
        font-size: var(--text-sm);
    }

    /* Feature List */
    .features-list {
        gap: 0.5rem;
    }

    .features-list li {
        padding: 0.75rem;
        font-size: var(--text-sm);
    }

    /* Why Grid */
    .why-item {
        padding: var(--space-4);
    }

    .why-item h4 {
        font-size: var(--text-base);
    }

    .why-item p {
        font-size: var(--text-xs);
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .gallery-item,
    .gallery-item img {
        height: 120px;
    }

    /* Problem Page */
    .problem-hero {
        padding: 60px 0 40px;
    }

    .problem-hero h1 {
        font-size: var(--text-xl);
    }

    .problem-icon {
        width: 140px;
        height: 140px;
    }

    .problem-title {
        font-size: var(--text-base);
    }

    .problem-cta {
        padding: var(--space-4);
    }

    .problem-cta__content h4 {
        font-size: var(--text-base);
    }

    .problem-cta__content p {
        font-size: var(--text-sm);
    }

    /* Values Grid */
    .value-card {
        padding: var(--space-4);
    }

    .value-card__icon {
        width: 50px;
        height: 50px;
    }

    /* Vision Mission */
    .vision-mission__item {
        padding: var(--space-5);
    }

    .vision-mission__icon {
        width: 50px;
        height: 50px;
    }

    .vision-mission__item h3 {
        font-size: var(--text-lg);
    }

    /* Other categories */
    .other-categories-grid {
        grid-template-columns: 1fr;
    }

    .other-category-card {
        padding: 1rem 1.25rem;
    }

    /* Product Category Page Hero */
    .product-category-page .page-hero.category-hero {
        padding: 90px 0 30px;
    }

    .product-category-page .page-hero__content h1 {
        font-size: var(--text-xl);
    }

    .category-description {
        font-size: var(--text-sm);
    }
}

/* ==========================================================================
   Extra Small Devices (390px and below) - Small Phones
   ========================================================================== */
@media (max-width: 390px) {

    /* Typography */
    html {
        font-size: 13px;
    }

    /* Container */
    .container {
        padding: 0 var(--space-2);
    }

    /* Hero Banners */
    .hero-banners {
        height: 45vh;
        min-height: 300px;
    }

    .hero-slide__title {
        font-size: var(--text-xl);
    }

    /* Agent Card */
    .hero-intro__agent-card {
        padding: var(--space-3);
    }

    .agent-card__logo-wrapper {
        height: 50px;
        width: 50px;
        min-width: 50px;
    }

    /* Cards - smaller images for tiny screens */
    .category-card__image,
    .service-card__image,
    .main-service-card__image {
        width: 100px;
        height: 100px;
    }

    /* Products Grid - single column for tiny screens */
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-card__image {
        height: 180px;
    }

    /* Problem icon for tiny screens */
    .problem-icon {
        width: 120px;
        height: 120px;
    }

    /* Stats - single column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }

    .cta-actions {
        width: 100%;
    }

    .cta-actions .btn {
        margin-bottom: var(--space-2);
    }
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover effects on touch devices */
    .card:hover,
    .service-card:hover,
    .project-card:hover,
    .news-card:hover,
    .product-card:hover,
    .testimonial-card:hover,
    .problem-card:hover {
        transform: none;
    }

    /* Make interactive elements larger for touch */
    .btn,
    .nav-menu>li>a,
    .mobile-menu li a {
        min-height: 44px;
    }

    /* Improve tap targets */
    .footer__links a,
    .sidebar-categories a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {

    .site-header,
    .mobile-nav,
    .whatsapp-float,
    .cta-section,
    .site-footer {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }
}

/* ==========================================================================
   Orientation Specific Styles
   ========================================================================== */
@media (max-width: 896px) and (orientation: landscape) {

    /* Reduce hero height in landscape mobile */
    .hero-banners {
        height: 70vh;
        max-height: 400px;
    }

    .page-hero {
        padding: var(--space-8) 0;
    }

    /* Stats in horizontal row */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================================================
   Safe Area Insets for Notched Devices (iPhone X+)
   ========================================================================== */
@supports (padding: max(0px)) {
    .site-header {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }

    .site-footer {
        padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
    }

    .mobile-nav__content {
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    }

    .whatsapp-float {
        left: max(20px, env(safe-area-inset-left) + 10px);
        bottom: max(20px, env(safe-area-inset-bottom) + 10px);
    }
}