/* Comprehensive Mobile Responsive Styles for Govind Ayurveda Hospital */

/* Critical Mobile Viewport and Scaling Fixes */
/* Ensure proper viewport scaling and prevent zoom issues */
@viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 1.0;
    user-scalable: no;
}

/* Override any conflicting styles from other CSS files */
@media (max-width: 991.98px) {
    /* Force proper container behavior */
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    /* Override Bootstrap grid for mobile consistency */
    .row {
        margin-left: -15px !important;
        margin-right: -15px !important;
    }
    
    [class*="col-"] {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

/* Base Mobile Optimizations */
@media (max-width: 991.98px) {
    /* Container adjustments */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Section padding adjustments */
    .features-section,
    .about-section,
    .doctors-section,
    .testimonial-section,
    .products-section,
    .faq-section {
        padding: 60px 0 40px 0;
    }
    
    /* Typography scaling */
    .section-title {
        font-size: 2rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Hero section mobile adjustments */
    .hero-section {
        min-height: 60vh;
        padding: 2rem 0;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
        line-height: 1.3;
        margin-bottom: 15px;
    }
    
    .hero-content p {
        font-size: 1.1rem;
        margin-bottom: 25px;
        line-height: 1.5;
    }
    
    .hero-content .btn {
        margin-bottom: 10px;
        width: auto;
        min-width: 150px;
    }
}

@media (max-width: 767.98px) {
    /* Further mobile optimizations */
    .features-section,
    .about-section,
    .doctors-section,
    .testimonial-section,
    .products-section,
    .faq-section {
        padding: 50px 0 30px 0;
    }
    
    /* Typography for smaller screens */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }
    
    /* Hero section for phones */
    .hero-section {
        min-height: 55vh;
        padding: 1.5rem 0;
    }
    
    .hero-content h1 {
        font-size: 1.9rem;
        line-height: 1.25;
        margin-bottom: 12px;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 20px;
        line-height: 1.4;
    }
    
    /* Button stacking on mobile */
    .hero-content .btn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Feature cards mobile */
    .feature-card {
        text-align: center;
        padding: 1.5rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    .feature-card h3 {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }
    
    .feature-card p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    /* About section mobile */
    .about-section .row {
        flex-direction: column-reverse;
    }
    
    .about-section h2 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    .about-section .lead {
        font-size: 1.1rem;
        text-align: center;
        margin-bottom: 1.5rem;
    }
    
    .about-section p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    .cert-buttons-row {
        text-align: center;
        margin-top: 1.5rem;
    }
    
    .cert-buttons-row .btn {
        margin-bottom: 10px;
        width: 100%;
        max-width: 250px;
    }
    
    /* Doctor cards mobile */
    .doctor-card {
        margin-bottom: 1.5rem;
    }
    
    .doctor-card .card-title {
        font-size: 1.2rem;
    }
    
    .doctor-card p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    /* Testimonial cards mobile */
    .testimonial-card {
        margin-bottom: 2rem;
        padding: 1.5rem;
    }
    
    .testimonial-card h5 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    .testimonial-card p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    /* Product cards mobile */
    .product-card {
        margin-bottom: 1.5rem;
    }
    
    .product-card .card-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    .product-card .price {
        font-size: 1.2rem;
        padding: 8px 16px;
        margin-bottom: 0.75rem;
    }
    
    .product-card .btn {
        font-size: 0.9rem;
        padding: 8px 16px;
        margin-bottom: 8px;
    }
    
    /* FAQ section mobile */
    .accordion-button {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
    }
    
    .accordion-body {
        font-size: 0.9rem;
        line-height: 1.5;
        padding: 1rem;
    }
    
    .accordion-body ul,
    .accordion-body ol {
        padding-left: 1.25rem;
    }
    
    .accordion-body li {
        margin-bottom: 0.25rem;
    }
    
    /* News section mobile */
    .news-section .card-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    .news-section .card-text {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .news-section .btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    /* Signature Treatments mobile */
    .featured-treatments {
        padding: 50px 0 40px 0;
    }
    
    .treatment-highlight-card {
        margin-bottom: 2rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    
    .treatment-highlight-img {
        height: 200px;
        overflow: hidden;
    }
    
    .treatment-badge {
        font-size: 0.7rem;
        padding: 6px 14px;
        min-width: 95px;
        letter-spacing: 0.8px;
        top: 12px;
    }
    
    .treatment-highlight-content {
        padding: 1.5rem 1.2rem;
    }
    
    .treatment-highlight-content h3 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }
    
    .treatment-highlight-content p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    .treatment-highlight-content .btn {
        font-size: 0.9rem;
        padding: 8px 16px;
    }
}

@media (max-width: 575.98px) {
    /* Extra small screens */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Section padding for very small screens */
    .features-section,
    .about-section,
    .doctors-section,
    .testimonial-section,
    .products-section,
    .faq-section {
        padding: 40px 0 25px 0;
    }
    
    /* Typography for very small screens */
    .section-title {
        font-size: 1.6rem;
        margin-bottom: 0.75rem;
        line-height: 1.3;
    }
    
    .section-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
        line-height: 1.4;
    }
    
    /* Hero section for very small phones */
    .hero-section {
        min-height: 50vh;
        padding: 1rem 0;
    }
    
    .hero-content h1 {
        font-size: 1.7rem;
        line-height: 1.2;
        margin-bottom: 10px;
    }
    
    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 15px;
        line-height: 1.35;
    }
    
    .hero-content .btn {
        font-size: 0.95rem;
        padding: 10px 20px;
    }
    
    /* Feature cards for very small screens */
    .feature-card {
        padding: 1.25rem 0.75rem;
    }
    
    .feature-card h3 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }
    
    .feature-card p {
        font-size: 0.85rem;
        line-height: 1.35;
    }
    
    .feature-icon {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    /* Card adjustments for very small screens */
    .card-body {
        padding: 1rem 0.75rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
    
    .btn-lg {
        font-size: 0.95rem;
        padding: 10px 20px;
    }
    
    /* FAQ for very small screens */
    .accordion-button {
        font-size: 0.9rem;
        padding: 0.6rem 0.75rem;
    }
    
    .accordion-body {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    /* Signature Treatments for very small screens */
    .featured-treatments {
        padding: 40px 0 30px 0;
    }
    
    .treatment-highlight-img {
        height: 160px;
    }
    
    .treatment-badge {
        font-size: 0.65rem;
        padding: 5px 12px;
        min-width: 90px;
        letter-spacing: 0.7px;
        top: 10px;
    }
    
    .treatment-highlight-content {
        padding: 1.25rem 1rem;
    }
    
    .treatment-highlight-content h3 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .treatment-highlight-content p {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 0.9rem;
    }
    
    .treatment-highlight-content .btn {
        font-size: 0.85rem;
        padding: 7px 14px;
        width: 100%;
        max-width: 200px;
    }
}

/* Landscape orientation fixes */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        min-height: 85vh;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }
}

/* Touch-friendly improvements */
@media (max-width: 767.98px) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Better spacing for touch */
    .card {
        margin-bottom: 1rem;
    }
    
    .form-control {
        min-height: 44px;
    }
    
    .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Fix for floating action button on mobile */
@media (max-width: 767.98px) {
    .floating-button-mobile {
        bottom: 20px;
        right: 20px;
    }
    
    .floating-button {
        display: none !important;
    }
}

/* Ensure proper text readability on mobile */
@media (max-width: 767.98px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
    }
    
    p {
        line-height: 1.5;
    }
    
    .lead {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    /* Additional Signature Treatments mobile fixes */
    .featured-treatments .display-5 {
        font-size: 1.8rem;
        margin-bottom: 1.2rem;
        letter-spacing: 1px;
    }
    
    .separator-line {
        width: 80px;
        height: 3px;
        margin-bottom: 1.5rem;
    }
    
    .featured-treatments .lead {
        font-size: 1rem;
        margin-bottom: 2rem;
        padding: 0 15px;
    }
    
    /* Ensure cards are full width on mobile */
    .treatment-highlight-card {
        width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Better spacing for "View All Treatments" button */
    .featured-treatments .btn-lg {
        font-size: 1rem;
        padding: 12px 24px;
        margin-top: 1rem;
    }
}

/* Additional improvements for mobile landscape */
@media (max-width: 767.98px) and (orientation: landscape) {
    .featured-treatments {
        padding: 30px 0 25px 0;
    }
    
    .treatment-highlight-img {
        height: 140px;
    }
    
    .treatment-highlight-content {
        padding: 1rem 0.9rem;
    }
    
    .treatment-highlight-content h3 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
    }
    
    .treatment-highlight-content p {
        font-size: 0.85rem;
        margin-bottom: 0.8rem;
    }
}

/* Signature Treatments Section - Mobile Priority Styles */
@media (max-width: 991.98px) {
    .featured-treatments {
        background-color: #ffffff !important;
        padding: 50px 0 40px 0 !important;
        overflow: hidden !important;
    }
    
    .featured-treatments .display-5 {
        font-size: 1.9rem !important;
        font-weight: 800 !important;
        color: #1b5e20 !important;
        letter-spacing: 1px !important;
        text-align: center !important;
        margin-bottom: 1.2rem !important;
    }
    
    .separator-line {
        width: 80px !important;
        height: 3px !important;
        background-color: #43a047 !important;
        margin: 0 auto 1.5rem auto !important;
        border-radius: 4px !important;
    }
    
    .featured-treatments .lead {
        font-size: 1rem !important;
        text-align: center !important;
        margin-bottom: 2rem !important;
        padding: 0 15px !important;
        line-height: 1.5 !important;
    }
    
    .treatment-highlight-card {
        background: #ffffff !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
        overflow: hidden !important;
        margin-bottom: 2rem !important;
        transition: all 0.3s ease !important;
        height: auto !important;
        width: 100% !important;
    }
    
    .treatment-highlight-img {
        position: relative !important;
        overflow: hidden !important;
        height: 200px !important;
        width: 100% !important;
    }
    
    .treatment-highlight-img img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
    }
    
    .treatment-badge {
        position: absolute !important;
        top: 12px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        background: #1b5e20 !important;
        color: #ffffff !important;
        font-size: 0.7rem !important;
        font-weight: 500 !important;
        padding: 6px 14px !important;
        border-radius: 50px !important;
        letter-spacing: 0.8px !important;
        min-width: 95px !important;
        text-align: center !important;
        z-index: 3 !important;
        text-transform: uppercase !important;
        box-shadow: 0 3px 12px rgba(27, 94, 32, 0.2) !important;
        white-space: nowrap !important;
    }
    
    .treatment-highlight-content {
        padding: 1.5rem 1.2rem !important;
        text-align: center !important;
        background: #ffffff !important;
    }
    
    .treatment-highlight-content h3 {
        font-size: 1.3rem !important;
        font-weight: 700 !important;
        color: #1b5e20 !important;
        margin-bottom: 0.8rem !important;
        line-height: 1.3 !important;
    }
    
    .treatment-highlight-content p {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
        margin-bottom: 1rem !important;
        color: #555 !important;
    }
    
    .treatment-highlight-content .btn {
        font-size: 0.9rem !important;
        padding: 8px 16px !important;
        border-radius: 6px !important;
        transition: all 0.3s ease !important;
    }
    
    /* View All Treatments Button */
    .featured-treatments .btn-lg {
        font-size: 1rem !important;
        padding: 12px 24px !important;
        margin-top: 1rem !important;
        border-radius: 8px !important;
    }
}

/* Tablet Adjustments */
@media (min-width: 768px) and (max-width: 991.98px) {
    .treatment-highlight-img {
        height: 220px !important;
    }
    
    .treatment-badge {
        font-size: 0.75rem !important;
        padding: 6px 15px !important;
        min-width: 100px !important;
    }
    
    .treatment-highlight-content {
        padding: 1.75rem 1.5rem !important;
    }
    
    .treatment-highlight-content h3 {
        font-size: 1.4rem !important;
    }
    
    .treatment-highlight-content p {
        font-size: 1rem !important;
    }
}

/* Phone Specific */
@media (max-width: 575.98px) {
    .featured-treatments {
        padding: 40px 0 30px 0 !important;
    }
    
    .treatment-highlight-img {
        height: 160px !important;
    }
    
    .treatment-badge {
        font-size: 0.65rem !important;
        padding: 5px 12px !important;
        min-width: 90px !important;
        top: 10px !important;
    }
    
    .treatment-highlight-content {
        padding: 1.25rem 1rem !important;
    }
    
    .treatment-highlight-content h3 {
        font-size: 1.2rem !important;
    }
    
    .treatment-highlight-content p {
        font-size: 0.9rem !important;
    }
    
    .treatment-highlight-content .btn {
        width: 100% !important;
        max-width: 200px !important;
        font-size: 0.85rem !important;
        padding: 7px 14px !important;
    }
}

/* Final Mobile Consistency and Performance Optimizations */

/* Disable problematic animations on mobile for better performance */
@media (max-width: 767.98px) {
    *, *::before, *::after {
        animation-duration: 0.1s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1s !important;
    }
    
    /* Disable hover effects on touch devices */
    .treatment-highlight-card:hover {
        transform: none !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    }
}

/* Ensure consistent font rendering on mobile */
@media (max-width: 991.98px) {
    body, .container, .row, [class*="col-"] {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }
    
    /* Optimize images for mobile */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Better touch interaction */
    button, .btn, a {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

/* Force proper width calculation on all devices */
* {
    box-sizing: border-box !important;
}

/* Prevent horizontal scrolling on mobile */
@media (max-width: 991.98px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .container-fluid, .container {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .row {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: -15px !important;
        margin-right: -15px !important;
    }
}

/* Ensure signature treatments section is always visible and properly styled */
.featured-treatments {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Add loading optimization for signature treatments images */
@media (max-width: 991.98px) {
    .treatment-highlight-img img[loading="lazy"] {
        transition: opacity 0.3s ease;
    }
    
    .treatment-highlight-img img[loading="lazy"]:not([data-loaded]) {
        opacity: 0.8;
    }
    
    .treatment-highlight-img img[loading="lazy"][data-loaded] {
        opacity: 1;
    }
}

/* Touch Device Specific Styles */
.touch-device .treatment-highlight-card {
    transition: none !important;
}

.touch-device .treatment-highlight-card.touch-active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
}

.touch-device .btn:active,
.touch-device .treatment-highlight-card:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
}

/* Mobile Device Class Specific Styles */
.mobile-device .hero-section {
    min-height: 60vh !important;
}

.mobile-device .featured-treatments {
    padding: 50px 0 40px 0 !important;
}

.mobile-device .treatment-highlight-card {
    margin-bottom: 2rem !important;
}

.mobile-device .section-title {
    font-size: 1.9rem !important;
}

.mobile-device .treatment-highlight-content h3 {
    font-size: 1.3rem !important;
}

/* Additional safety overrides for mobile consistency */
@media (max-width: 991.98px) {
    .row > * {
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        padding-left: calc(var(--bs-gutter-x) * 0.5);
        padding-right: calc(var(--bs-gutter-x) * 0.5);
        margin-top: var(--bs-gutter-y);
    }
    
    .col-lg-4 {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .col-md-6 {
        width: 100% !important;
        max-width: 100% !important;
    }
}
