/* Responsive CSS for all devices */

/* Base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    direction: rtl;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Navigation styles */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 5%; /* Reduced padding */
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 60px;
}

a.logo {
    padding: 6px 8px;
    border-radius: 10px;
}

.logo img {
    height: 38px;
    width: 38px;
    max-width: 38px;
}

/* Nav Content Wrapper */
.nav-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: flex-end; /* Push to right (start in RTL) */
    margin-right: 20px; /* Space from logo */
}

.nav-links {
    display: flex;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative;
    margin: 0 5px; /* Reduced margin */
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: var(--transition);
    padding: 8px 10px; /* Compact padding */
    border-radius: 4px;
    display: flex;
    align-items: center;
    min-height: 40px;
    justify-content: center;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--primary-color);
    background-color: rgba(75, 0, 130, 0.1);
    text-decoration: none;
}

.nav-links a.active {
    color: var(--primary-color);
    background-color: rgba(75, 0, 130, 0.15);
    font-weight: 700;
}

/* Language Switcher */
.language-switch {
    margin-right: 15px; /* Space from main links */
}

.language-switch a {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    background-color: var(--white);
    transition: var(--transition);
    display: inline-block;
    line-height: 1.2;
}

.language-switch a:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    text-decoration: none;
}

/* Dropdown menu */
.dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--white);
    box-shadow: var(--shadow);
    min-width: 180px;
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1001;
    padding: 5px 0;
    margin-top: 5px;
    border: 1px solid #eee;
    border-top: 3px solid var(--primary-color);
}

.dropdown:hover .dropdown-menu,
.dropdown .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    border-bottom: 1px solid #f1f1f1;
    font-weight: 400;
    font-size: 14px;
    white-space: nowrap;
    color: var(--text-color);
    min-height: auto;
    justify-content: flex-start;
}

.dropdown-menu li:last-child a {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.dropdown > a .fa-chevron-down {
    margin-right: 5px;
    font-size: 0.8em;
}

/* Mobile menu button */
.menu-toggle {
    display: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--primary-color);
    padding: 10px;
    margin-left: -10px; /* Adjust position */
}

/* --- Responsive --- */

/* Medium screens (Tablets) */
@media (max-width: 992px) {
    .nav-content {
        margin-right: 10px; /* Reduce space */
    }
    .nav-links li {
        margin: 0 3px; /* Further reduce margin */
    }
    .nav-links a {
        font-size: 14px;
        padding: 6px 8px;
    }
    .language-switch {
        margin-right: 10px;
    }
    .language-switch a {
        font-size: 0.8em;
        padding: 3px 6px;
    }
    /* Keep other tablet styles from previous version */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .doctor-content {
        flex-direction: column;
        gap: 30px;
    }
    .doctor-image {
        flex: 0 0 auto;
    }
    .contact-content {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 20px;
    }
    .footer-content {
        gap: 20px;
    }
    .footer-links, .footer-regions, .footer-contact {
        min-width: 180px;
    }
}

/* Small screens (Mobiles) */
@media (max-width: 768px) {
    nav {
        padding: 10px 5%;
    }
    .menu-toggle {
        display: block; /* Show hamburger icon */
        order: 3; /* Place it after nav-content */
    }
    .nav-content {
        position: absolute;
        right: 0;
        top: 100%; /* Position below nav */
        background-color: var(--white);
        width: 100%;
        flex-direction: column;
        align-items: stretch; /* Stretch items */
        box-shadow: var(--shadow);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.5s ease-out;
        margin-right: 0; /* Reset margin */
        order: 2; /* Place it before menu-toggle visually */
    }
    .nav-content.active {
        max-height: calc(100vh - 60px); /* Adjust max height */
        overflow-y: auto; /* Allow scrolling if needed */
    }
    .nav-links {
        flex-direction: column;
        width: 100%;
        order: 2; /* Links below language switch */
    }
    .nav-links li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid #f1f1f1;
    }
    .nav-links li:last-child {
        border-bottom: none;
    }
    .nav-links a {
        padding: 15px 20px;
        justify-content: flex-start; /* Align text start */
        font-size: 16px;
        min-height: 48px;
        border-radius: 0;
    }
    .language-switch {
        order: 1; /* Move language switch to the top */
        margin: 0;
        padding: 10px 20px;
        background-color: #f9f9f9;
        border-bottom: 1px solid #eee;
        width: 100%;
        text-align: right; /* Align text right for RTL */
    }
    .language-switch a {
        margin: 0;
        display: inline-block;
        width: auto;
        border: none;
        padding: 5px;
        font-size: 1em;
        background-color: transparent;
        color: var(--primary-color);
    }
    .language-switch a:hover {
        background-color: transparent;
        text-decoration: underline;
    }

    /* Mobile Dropdown */
    .dropdown > a .fa-chevron-down {
        display: inline-block;
        margin-right: auto; /* Push icon to the end */
        padding-left: 15px;
        transition: transform 0.3s ease;
    }
    .dropdown.open > a .fa-chevron-down {
        transform: rotate(180deg);
    }
    .dropdown .dropdown-menu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
        width: 100%;
        padding: 0;
        margin-top: 0;
        background-color: #f0f0f0; /* Slightly different background */
        border: none;
    }
    .dropdown.open .dropdown-menu {
        max-height: 400px; /* Adjust as needed */
    }
    .dropdown-menu a {
        padding: 12px 30px; /* Indent dropdown items */
        font-size: 15px;
        border-bottom: 1px solid #e0e0e0;
    }
    .dropdown-menu li:last-child a {
        border-bottom: none;
    }

    /* Keep other mobile styles from previous version */
    .hero h1 {
        font-size: 2rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .features-grid {
        grid-template-columns: 1fr;
    }
    .doctor-image img {
        max-width: 200px;
    }
    .whatsapp-btn {
        width: 55px;
        height: 55px;
        left: 15px;
        bottom: 15px;
    }
    .whatsapp-btn i {
        font-size: 25px;
    }
    .whatsapp-chat {
        width: calc(100% - 30px);
        left: 15px;
        bottom: 80px;
    }
    .blog-grid {
        grid-template-columns: 1fr;
    }
}

