/* Mobile Responsiveness Enhancements */
/* This file addresses common mobile responsiveness issues across the website */

/* ===== GENERAL MOBILE IMPROVEMENTS ===== */

/* Ensure proper viewport behavior */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Improve touch targets */
button, 
.btn, 
.nav-link, 
.social-link,
.portfolio-item,
.gallery-item {
    min-height: 44px;
    min-width: 44px;
}

/* Fix horizontal scrolling issues */
body {
    overflow-x: hidden;
    width: 100%;
}

.container,
.container-fluid {
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== NAVIGATION MOBILE IMPROVEMENTS ===== */

@media (max-width: 991px) {
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem !important;
        margin: 0.25rem 0;
        border-radius: 8px;
        font-size: 0.95rem;
    }
}

@media (max-width: 576px) {
    .navbar-brand img {
        height: 32px;
    }
    
    .navbar-toggler {
        padding: 0.15rem 0.3rem;
        font-size: 0.85rem;
    }
}

/* ===== HERO SECTIONS MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .hero-section,
    .about-hero,
    .contact-hero,
    .services-hero,
    .projects-hero,
    .gallery-hero {
        background-attachment: scroll !important;
        min-height: 50vh !important;
        padding: 3rem 0 !important;
    }
    
    .hero-section h1,
    .about-hero h1,
    .contact-hero h1,
    .services-hero h1,
    .projects-hero h1,
    .gallery-hero h1 {
        font-size: clamp(1.5rem, 5vw, 2rem) !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-section .lead,
    .about-hero p,
    .contact-hero p,
    .services-hero p,
    .projects-hero .lead,
    .gallery-hero p {
        font-size: clamp(0.9rem, 3.5vw, 1rem) !important;
        line-height: 1.4 !important;
        margin-bottom: 1.5rem !important;
    }
    
    .hero-section .btn,
    .about-hero .btn,
    .contact-hero .btn,
    .services-hero .btn,
    .projects-hero .btn,
    .gallery-hero .btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        margin: 0.5rem !important;
        border-radius: 8px !important;
    }
}

@media (max-width: 576px) {
    .hero-section,
    .about-hero,
    .contact-hero,
    .services-hero,
    .projects-hero,
    .gallery-hero {
        min-height: 45vh !important;
        padding: 2.5rem 0 !important;
    }
    
    .hero-section h1,
    .about-hero h1,
    .contact-hero h1,
    .services-hero h1,
    .projects-hero h1,
    .gallery-hero h1 {
        font-size: clamp(1.3rem, 6vw, 1.8rem) !important;
        margin-bottom: 0.75rem !important;
    }
    
    .hero-section .lead,
    .about-hero p,
    .contact-hero p,
    .services-hero p,
    .projects-hero .lead,
    .gallery-hero p {
        font-size: clamp(0.85rem, 4vw, 0.95rem) !important;
        padding: 0 1rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    .hero-section .btn,
    .about-hero .btn,
    .contact-hero .btn,
    .services-hero .btn,
    .projects-hero .btn,
    .gallery-hero .btn {
        display: block !important;
        width: 100% !important;
        max-width: 250px !important;
        margin: 0.5rem auto !important;
        padding: 0.75rem 1.25rem !important;
        font-size: 0.85rem !important;
    }
}

/* ===== CONTENT SECTIONS MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }
    
    .col,
    .col-* {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Improve card layouts on mobile */
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    /* Better spacing for sections */
    .py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .py-4 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .py-5 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .py-4 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* ===== GALLERY MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .gallery-filters {
        margin: -2rem auto 2rem !important;
        padding: 1rem !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    
    .gallery-filters::-webkit-scrollbar {
        display: none !important;
    }
    
    .filter-btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        display: inline-block !important;
        white-space: nowrap !important;
        margin: 0 0.25rem !important;
        min-width: auto !important;
        border-radius: 25px !important;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 1.5rem !important;
        padding: 1rem 0 !important;
    }
    
    .gallery-item {
        margin-bottom: 0 !important;
        border-radius: 12px !important;
    }
    
    .gallery-item img {
        height: 220px !important;
    }
    
    .gallery-caption {
        transform: translateY(0) !important;
        padding: 1.25rem !important;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 70%, transparent 100%) !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0 0 12px 12px !important;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
        padding: 0.75rem 0 !important;
    }
    
    .gallery-item img {
        height: 200px !important;
    }
    
    .gallery-caption {
        padding: 1rem !important;
    }
    
    .gallery-caption h5 {
        font-size: 1rem !important;
    }
    
    .gallery-caption p {
        font-size: 0.85rem !important;
        -webkit-line-clamp: 3 !important;
    }
}

