/* ========================================
   Responsive Design Fixes & Enhancements
   ======================================== */

/* Mobile Navigation Fix */
@media (max-width: 991px) {
    .navbar-navigation {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        padding: 80px 20px 20px;
        overflow-y: auto;
        z-index: 1000;
        flex-direction: column;
        gap: 0;
    }

    .navbar-active .navbar-navigation {
        left: 0;
    }

    .navbar-navigation-root-item {
        width: 100%;
        border-bottom: 1px solid #DDE0E9;
    }

    .navbar-navigation-root-link {
        display: block;
        padding: 15px 0;
    }

    .navbar-switch {
        display: block;
        background: none;
        border: none;
        font-size: 1.8rem;
        cursor: pointer;
        color: #1e306e;
        padding: 10px;
    }

    .navbar-switch::before {
        content: "☰";
    }

    .navbar-active .navbar-switch::before {
        content: "✕";
    }

    /* Mobile overlay */
    .navbar-active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

/* Header Responsive Improvements */
@media (max-width: 991px) {
    .navbar-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .navbar-info {
        width: 100%;
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .navbar-info .btn {
        width: 100%;
        justify-content: center;
    }

    .text-block-2 {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
}

/* Hero Section Responsive */
@media (max-width: 767px) {
    .hero-gastro {
        padding-top: 20px;
    }

    .hero-gastro h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-gastro h5 {
        font-size: 1.125rem;
    }

    .hero-gastro img {
        margin-top: 1.5rem !important;
    }
}

/* Service Cards - Better Mobile Grid */
@media (max-width: 991px) {
    .grid-auto-fit {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 575px) {
    .grid-auto-fit {
        grid-template-columns: 1fr;
    }

    .service-card {
        padding: 1.5rem;
    }
}

/* About Section - Doctor Photo Responsive */
@media (max-width: 767px) {
    .doctor-photo-wrapper {
        margin-bottom: 2rem;
    }

    .doctor-photo-wrapper img {
        max-width: 280px !important;
    }

    .col-md-5,
    .col-md-7 {
        text-align: center;
    }

    .blurb-item {
        align-items: center !important;
        text-align: center !important;
    }
}

/* Buttons Responsive */
@media (max-width: 575px) {
    .btn-group-1 {
        flex-direction: column;
        width: 100%;
    }

    .btn-group-1 .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Footer Responsive */
@media (max-width: 991px) {
    .footer .row {
        gap: 30px 0;
    }

    .footer .col-sm-6,
    .footer .col-lg-3 {
        width: 100%;
        margin-bottom: 30px;
    }
}

@media (max-width: 575px) {
    .footer {
        text-align: center;
    }

    .footer .list {
        text-align: left;
    }

    .footer h4,
    .footer h5 {
        text-align: center;
    }
}

/* Footer Responsive */
@media (max-width: 991px) {
    .footer .row {
        gap: 30px 0;
    }

    .footer .col-sm-6,
    .footer .col-lg-2,
    .footer .col-lg-3,
    .footer .col-lg-4 {
        width: 100%;
        margin-bottom: 30px;
    }

    .footer-minimal-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 575px) {
    .footer {
        text-align: center;
    }

    .footer .list {
        text-align: left;
    }

    .footer h3,
    .footer h4,
    .footer h5 {
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .social {
        justify-content: center;
    }
}

/* Contact Form Responsive */
@media (max-width: 767px) {
    .box {
        padding: 1.5rem;
    }

    .box-title {
        font-size: 1.5rem;
    }

    .form-control {
        font-size: 1rem;
        padding: 10px 14px;
    }
}

/* Image Responsive Improvements */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Section Padding Adjustments */
@media (max-width: 767px) {
    .section {
        padding: 40px 0;
    }

    .section-md {
        padding: 50px 0;
    }

    .section-offset-3 {
        margin-top: -60px;
    }
}

/* Typography Responsive */
@media (max-width: 575px) {
    body {
        font-size: 1rem;
    }

    .small {
        font-size: 0.875rem;
    }

    .title-1 {
        font-size: 0.75rem;
    }
}

/* Testimonial Cards Responsive */
@media (max-width: 1199px) {
    .col-xl-4 {
        width: 50%;
    }
}

@media (max-width: 767px) {
    .col-xl-4 {
        width: 100%;
    }

    .quote {
        padding: 1.5rem;
    }
}

/* Advantages Section Responsive */
@media (max-width: 767px) {
    .col-md-3 {
        width: 50%;
    }
}

@media (max-width: 479px) {
    .col-6 {
        width: 100%;
    }
}

/* List Responsive */
@media (max-width: 991px) {
    .col-lg-4 {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* Spacing Utilities for Mobile */
@media (max-width: 767px) {
    .row-content {
        margin-bottom: 20px;
    }

    .text-block {
        margin-bottom: 1.5rem;
    }

    .text-block-6 {
        margin-bottom: 2rem;
    }
}

/* Fix Column Stacking on Mobile */
@media (max-width: 767px) {

    .col-md-6,
    .col-md-8 {
        width: 100% !important;
    }

    .row>* {
        margin-bottom: 20px;
    }
}

/* Navbar Sticky Header */
.navbar-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

/* Fix Long Text Overflow */
.blurb-title,
.quote-text,
.service-card p {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Improve Touch Targets for Mobile */
@media (max-width: 767px) {
    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }

    .navbar-navigation-root-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .link {
        padding: 5px 0;
    }
}

/* Horizontal Scroll Prevention */
body {
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    overflow-x: hidden;
}

/* Icon Sizing for Mobile */
@media (max-width: 575px) {
    .icon-gastro {
        width: 56px;
        height: 56px;
        padding: 12px;
    }

    .icon-gastro svg {
        width: 40px;
        height: 40px;
    }
}

/* Better Alignment */
.align-items-center {
    align-items: center;
}

.justify-content-center {
    justify-content: center;
}

.text-center {
    text-align: center;
    padding-bottom: 56px;
}

/* Mobile-Friendly Tables (if any added later) */
@media (max-width: 767px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Accessibility - Focus States */
*:focus {
    outline: 2px solid var(--primary-color, #2D8B8B);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--primary-color, #2D8B8B);
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .navbar,
    .footer,
    .btn {
        display: none;
    }

    .section {
        page-break-inside: avoid;
    }

    a {
        text-decoration: underline;
    }
}

/* ==========================================
   MOBILE VIEW ALIGNMENT FIXES
   Complete mobile responsive alignment
   ========================================== */

/* General Mobile Alignment */
@media (max-width: 767px) {

    /* Center all text content */
    .text-block,
    .text-center {
        text-align: center !important;
    }

    /* Container padding */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Section titles */
    .title-1,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        text-align: center !important;
    }

    /* Paragraphs in sections */
    .section p {
        text-align: center !important;
    }

    /* Rows stack properly */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .row>* {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

/* Hero Section Mobile */
@media (max-width: 767px) {

    .hero-gastro,
    .hero-with-bg {
        padding: 40px 0 !important;
        text-align: center !important;
    }

    .hero-gastro h1 {
        font-size: 1.75rem !important;
        line-height: 1.3 !important;
    }

    .hero-gastro h5 {
        font-size: 1rem !important;
    }

    .btn-group-1 {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }

    .btn-group-1 .btn {
        width: 100% !important;
        max-width: 280px !important;
        justify-content: center !important;
    }
}

/* Advantages Section Mobile */
@media (max-width: 767px) {
    #advantages .row {
        justify-content: center !important;
    }

    #advantages .col-6,
    #advantages .col-md-3 {
        width: 50% !important;
        text-align: center !important;
    }

    .blurb-simple {
        text-align: center !important;
    }

    .blurb-item {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .icon-gastro {
        margin: 0 auto 1rem !important;
    }

    .blurb-title {
        text-align: center !important;
    }
}

@media (max-width: 480px) {

    #advantages .col-6,
    #advantages .col-md-3 {
        width: 100% !important;
    }
}

/* About Section Mobile */
@media (max-width: 767px) {
    #about .row {
        flex-direction: column-reverse !important;
    }

    #about .col-md-5,
    #about .col-md-7 {
        width: 100% !important;
        text-align: center !important;
    }

    .doctor-photo-wrapper {
        text-align: center !important;
        margin-bottom: 2rem !important;
    }

    .doctor-photo-wrapper img {
        margin: 0 auto !important;
        max-width: 250px !important;
    }
}

/* Services Section Mobile */
@media (max-width: 767px) {
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .service-card {
        text-align: center !important;
        padding: 1.5rem !important;
    }

    .service-card:hover {
        transform: translateY(-4px) !important;
    }
}

/* Conditions Section Mobile */
@media (max-width: 767px) {
    .conditions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .condition-card {
        padding: 1.25rem !important;
        text-align: center !important;
    }

    .condition-card h5 {
        font-size: 0.95rem !important;
    }

    .condition-card .small {
        font-size: 0.8rem !important;
        line-height: 1.5 !important;
    }

    .condition-icon {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.25rem !important;
    }
}

@media (max-width: 480px) {
    .conditions-grid {
        grid-template-columns: 1fr !important;
    }

    .condition-card {
        padding: 1.5rem !important;
    }

    .condition-card h5 {
        font-size: 1rem !important;
    }
}

/* Testimonials Section Mobile */
@media (max-width: 767px) {
    .testimonials-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .quote {
        padding: 1.5rem !important;
        text-align: center !important;
    }

    .quote-body-inner {
        text-align: center !important;
    }

    .quote-author {
        justify-content: center !important;
    }
}

/* Appointment Section Mobile */
@media (max-width: 767px) {
    #appointment {
        text-align: center !important;
    }

    #appointment .col-md-8,
    #appointment .col-lg-6 {
        width: 100% !important;
    }

    .list-icons-2 {
        justify-content: center !important;
    }
}

/* Contact Form Mobile */
@media (max-width: 767px) {
    #contact .col-md-8 {
        width: 100% !important;
    }

    .box {
        padding: 1.5rem !important;
    }

    .box-header {
        text-align: center !important;
    }

    .form-group {
        margin-bottom: 1rem !important;
    }

    .form-control {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
    }
}

/* Footer Mobile - Enhanced */
@media (max-width: 767px) {
    .footer {
        text-align: center !important;
        padding: 40px 15px 25px !important;
    }

    .footer .row>div {
        width: 100% !important;
        margin-bottom: 2rem !important;
    }

    .footer-brand {
        text-align: center !important;
        padding-right: 0 !important;
    }

    .footer-title {
        text-align: center !important;
    }

    .footer .list {
        text-align: center !important;
    }

    .footer-contact {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .footer-contact-item {
        justify-content: center !important;
        text-align: left !important;
    }

    .clinic-hours {
        text-align: center !important;
    }

    .clinic-hours .list-item {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }

    .clinic-hours strong {
        display: block !important;
        width: 100% !important;
        margin-bottom: 0.25rem !important;
    }

    .social {
        justify-content: center !important;
    }

    .footer .btn-secondary {
        display: block !important;
        margin: 1rem auto 0 !important;
        max-width: 200px !important;
    }

    .footer-minimal-inner {
        flex-direction: column !important;
        text-align: center !important;
        gap: 0.75rem !important;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {

    /* Even smaller fonts */
    h1 {
        font-size: 1.5rem !important;
    }

    h2 {
        font-size: 1.35rem !important;
    }

    h3 {
        font-size: 1.2rem !important;
    }

    h4,
    h5 {
        font-size: 1rem !important;
    }

    .section {
        padding: 30px 0 !important;
    }

    .section-md {
        padding: 40px 0 !important;
    }

    /* Compact buttons */
    .btn {
        padding: 10px 20px !important;
        font-size: 0.875rem !important;
    }

    .btn-lg {
        padding: 12px 24px !important;
        font-size: 1rem !important;
    }
}