/* Further adjustments for very small screens if needed */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    .hero {
        padding: 50px 15px;
    }
    .cta-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    .feature-card, .service-card, .region-card {
        padding: 20px 15px;
    }
    .contact-form input,
    .contact-form textarea {
        padding: 10px 12px;
    }
    .footer-content {
        gap: 15px;
    }
}

/* ====================================
   ADDITIONAL RESPONSIVE IMPROVEMENTS
==================================== */

/* Print Styles */
@media print {
    nav,
    .whatsapp-btn,
    .whatsapp-chat,
    .whatsapp-float,
    .menu-toggle {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    .container {
        width: 100%;
        max-width: none;
        padding: 0;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    .hero,
    .page-hero {
        background: #f0f0f0 !important;
        padding: 30px 20px;
    }
    
    .page-hero h1,
    .hero h1 {
        color: #000;
    }
}

/* Landscape Mobile Orientation */
@media (max-width: 812px) and (orientation: landscape) {
    .hero {
        padding: 40px 20px;
        min-height: auto;
    }
    
    .page-hero {
        padding: 40px 20px;
    }
    
    .nav-content.active {
        max-height: 80vh;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .whatsapp-btn {
        animation: none;
    }
}

/* Dark Mode Support (Optional - Follows System Preferences) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    :root {
        --light-bg: #1a1a2e;
        --white: #16213e;
        --text-color: #e5e5e5;
        --text-light: #b0b0b0;
        --border-color: #333;
    }
    */
}

/* Focus States for Accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to Content Link (Accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 30px;
    border-radius: 0 0 10px 10px;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Better Touch Targets for Mobile */
@media (max-width: 768px) {
    .nav-links a,
    .cta-btn,
    .btn-primary,
    .btn-secondary,
    .submit-btn,
    .contact-link {
        min-height: 48px;
        min-width: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Loading State Styles */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Selection Styles */
::selection {
    background-color: var(--primary-color);
    color: var(--white);
}

::-moz-selection {
    background-color: var(--primary-color);
    color: var(--white);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), var(--primary-light));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Table Responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .price-table,
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Image Lazy Loading Placeholder */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .hero,
    .page-hero {
        min-height: -webkit-fill-available;
    }
}

/* ============================================
   Modern theme — final cascade (loads last)
   ============================================ */
.container {
    width: min(92%, 1200px);
    padding-inline: clamp(1rem, 4vw, 1.5rem);
}

body {
    background: var(--surface-2, #F8FAFC);
}

footer {
    background: linear-gradient(180deg, #0F172A 0%, #1E293B 100%);
}

@media (max-width: 768px) {
    .nav-content.active {
        border-radius: 0 0 20px 20px;
        border: 1px solid var(--border-color, #E2E8F0);
        border-top: none;
    }

    .blog-grid {
        grid-template-columns: 1fr !important;
    }

    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        color: #155E75 !important;
        background: #F5F3FF;
        border: 2px solid #06B6D4;
        border-radius: 12px;
        font-size: 1.35rem;
    }

    .menu-toggle i {
        color: #155E75 !important;
        font-size: 1.25rem;
        line-height: 1;
    }

    .trust-badge i {
        color: #06B6D4 !important;
        font-size: 1.2rem;
    }

    .feature-card .icon-box i {
        font-size: 1.65rem !important;
        color: #0E7490 !important;
    }
}