/* ===== PORTFOLIO/PROJECTS MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .portfolio-item,
    .project-card {
        margin-bottom: 1.5rem !important;
    }
    
    .portfolio-content,
    .project-content {
        transform: translateY(0) !important;
        background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.7) 70%, transparent 100%) !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 1.5rem !important;
        opacity: 1 !important;
        border-radius: 0 0 12px 12px !important;
    }
    
    .portfolio-item:hover,
    .project-card:hover {
        transform: none !important;
    }
}

@media (max-width: 576px) {
    .portfolio-content,
    .project-content {
        padding: 1rem !important;
    }
    
    .portfolio-content h5,
    .project-content h5 {
        font-size: 1rem !important;
    }
    
    .portfolio-content p,
    .project-content p {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }
}

/* ===== TEAM SECTION MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .team-card {
        margin-bottom: 1.5rem !important;
    }
    
    .portrait-container {
        height: 220px !important;
    }
    
    .team-card .card-body {
        padding: 1.25rem !important;
    }
    
    .team-card h3 {
        font-size: 1.1rem !important;
    }
    
    .team-card p {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 576px) {
    .portrait-container {
        height: 200px !important;
    }
    
    .team-card .card-body {
        padding: 1rem !important;
    }
    
    .team-card h3 {
        font-size: 1rem !important;
    }
    
    .team-card p {
        font-size: 0.85rem !important;
    }
}

/* ===== FORM MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem !important;
        border-radius: 8px !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }
}

@media (max-width: 576px) {
    .form-control,
    .form-select {
        padding: 0.7rem !important;
        font-size: 16px !important;
    }
    
    .btn {
        padding: 0.7rem 1.25rem !important;
        font-size: 0.85rem !important;
    }
}

/* ===== MODAL MOBILE IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem !important;
        max-width: calc(100% - 2rem) !important;
    }
    
    .modal-content {
        border-radius: 12px !important;
    }
    
    .modal-header {
        padding: 1rem !important;
    }
    
    .modal-body {
        padding: 1rem !important;
    }
    
    .modal-footer {
        padding: 1rem !important;
    }
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.75rem !important;
    }
}

/* ===== LIGHTBOX MOBILE IMPROVEMENTS ===== */

@media (max-width: 1024px) {
    .lightbox-content {
        flex-direction: column !important;
        max-height: 95vh !important;
        margin: 2.5vh auto !important;
        width: 95% !important;
        max-width: none !important;
    }
    
    .lightbox-image-container {
        min-height: 250px !important;
        max-height: 50vh !important;
        order: 1 !important;
    }
    
    .lightbox-sidebar {
        width: 100% !important;
        order: 2 !important;
        max-height: 45vh !important;
        overflow-y: auto !important;
    }
}

@media (max-width: 768px) {
    .lightbox-content {
        margin: 1vh auto !important;
        max-width: calc(100vw - 10px) !important;
        width: calc(100vw - 10px) !important;
        max-height: 98vh !important;
        border-radius: 8px !important;
    }
    
    .lightbox-image-container {
        min-height: 200px !important;
        max-height: 40vh !important;
    }
    
    .lightbox-sidebar {
        max-height: 55vh !important;
    }
}

/* ===== UTILITY MOBILE IMPROVEMENTS ===== */

/* Fix text overflow issues */
.text-truncate {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Improve button groups on mobile */
@media (max-width: 576px) {
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .btn-group .btn {
        border-radius: 8px !important;
        margin: 0.25rem 0 !important;
        width: 100% !important;
    }
    
    .btn-group .btn:first-child {
        border-radius: 8px !important;
    }
    
    .btn-group .btn:last-child {
        border-radius: 8px !important;
    }
}

/* Fix table responsiveness */
@media (max-width: 768px) {
    .table-responsive {
        border: 0 !important;
    }
    
    .table-responsive .table {
        font-size: 0.85rem !important;
    }
}

/* Improve spacing for mobile */
@media (max-width: 768px) {
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    
    .mt-5 {
        margin-top: 2rem !important;
    }
    
    .py-5 {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
}

@media (max-width: 576px) {
    .mb-5 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-5 {
        margin-top: 1.5rem !important;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Improve focus visibility */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid var(--bs-primary) !important;
    outline-offset: 2px !important;
}

/* Better contrast for mobile */
@media (max-width: 768px) {
    .text-muted {
        color: #6c757d !important;
    }
    
    .bg-light {
        background-color: #f8f9fa !important;
    }
}

/* ===== PERFORMANCE IMPROVEMENTS ===== */

/* Optimize animations for mobile */
@media (max-width: 768px) {
    .portfolio-item,
    .gallery-item,
    .team-card {
        transition: none !important;
    }
    
    .portfolio-item:hover,
    .gallery-item:hover,
    .team-card:hover {
        transform: none !important;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
