/* 
 * Responsive Utilities for Neo Smile Dental Clinic
 * Comprehensive responsive design for all devices
 */

/* ========================================
   BASE RESPONSIVE SETTINGS
   ======================================== */

/* Ensure smooth box sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   MOBILE FIRST (up to 576px)
   ======================================== */

@media (max-width: 575.98px) {
    /* Typography */
    body {
        font-size: 14px;
    }

    /* Containers */
    .container,
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Buttons full width */
    .btn-group-responsive .btn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }

    /* Cards */
    .card {
        margin-bottom: 20px;
    }

    /* Forms */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Navigation */
    .navbar-nav {
        text-align: center;
    }

    .navbar-nav .nav-link {
        padding: 12px 0;
    }

    /* Utility classes */
    .text-sm-center {
        text-align: center !important;
    }

    .mb-sm-3 {
        margin-bottom: 1rem !important;
    }

    .py-sm-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* ========================================
   SMALL DEVICES (576px - 767px)
   ======================================== */

@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }

    /* Typography adjustments */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

/* ========================================
   MEDIUM DEVICES (768px - 991px) - Tablets
   ======================================== */

@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 720px;
    }

    /* Two column layout for cards */
    .responsive-grid .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Adjust font sizes */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    /* Navigation */
    .navbar-expand-lg .navbar-nav .nav-link {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
}

/* ========================================
   LARGE DEVICES (992px - 1199px)
   ======================================== */

@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }

    /* Slightly reduce padding for better fit */
    .px-lg-5 {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}

/* ========================================
   EXTRA LARGE DEVICES (1200px and up)
   ======================================== */

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */

@media (max-width: 767.98px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .hero-section,
    .carousel-item {
        min-height: 350px !important;
    }

    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Adjust modals */
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    button,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .hover-effect:hover {
        transform: none !important;
    }

    /* Prevent double-tap zoom */
    * {
        touch-action: manipulation;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Responsive visibility */
.d-mobile-none {
    display: none !important;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block !important;
    }
}

.d-desktop-none {
    display: block !important;
}

@media (min-width: 768px) {
    .d-desktop-none {
        display: none !important;
    }
}

/* Responsive text alignment */
.text-mobile-center {
    text-align: center;
}

@media (min-width: 768px) {
    .text-mobile-center {
        text-align: left;
    }
}

/* Responsive spacing */
@media (max-width: 767.98px) {
    .px-mobile-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .py-mobile-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .mb-mobile-3 {
        margin-bottom: 1rem !important;
    }

    .mt-mobile-3 {
        margin-top: 1rem !important;
    }
}

/* ========================================
   COMPONENT SPECIFIC RESPONSIVE
   ======================================== */

/* Navbar */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: #fff;
        padding: 15px;
        border-radius: 8px;
        margin-top: 10px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }

    .navbar-nav .dropdown-menu {
        border: none;
        box-shadow: none;
        padding-left: 20px;
        background: transparent;
    }
}

/* Cards responsive grid */
@media (max-width: 767.98px) {
    .card-deck {
        flex-direction: column;
    }

    .card-deck .card {
        margin-bottom: 15px;
    }
}

/* Tables */
@media (max-width: 767.98px) {
    .table-responsive-sm {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive-sm table {
        min-width: 600px;
    }
}

/* Modals */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-fullscreen-sm-down {
        width: 100vw;
        max-width: none;
        height: 100%;
        margin: 0;
    }

    .modal-fullscreen-sm-down .modal-content {
        height: 100%;
        border: 0;
        border-radius: 0;
    }
}

/* Carousel */
@media (max-width: 767.98px) {
    .carousel-caption {
        padding: 1rem;
        bottom: 1rem;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
    }

    .carousel-indicators {
        margin-bottom: 0.5rem;
    }

    .carousel-indicators [data-bs-target] {
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }
}

/* Footer */
@media (max-width: 767.98px) {
    .footer-column {
        margin-bottom: 30px;
        text-align: center;
    }

    .footer-column:last-child {
        margin-bottom: 0;
    }

    .footer .social-links {
        justify-content: center;
    }
}

/* Forms */
@media (max-width: 767.98px) {
    .form-row {
        margin-left: 0;
        margin-right: 0;
    }

    .form-row > .col,
    .form-row > [class*="col-"] {
        padding-left: 0;
        padding-right: 0;
        margin-bottom: 15px;
    }
}

/* Fixed Buttons - WhatsApp & Back to Top */
@media (max-width: 767.98px) {
    .whatsapp-widget {
        bottom: 15px !important;
        right: 15px !important;
    }

    .whatsapp-btn {
        width: 55px !important;
        height: 55px !important;
    }

    .whatsapp-btn i {
        font-size: 22px !important;
    }

    .back-to-top {
        bottom: 80px !important;
        right: 15px !important;
        width: 55px !important;
        height: 55px !important;
    }

    .back-to-top i {
        font-size: 22px !important;
    }
}

@media (max-width: 575.98px) {
    .whatsapp-btn,
    .back-to-top {
        width: 50px !important;
        height: 50px !important;
    }

    .whatsapp-btn i,
    .back-to-top i {
        font-size: 20px !important;
    }

    .back-to-top {
        bottom: 75px !important;
    }
}


/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid #06A3DA;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
}

.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
    background: #06A3DA;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Reduce animations on low-end devices */
@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;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* High contrast mode */
@media (prefers-contrast: high) {
    button,
    a {
        outline: 2px solid currentColor;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    /* Hide non-essential elements */
    .navbar,
    .footer,
    .whatsapp-widget,
    .back-to-top,
    button:not(.print-show),
    .carousel-control-prev,
    .carousel-control-next {
        display: none !important;
    }

    /* Optimize for printing */
    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
}
