/**
 * Mobile Fixes for Penguin Home Services
 * This file contains critical fixes for mobile responsiveness issues
 * Created: 2026-02-06
 */

/* ==========================================================================
   Service Areas List Style
   ========================================================================== */

/* Remove bullet points from service area lists */
.service-area-card ul {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0.5rem 0 !important;
}

.service-area-card li {
    padding: 0.1rem 0 !important;
    line-height: 1.4 !important;
}

/* ==========================================================================
   Service Card Button Alignment Fix
   ========================================================================== */

/* Fix Learn More button centering in service cards - ONLY centering, no style changes */
.service-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.service-card ul {
    flex-grow: 1;
}

.service-card-link {
    margin-top: auto !important;
    text-align: center;
    display: block;
}

/* ==========================================================================
   Header Fixes - Ensure consistent colors and proper display
   ========================================================================== */

/* Desktop Header - Keep as off-white/beige background */
.header {
    background: var(--off-white);
    border-bottom: 1px solid var(--light-gray);
    position: relative;
    z-index: 1000;
    height: var(--header-height);
    display: flex;
    align-items: center;
}

/* Mobile-specific header adjustments */
@media (max-width: 768px) {
    /* Fix mobile header to have consistent off-white background */
    .header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: var(--off-white) !important; /* Override mobile-optimization.css */
        backdrop-filter: none !important; /* Remove blur effect */
        border-bottom: 1px solid var(--light-gray);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        height: var(--header-height) !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* Ensure navbar maintains proper spacing on mobile */
    .navbar {
        padding: 0.5rem 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    /* Logo adjustments for mobile */
    .logo img {
        display: block !important;
        height: 55px !important; /* Good size for mobile header */
        width: auto !important;
        max-width: 220px !important;
        object-fit: contain;
        position: relative !important;
        top: 10px !important;
    }
    
    /* Footer logo on mobile */
    .footer-logo {
        height: 80px !important;
        width: auto !important;
        max-width: 200px !important;
    }
}

/* ==========================================================================
   Hamburger Menu Fixes
   ========================================================================== */

@media (max-width: 768px) {
    /* Fix hamburger menu visibility and styling */
    .hamburger {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 24px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
        position: relative;
    }
    
    .hamburger span {
        display: block;
        width: 100%;
        height: 3px;
        background-color: var(--forest-green);
        border-radius: 2px;
        transition: all 0.3s ease;
        position: absolute;
        left: 0;
    }
    
    .hamburger span:nth-child(1) { 
        top: 0; 
    }
    
    .hamburger span:nth-child(2) { 
        top: 50%; 
        transform: translateY(-50%); 
    }
    
    .hamburger span:nth-child(3) { 
        bottom: 0; 
    }
    
    /* Active hamburger state */
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg);
        top: 50%;
        transform-origin: center;
    }
    
    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg);
        bottom: 50%;
        transform-origin: center;
    }
}

/* ==========================================================================
   Mobile Menu Improvements
   ========================================================================== */

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--forest-green);
    transition: left 0.3s ease;
    z-index: 2000;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-nav {
    padding: 1rem 0;
}

.mobile-menu-nav a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--off-white);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(250, 250, 250, 0.1);
    transition: background-color 0.3s ease;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a:focus {
    background-color: rgba(250, 250, 250, 0.05);
    color: var(--earth-orange);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Prevent body scroll when menu is open */
body.no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ==========================================================================
   Service Cards - Proper Mobile Stacking
   ========================================================================== */

@media (max-width: 768px) {
    /* Fix What We Do section - ensure vertical stacking */
    .services-showcase {
        padding: 2rem 0;
    }
    
    .service-options {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    .service-option {
        width: 100% !important;
        margin: 0 !important;
        padding: 1.5rem !important;
        min-height: auto !important;
        text-align: center;
    }
    
    .service-option h3 {
        font-size: 1.25rem !important;
        margin-bottom: 0.75rem;
    }
    
    .service-option p {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .service-option .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    /* Fix the icon size on mobile */
    .service-option i,
    .service-option svg {
        font-size: 2.5rem !important;
        margin-bottom: 1rem;
    }
}

/* ==========================================================================
   Grid Layouts - Ensure Proper Mobile Responsiveness
   ========================================================================== */

@media (max-width: 768px) {
    /* Force all grid layouts to single column on mobile ONLY */
    .grid-2,
    .grid-3,
    .grid-4,
    .services-grid,
    .feature-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        width: 100% !important;
    }
    
    /* Service area cards on mobile only */
    .service-areas-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .service-area-card {
        padding: 1.5rem !important;
        margin: 0 !important;
        width: 100% !important;
    }
}

/* Desktop Grid Preservation - Ensure desktop layouts are not affected */
@media (min-width: 769px) {
    /* Preserve original grid layouts on desktop */
    .grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .grid-3 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    /* Service area cards should maintain their grid on desktop */
    .service-areas-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem;
    }
    
    /* Fix service option cards button alignment on desktop */
    .service-option {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
    }
    
    .service-option .btn {
        margin-top: auto;
        align-self: center;
        width: auto !important; /* Don't stretch on desktop */
    }
}

/* ==========================================================================
   Location Lists - Fix Alignment on Mobile
   ========================================================================== */

@media (max-width: 768px) {
    /* Service area lists - centered with tighter spacing */
    .service-area-card {
        text-align: center !important;
    }
    
    .service-area-card ul {
        padding-left: 0 !important;
        margin: 0.25rem 0 !important;
        list-style: none !important;
        text-align: center !important;
    }
    
    .service-area-card li {
        font-size: 0.9rem;
        line-height: 1.3 !important;
        text-align: center !important;
        padding: 0.05rem 0 !important;
    }
    
    /* Ensure proper text wrapping */
    .service-area-card h4 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem !important;
        text-align: center;
    }
    
    /* Container padding adjustments */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Section padding adjustments */
    .section {
        padding: 2.5rem 0;
    }
}

