/* ==========================================
   BAJRANGBALI ELECTRICAL - RESPONSIVE STYLES
   Mobile-First Responsive Design
   ========================================== */

/* ==========================================
   MOBILE (< 640px) - Base Styles
   Already defined in styles.css
   ========================================== */

/* ==========================================
   SMALL TABLETS & LARGE PHONES (≥ 640px)
   ========================================== */

@media (min-width: 640px) {

    /* Typography */
    h1 {
        font-size: 3.5rem;
    }

    h2 {
        font-size: 2.75rem;
    }

    /* Container */
    .container {
        padding: 0 var(--spacing-xl);
    }

    /* Hero */
    .hero-content {
        border-radius: var(--radius-lg);
    }

    .hero-title {
        font-size: 3.5rem;
    }

    /* Services & Products Grid */
    .services-grid,
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Contact Buttons */
    .contact-buttons {
        flex-direction: row;
    }

    /* Footer */
    .footer-links {
        text-align: left;
    }

    .footer-contact-item {
        justify-content: flex-start;
    }
}

/* ==========================================
   TABLETS (≥ 768px)
   ========================================== */

@media (min-width: 768px) {

    /* Typography */
    h1 {
        font-size: 4rem;
    }

    h2 {
        font-size: 3rem;
    }

    /* Header */
    .header-content {
        height: 64px;
    }

    .nav-desktop {
        display: flex;
    }

    .hamburger {
        display: none;
    }

    .btn-desktop {
        display: inline-flex;
    }

    /* Hide mobile-only button */
    .btn-mobile-only {
        display: none;
    }

    /* Section Spacing */
    .section {
        padding: 4rem 0;
    }

    /* About Grid */
    .about-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-content {
        text-align: left;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 2fr 2fr;
    }

    .footer-brand {
        text-align: left;
    }
}

/* ==========================================
   LARGE TABLETS & SMALL DESKTOPS (≥ 1024px)
   ========================================== */

@media (min-width: 1024px) {

    /* Typography */
    h1 {
        font-size: 4.5rem;
    }

    h2 {
        font-size: 3.25rem;
    }

    /* Container */
    .container {
        padding: 0 var(--spacing-2xl);
    }

    /* Section Spacing */
    .section {
        padding: 5rem 0;
    }

    /* Services & Products - 4 Column Layout */
    .services-grid,
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Hero */
    .hero-title {
        font-size: 4.5rem;
    }

    .hero-description {
        font-size: 1.25rem;
    }

    /* About Section */
    .about-image {
        height: 400px;
    }
}

/* ==========================================
   DESKTOPS (≥ 1280px)
   ========================================== */

@media (min-width: 1280px) {

    /* Typography */
    h1 {
        font-size: 5rem;
    }

    h2 {
        font-size: 3.5rem;
    }

    /* Section Spacing */
    .section {
        padding: 6rem 0;
    }

    /* Hero */
    .hero-content {
        height: 70vh;
        min-height: 500px;
    }

    .hero-title {
        font-size: 5rem;
    }

    /* Card Spacing */
    .services-grid,
    .products-grid {
        gap: var(--spacing-2xl);
    }
}

/* ==========================================
   LARGE DESKTOPS (≥ 1536px)
   ========================================== */

@media (min-width: 1536px) {

    /* Typography */
    h1 {
        font-size: 5.5rem;
    }

    /* Container */
    .container {
        max-width: 1536px;
    }

    /* Hero */
    .hero-title {
        font-size: 5.5rem;
    }

    .hero-description {
        font-size: 1.375rem;
    }
}

/* ==========================================
   MOBILE LANDSCAPE & SMALL TABLETS (Height-based)
   ========================================== */

@media (max-height: 600px) and (orientation: landscape) {
    .hero-content {
        height: 100vh;
        min-height: 100vh;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: var(--spacing-lg);
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {

    /* Hide non-essential elements */
    .header,
    .mobile-menu,
    .fab-container,
    .btn,
    .modal,
    .toast {
        display: none !important;
    }

    /* Optimize for print */
    body {
        background-color: white;
        color: black;
    }

    .section {
        page-break-inside: avoid;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ==========================================
   ACCESSIBILITY - 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;
    }

    .fab {
        animation: none;
    }

    .guarantee-badge {
        animation: none;
    }
}

/* ==========================================
   HIGH CONTRAST MODE
   ========================================== */

@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --muted: #000000;
    }

    .btn-outline {
        border-width: 2px;
    }

    .card {
        border-width: 2px;
    }
}

/* ==========================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================== */

@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .btn {
        min-height: 44px;
        padding: var(--spacing-md) var(--spacing-xl);
    }

    .nav-link,
    .mobile-nav-link {
        min-height: 44px;
        padding: var(--spacing-md);
    }

    .accordion-header {
        min-height: 56px;
    }

    /* Disable hover effects */
    .card:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    /* Show FAB popover on tap */
    .fab-popover {
        opacity: 0;
        visibility: hidden;
    }
}

