/* Responsive Design Enhancements */

/* Extra Small Devices (phones, 320px and up) */
@media (max-width: 320px) {
    .container {
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .service-card,
    .doctor-card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .doctors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
    .hero-content {
        max-width: 600px;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .doctors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .about-image {
        order: -1;
        margin-bottom: 2rem;
    }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .doctors-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.4rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
}

/* Ultra Wide Screens (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .hero-slider {
        height: 80vh;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .service-icon img,
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .whatsapp-float,
    .hero-slider,
    .btn {
        display: none !important;
    }
    
    .section {
        page-break-inside: avoid;
    }
    
    .service-card,
    .doctor-card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .section-title {
        font-size: 18pt;
        margin-bottom: 12pt;
    }
}

/* Reduced Motion Preferences */
@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;
    }
    
    .hero-slider .hero-slide {
        animation: none;
    }
    
    .fade-in {
        opacity: 1;
        transform: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #1a1a1a;
        --light-gray: #2d2d2d;
        --gray: #b0b0b0;
        --dark-gray: #e0e0e0;
        --text-color: #e0e0e0;
        --border-color: #404040;
    }
    
    .header {
        background: rgba(26, 26, 26, 0.95);
        border-bottom-color: #404040;
    }
    
    .service-card,
    .doctor-card,
    .blog-card {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .footer {
        background: #1a1a1a;
    }
    
    .modal-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }
}

/* Landscape Orientation for Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-slider {
        height: 100vh;
    }
    
    .hero-content {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .section {
        padding: 3rem 0;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        padding: 1rem;
    }
    
    .service-card,
    .doctor-card {
        padding: 1.5rem;
    }
    
    .service-card:hover,
    .doctor-card:hover {
        transform: none;
    }
    
    .service-card:active,
    .doctor-card:active {
        transform: scale(0.98);
    }
}

/* Focus Styles for Accessibility */
@media (prefers-reduced-motion: no-preference) {
    .btn:focus,
    .nav-link:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* Container Queries (Future-proofing) */
@container (min-width: 400px) {
    .service-card {
        padding: 2rem;
    }
}

/* Flexible Grid System */
.grid {
    display: grid;
    gap: var(--grid-gap, 1rem);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(var(--min-column-width, 250px), 1fr));
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Utility Classes for Responsive Design */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
}

.hide-tablet {
    display: block;
}

.show-tablet {
    display: none;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none;
    }
    
    .show-tablet {
        display: block;
    }
}

.hide-desktop {
    display: block;
}

.show-desktop {
    display: none;
}

@media (min-width: 1025px) {
    .hide-desktop {
        display: none;
    }
    
    .show-desktop {
        display: block;
    }
}

/* Responsive Typography */
.text-responsive {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
}

.title-responsive {
    font-size: clamp(1.5rem, 4vw, 3rem);
}

.subtitle-responsive {
    font-size: clamp(1rem, 2vw, 1.25rem);
}

/* Responsive Spacing */
.spacing-responsive {
    padding: clamp(1rem, 3vw, 3rem);
}

.margin-responsive {
    margin: clamp(0.5rem, 2vw, 2rem);
}

/* Image Optimization */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.img-contain {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* Lazy Loading Support */
.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy.loaded {
    opacity: 1;
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Selection Styles */
::selection {
    background: var(--primary-color);
    color: var(--white);
}

::-moz-selection {
    background: var(--primary-color);
    color: var(--white);
}