/* ==========================================================================
   Hero Section Mobile Adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .hero-modern {
        padding: 60px 0 40px;
    }
    
    .hero-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-title-main {
        font-size: 2rem !important;
    }
    
    .hero-title-accent {
        font-size: 2.25rem !important;
        color: var(--off-white) !important;
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-ctas {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hero-ctas .btn {
        width: 100%;
        padding: 1rem;
    }
    
    /* Hide hero image on mobile for better readability */
    .hero-visual {
        display: none;
    }
}

/* ==========================================================================
   Footer Mobile Optimization
   ========================================================================== */

@media (max-width: 768px) {
    .footer-content {
        padding: 2rem 0;
    }
    
    .footer-top {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 1.5rem;
    }
    
    .footer-links {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    
    .footer-links a {
        padding: 0;
    }
    
    /* Fix Company section spacing to match Our Services */
    .footer-links > a {
        margin-bottom: 0;
    }
    
    /* Center footer brand and social section on mobile */
    .footer-brand {
        text-align: center !important;
        align-items: center !important;
        max-width: none !important;
        width: 100% !important;
    }
    
    .footer-logo {
        margin: 0 auto !important;
        display: block !important;
    }
    
    .footer-description {
        text-align: center !important;
    }
    
    .social-links {
        text-align: center !important;
    }
    
    .social-title {
        text-align: center !important;
    }
    
    .social-icons {
        justify-content: center !important;
    }
    
    /* Footer has normal padding now that bottom nav is removed */
    .footer {
        padding-bottom: 2rem !important;
    }
}

/* ==========================================================================
   Mobile Bottom Navigation - REMOVED
   ========================================================================== */

/* Mobile bottom navigation has been removed from the site */
.mobile-bottom-nav {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }
    
    /* Remove body padding that was added for bottom nav */
    body {
        padding-bottom: 0 !important;
    }
}

/* ==========================================================================
   Typography and Readability on Mobile
   ========================================================================== */

@media (max-width: 768px) {
    /* Improve heading sizes */
    h1 { 
        font-size: 1.875rem !important; 
        line-height: 1.2;
    }
    
    h2 { 
        font-size: 1.5rem !important;
        line-height: 1.3;
    }
    
    h3 { 
        font-size: 1.25rem !important;
        line-height: 1.4;
    }
    
    h4 { 
        font-size: 1.125rem !important;
        line-height: 1.4;
    }
    
    /* Improve paragraph readability */
    p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Button text consistency */
    .btn {
        font-size: 1rem !important;
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ==========================================================================
   Forms and Inputs Mobile Optimization
   ========================================================================== */

@media (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.875rem !important;
        border-radius: 8px;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        display: block;
    }
}

/* ==========================================================================
   Emergency Banner Mobile Fix
   ========================================================================== */

@media (max-width: 768px) {
    .emergency-banner {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        text-align: center;
    }
    
    .emergency-banner strong {
        display: block;
        margin-bottom: 0.25rem;
    }
}

/* ==========================================================================
   Utility Overrides for Mobile
   ========================================================================== */

@media (max-width: 768px) {
    /* Force proper display on mobile */
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    /* Text alignment utilities */
    .text-center-mobile {
        text-align: center !important;
    }
    
    .text-left-mobile {
        text-align: left !important;
    }
    
    /* Spacing utilities */
    .p-mobile-2 {
        padding: 1rem !important;
    }
    
    .m-mobile-0 {
        margin: 0 !important;
    }
    
    /* Center align contact items in footer on mobile */
    .contact-item {
        justify-content: center !important;
        text-align: center !important;
    }
    
    .contact-item div {
        align-items: center !important;
    }
    
    /* Stack CTA buttons vertically on mobile */
    .cta-section .flex-center {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .cta-section .flex-center .btn {
        width: 100% !important;
        max-width: 300px !important;
        margin-bottom: 0.5rem !important;
    }
    
    .cta-section .flex-center .btn:last-child {
        margin-bottom: 0 !important;
    }
    
    /* Stack Financing section vertically on mobile */
    .financing-banner .flex-between {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1.5rem !important;
    }
    
    .financing-banner .flex.gap-2 {
        flex-direction: column !important;
        width: 100% !important;
        align-items: center !important;
    }
    
    .financing-banner .finance-btn {
        width: 100% !important;
        max-width: 280px !important;
        margin-bottom: 0.5rem !important;
        justify-content: center !important;
    }
    
    .financing-banner .finance-btn:last-child {
        margin-bottom: 0 !important;
    }
}