/* ==========================================
   SPECIFIC MOBILE FIXES
   ========================================== */

/* iOS Safari - Prevent zoom on input focus */
@media screen and (max-width: 767px) {

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px;
    }
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .fab-container {
        bottom: max(var(--spacing-xl), env(safe-area-inset-bottom));
        right: max(var(--spacing-xl), env(safe-area-inset-right));
    }

    .mobile-menu {
        padding-left: max(0px, env(safe-area-inset-left));
    }
}

/* ==========================================
   RESPONSIVE IMAGES
   ========================================== */

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevent layout shift with aspect ratios */
.hero-image img,
.about-image img,
.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================
   RESPONSIVE TYPOGRAPHY FINE-TUNING
   ========================================== */

@media (max-width: 479px) {
    .section-title {
        font-size: 1.75rem;
    }

    .card-title {
        font-size: 1.125rem;
    }

    .modal-title {
        font-size: 1.5rem;
    }
}

/* ==========================================
   GRID LAYOUT VARIATIONS
   ========================================== */

/* 3-column layout for certain screen sizes */
@media (min-width: 768px) and (max-width: 1023px) {

    .services-grid,
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   MOBILE MENU IMPROVEMENTS
   ========================================== */

@media (max-width: 767px) {
    .mobile-menu {
        width: 85%;
        max-width: 100%;
    }

    .mobile-menu-content {
        padding-bottom: var(--spacing-2xl);
    }
}

/* ==========================================
   SECTION SPACING ADJUSTMENTS
   ========================================== */

@media (max-width: 767px) {
    .section {
        padding: var(--spacing-2xl) 0;
    }

    .section-header {
        margin-bottom: var(--spacing-xl);
    }
}

/* ==========================================
   CARD HOVER EFFECTS - DESKTOP ONLY
   ========================================== */

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-8px);
        box-shadow: var(--shadow-2xl);
    }

    .dropdown-item:hover {
        background-color: var(--secondary);
    }
}

/* ==========================================
   FOOTER RESPONSIVE LAYOUT
   ========================================== */

@media (max-width: 767px) {
    .footer-grid {
        text-align: center;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .footer-links-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* 2 columns for mobile */
        gap: 1rem;
        text-align: left;
        /* Reset text align for list items */
    }

    .footer-links {
        text-align: center;
        /* Center headers */
    }

    .footer-menu {
        text-align: center;
        /* Center list items */
        padding: 0;
    }

    .footer-contact-item {
        justify-content: center;
        flex-direction: column;
        /* Stack icon and text if needed, or keep row */
        gap: 0.5rem;
    }

    /* Ensure icon and text align nicely in center mode */
    .footer-contact-item svg {
        margin: 0 auto;
    }
}

/* ==========================================
   CONTACT SECTION RESPONSIVE
   ========================================== */

@media (max-width: 639px) {
    .contact-buttons {
        width: 100%;
    }

    .contact-buttons .btn {
        width: 100%;
    }
}

/* ==========================================
   MODAL RESPONSIVE
   ========================================== */

@media (max-width: 639px) {
    .modal {
        padding: var(--spacing-md);
    }

    .modal-content {
        max-height: 95vh;
    }

    .modal-header,
    .modal-body {
        padding: var(--spacing-md);
    }
}

/* ==========================================
   TESTIMONIALS RESPONSIVE
   ========================================== */

@media (max-width: 767px) {
    .testimonial-card {
        padding: var(--spacing-lg);
    }

    .testimonial-message {
        font-size: var(--text-base);
    }
}

/* ==========================================
   UTILITIES FOR RESPONSIVE DISPLAY
   ========================================== */

/* Show/Hide on Mobile */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none;
    }

    .desktop-only {
        display: block;
    }
}

/* Flexbox Utilities */
.flex-mobile-col {
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-mobile-col {
        flex-direction: row;
    }
}

/* ==========================================
   UPDATED CONTACT SECTION RESPONSIVE
   ========================================== */

@media (max-width: 639px) {
    .contact-info {
        text-align: center;
        margin-bottom: var(--spacing-xl);
    }

    .contact-item {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        /* Allow wrapping if text is long */
        gap: 0.5rem;
        margin-bottom: var(--spacing-md);
        font-size: var(--text-base);
        color: var(--muted);
    }

    .contact-item svg {
        color: var(--muted-light);
    }

    /* Stack buttons vertically */
    .contact-buttons {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
        width: 100%;
        max-width: 320px;
        /* Limit width like the image */
        margin: 0 auto;
    }

    .contact-buttons .btn {
        width: 100%;
    }
}