/* إصلاحات الـ Viewport للتأكد من عمل الـ responsive بشكل صحيح */

/* إعدادات أساسية للـ viewport */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* منع التكبير غير المرغوب فيه */
@viewport {
    width: device-width;
    initial-scale: 1;
    maximum-scale: 5;
    minimum-scale: 0.5;
    user-scalable: yes;
}

/* إصلاحات للأجهزة المختلفة */
@media screen and (max-width: 320px) {
    html {
        font-size: 14px;
    }
}

@media screen and (min-width: 321px) and (max-width: 768px) {
    html {
        font-size: 15px;
    }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
    html {
        font-size: 16px;
    }
}

@media screen and (min-width: 1025px) {
    html {
        font-size: 16px;
    }
}

/* إصلاحات للأجهزة المحمولة */
@media only screen and (max-device-width: 768px) {
    body {
        -webkit-text-size-adjust: none;
    }
}

/* إصلاحات للتابلت */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    body {
        -webkit-text-size-adjust: 100%;
    }
}

/* إصلاحات للشاشات عالية الكثافة */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi),
       only screen and (min-resolution: 2dppx) {
    
    .logo-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* إصلاحات الاتجاه */
@media screen and (orientation: portrait) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
}

@media screen and (orientation: landscape) and (max-height: 500px) {
    .medical-hero {
        min-height: 70vh;
    }
    
    .navbar {
        padding: 5px 0;
    }
    
    body {
        padding-top: 80px;
    }
}

/* إصلاحات خاصة بـ iOS */
@supports (-webkit-touch-callout: none) {
    .form-control {
        font-size: 16px !important;
        transform: translateZ(0);
    }
    
    .btn {
        transform: translateZ(0);
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* إصلاحات خاصة بـ Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select {
        background-image: none;
    }
}

/* إصلاحات للشاشات الصغيرة جداً */
@media screen and (max-width: 280px) {
    .container {
        padding: 0 10px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .logo-img {
        height: 30px;
    }
    
    .medical-hero-title {
        font-size: 1.4rem;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* إصلاحات للشاشات العريضة جداً */
@media screen and (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

@media screen and (min-width: 1600px) {
    .container {
        max-width: 1400px;
    }
}

/* إصلاحات لمتصفحات معينة */
/* Safari */
@media not all and (min-resolution:.001dpcm) {
    @supports (-webkit-appearance:none) {
        .navbar-toggler {
            -webkit-appearance: none;
        }
        
        .form-control {
            -webkit-appearance: none;
            border-radius: 8px;
        }
    }
}

/* Edge */
@supports (-ms-ime-align:auto) {
    .container {
        max-width: 100%;
    }
}

/* Firefox */
@-moz-document url-prefix() {
    .form-control {
        padding: 11px 15px;
    }
}

/* إصلاحات الطباعة */
@media print {
    html {
        font-size: 12pt;
    }
    
    .container {
        max-width: none !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .navbar,
    .footer,
    .btn {
        display: none !important;
    }
}

/* إصلاحات للوضع المظلم */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: light; /* نحافظ على الوضع الفاتح */
    }
}

/* إصلاحات للحركة المقللة */
@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;
    }
}

/* إصلاحات للتباين العالي */
@media (prefers-contrast: high) {
    .btn {
        border-width: 2px;
    }
    
    .card {
        border: 2px solid #000;
    }
}

/* إصلاحات لضعف البصر */
@media (prefers-reduced-transparency: reduce) {
    .navbar-collapse {
        background: #fff !important;
        backdrop-filter: none !important;
    }
    
    .card {
        background: #fff !important;
        backdrop-filter: none !important;
    }
}

/* إصلاحات نهائية للتأكد من الاستقرار */
.container,
.container-fluid {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}
