@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
    --bg-white: #FFFFFF;
    --bg-light: #F9FAFB;
    --text-main: #111827;
    --text-muted: #6B7280;
    --primary: #10B981;
    --primary-dark: #059669;
    --accent: #3B82F6;
    --border-color: #E5E7EB;
    --card-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --danger: #EF4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================================================== */
/* MOBILE-ONLY: Advanced UX Enhancements                                     */
/* ========================================================================== */

@media (max-width: 768px) {

    /* Smooth scroll behavior for better UX */
    html {
        scroll-behavior: smooth;
    }

    /* Optimize font rendering for mobile screens */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }

    /* Safe area padding for notched devices (iPhone X+) */
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Better tap highlight color (iOS/Android) */
    * {
        -webkit-tap-highlight-color: rgba(16, 185, 129, 0.15);
        tap-highlight-color: rgba(16, 185, 129, 0.15);
    }

    /* Remove tap highlight on specific elements */
    a,
    button {
        -webkit-tap-highlight-color: transparent;
    }

    /* Prevent text selection on UI elements */
    button,
    .category-btn,
    .add-btn,
    .nav-link {
        -webkit-user-select: none;
        user-select: none;
    }

    /* Improve touch scrolling */
    .main-nav,
    .modal-window,
    .category-buttons {
        -webkit-overflow-scrolling: touch;
    }
}

body {
    font-family: 'Inter', 'Cairo', -apple-system, sans-serif;
    background-color: #f0f4f8;
    /* Soft blue-grey base */
    background-image:
        radial-gradient(at 0% 0%, hsla(156, 80%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(200, 80%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(330, 80%, 95%, 1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    direction: rtl;
}

/* -------------------------------------------------------------------------- */
/* Header & Navigation                                                       */
/* -------------------------------------------------------------------------- */

/* -------------------------------------------------------------------------- */
/* Header & Navigation (Structured & Clean)                                   */
/* -------------------------------------------------------------------------- */

header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 80px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.header-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    /* strictly defined 3 columns */
    align-items: center;
    gap: 2rem;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
}

.logo-image {
    height: 42px;
    width: auto;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-dark);
    font-family: 'Cairo', sans-serif;
    letter-spacing: -0.5px;
    background: none;
    -webkit-text-fill-color: initial;
}

/* Main Navigation (Centered & Clean) */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 3rem;
    align-items: center;
    background: transparent;
    padding: 0;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
}





.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.5rem 0;
    border-radius: 0;
    transition: all 0.2s;
    position: relative;
    font-family: 'Inter', sans-serif;
}

.nav-link:hover {
    color: var(--primary);
    background: transparent;
    box-shadow: none;
    transform: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
    display: block;
}

.nav-link:hover::after {
    width: 100%;
}

/* Actions (Right) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-button {
    background: var(--primary);
    /* Solid Green Button */
    color: white;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 8px;
    /* Slightly rounded, not pill */
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
    position: relative;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
}

.cart-button:hover {
    background: var(--primary-dark);
    transform: none;
    /* remove bounce */
}

.cart-badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -5px;
    right: -5px;
    box-shadow: 0 0 0 2px white;
}

/* -------------------------------------------------------------------------- */
/* Hero Section (Clean Topology)                                              */
/* -------------------------------------------------------------------------- */

.hero {
    padding: 8rem 1.5rem 6rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: transparent;
    border: none;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    background: transparent;
    /* Removed glass box */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    animation: fadeUp 0.8s ease-out;
}

/* Hero Text Animations */
.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-family: 'Cairo', sans-serif;
    color: var(--text-main);
    opacity: 0;
    /* Star hidden */
    animation: fadeUp 1s ease-out forwards;
    animation-delay: 0.3s;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
    font-weight: 400;
    line-height: 1.8;
    opacity: 0;
    /* Start hidden */
    animation: fadeUp 1s ease-out forwards;
    animation-delay: 0.8s;
}

.scroll-indicator {
    margin-top: 2rem;
    opacity: 0;
    animation: fadeUp 1s ease-out forwards 1.5s, bounce 2s infinite 2.5s;
    color: var(--primary);
    font-size: 2rem;
    cursor: pointer;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Breadcrumbs */
.breadcrumb-container {
    max-width: 1400px;
    margin: 1rem auto;
    padding: 0 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}

.breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--primary);
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #cbd5e1;
}

.breadcrumb-current {
    font-weight: 700;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
        /* Hide on mobile for now, or convert to burger menu */
    }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-window {
    background: var(--bg-white);
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    padding: 2.5rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-window.modal-lg {
    max-width: 900px;
    /* Wider for Super Modal */
    padding: 0;
    /* Let grid handle padding */
    overflow: hidden;
}

.modal-overlay.active .modal-window {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dark);
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}



/* Modal Grid Layout */
.modal-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    height: auto;
    max-height: 85vh;
    overflow-y: auto;
}

/* Left Column */
.modal-col-left {
    padding: 2.5rem;
    background: #f8fafc;
    border-left: 1px solid var(--border-color);
}

.modal-title-lg {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Cairo', sans-serif;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.modal-subtitle {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.pharmacy-gallery {
    margin-bottom: 2rem;
}

.gallery-main {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    box-shadow: var(--card-shadow);
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.gallery-thumbs img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    cursor: pointer;
}

.gallery-thumbs img:hover {
    opacity: 1;
}

.about-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.features-list {
    list-style: none;
    margin-top: 1rem;
    padding: 0;
}

.features-list li {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

/* Right Column */
.modal-col-right {
    padding: 2.5rem;
    background: white;
}

.contact-card {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.contact-card h3,
.message-form h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1rem;
    font-family: 'Cairo', sans-serif;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
}

.contact-row i {
    width: 20px;
    color: var(--primary);
}

.website-link {
    text-decoration: none;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
}

.modal-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.send-msg-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--text-main);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.send-msg-btn:hover {
    background: black;
    transform: translateY(-2px);
}

.fb-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #1877F2;
    font-weight: 700;
    text-decoration: none;
}

/* Nav Button Outline */
.nav-btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.nav-btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0fdf4;
}

/* Responsive Modal */



/* -------------------------------------------------------------------------- */
/* Search & Filters                                                           */
/* -------------------------------------------------------------------------- */

.search-section {
    padding: 1rem 0 3rem;
    background: transparent;
    /* Remove solid bg */
    border: none;
    position: relative;
    /* Not sticky, part of flow or handle sticky differently if needed */
    z-index: 90;
}

.search-box {
    max-width: 700px;
    /* Wider */
    margin: 0 auto;
    position: relative;
    background: white;
    border-radius: 20px;
    /* Softer radius */
    padding: 6px;
    border: 1px solid var(--border-color);
    box-shadow:
        0 10px 25px -5px rgba(0, 0, 0, 0.05),
        0 5px 10px -5px rgba(0, 0, 0, 0.01);
    display: flex;
    align-items: center;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.search-box:focus-within {
    border-color: var(--primary);
    transform: translateY(-5px) scale(1.01);
    box-shadow:
        0 20px 35px -5px rgba(16, 185, 129, 0.15),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.search-icon-static {
    margin-left: 1.25rem;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 1rem 1rem;
    border: none;
    font-size: 1.1rem;
    outline: none;
    background: transparent;
    box-shadow: none !important;
    /* Remove individual shadow logic */
}

.search-input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.1), 0 4px 6px -2px rgba(16, 185, 129, 0.05);
}

.search-action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 4px;
    font-family: 'Cairo', sans-serif;
}

.search-action-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.search-btn-icon {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.25rem;
}

.category-filter {
    padding: 0 0 3rem;
    overflow-x: auto;
    white-space: nowrap;
    background: transparent;
}

.filter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.category-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    /* Wrap on clear desktops */
}

.category-btn {
    padding: 0.75rem 1.75rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Cairo', sans-serif;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.category-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    background: white;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.05);
}

.category-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
    border-color: transparent;
}

/* -------------------------------------------------------------------------- */
/* Products Grid (Out of the Box)                                             */
/* -------------------------------------------------------------------------- */

main {
    padding: 0 2rem 6rem;
    max-width: 1400px;
    margin: 3rem auto;
}

.medicines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2.5rem;
}

.medicine-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.01);
}

.medicine-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 1) inset;
    z-index: 10;
    border-color: transparent;
}

/* 3D Image Effect on Hover */
.card-image-wrap {
    width: 100%;
    aspect-ratio: 1/1;
    padding: 2rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: transform 0.4s ease;
}

.medicine-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Shows image fully */
    transition: transform 0.5s ease;
}

.medicine-card:hover img {
    transform: scale(1.05);
}

.medicine-card:hover .card-image-wrap {
    transform: scale(1.05);
}

.medicine-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.medicine-category {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    font-family: 'Inter', sans-serif;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    display: inline-block;
}

.medicine-name {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    font-family: 'Cairo', sans-serif;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.medicine-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    line-height: 1.5;
    min-height: 2.7em;
}

.medicine-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.medicine-price {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.price-curr {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 0.25rem;
}

.add-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--text-main);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.add-btn:hover {
    background: var(--primary);
    transform: scale(1.1) rotate(90deg);
}

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
/* -------------------------------------------------------------------------- */

/* -------------------------------------------------------------------------- */
/* Footer (Redesigned & Structured)                                           */
/* -------------------------------------------------------------------------- */

footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 5rem 2rem 2rem;
    margin-top: 6rem;
    position: relative;
    z-index: 10;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-brand h2 {
    font-family: 'Cairo', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-logo-img {
    height: 40px;
    width: auto;
}

.footer-desc {
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 350px;
}

.footer-col h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
}

.footer-links-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-links-list a {
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    display: inline-block;
}

.footer-links-list a:hover {
    color: var(--primary);
    transform: translateX(-5px);
    /* Move left for RTL feel, or right for LTR */
}

.footer-contact li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }

    .footer-brand h2,
    .footer-contact li {
        justify-content: center;
    }

    .footer-desc {
        margin: 0 auto;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

/* ========================================================================== */
/* MOBILE-FIRST OPTIMIZATION (320px - 768px)                                 */
/* All changes below are mobile-only and do NOT affect desktop layouts       */
/* ========================================================================== */

@media (max-width: 768px) {
    /* ---------- TYPOGRAPHY & SPACING ---------- */

    body {
        font-size: 15px;
        /* Slightly smaller base for mobile */
        line-height: 1.7;
        /* Better readability on small screens */
    }

    .hero {
        padding: 5rem 1rem 4rem;
        /* Reduce top/bottom padding */
    }

    .hero h1 {
        font-size: 2.2rem;
        /* Larger than before for impact */
        line-height: 1.15;
        margin-bottom: 1.25rem;
        letter-spacing: -0.02em;
    }

    .hero p {
        font-size: 1.05rem;
        line-height: 1.65;
        margin-bottom: 2.5rem;
    }

    /* ---------- HEADER ENHANCEMENTS ---------- */

    header {
        height: 65px;
        /* تقليل ارتفاع الهيدر */
    }

    .header-container {
        padding: 0 1rem;
        gap: 0.5rem;
    }

    .logo-image {
        height: 32px;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .menu-toggle {
        display: flex;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 8px;
    }

    .menu-toggle:active {
        background: rgba(0, 0, 0, 0.05);
    }

    /* ---------- MOBILE NAVIGATION OVERLAY (RTL-Optimized) ---------- */

    .main-nav {
        position: fixed;
        top: 65px;
        right: -100%;
        /* تظهر من اليمين لأن الموقع RTL */
        width: 80%;
        max-width: 300px;
        height: calc(100vh - 65px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        /* تحسين المحاذاة */
        padding: 2rem 1.5rem;
        gap: 1.5rem;
        transition: right 0.3s ease;
        z-index: 1000;
        display: flex;
        border-left: 1px solid var(--border-color);
    }

    .main-nav.active {
        right: 0;
        /* إظهار القائمة */
    }

    .nav-link {
        font-size: 1.15rem;
        width: 100%;
        text-align: center;
        padding: 1rem 1.5rem;
        color: var(--text-main);
        font-weight: 600;
        font-family: 'Cairo', sans-serif;
        border-radius: 10px;
        transition: all 0.2s;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(16, 185, 129, 0.05);
        /* خلفية خفيفة */
        border: 1px solid rgba(16, 185, 129, 0.1);
    }

    .nav-link:active {
        background: rgba(16, 185, 129, 0.08);
        color: var(--primary);
        transform: scale(0.98);
    }

    .nav-link::after {
        display: none;
    }

    .cart-text {
        display: none;
        /* إخفاء نص "سلة التسوق" */
    }

    .cart-button {
        padding: 0.5rem;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        justify-content: center;
    }

    /* ---------- SEARCH BOX OPTIMIZATION ---------- */

    .search-section {
        padding: 1.5rem 1rem;
    }

    .search-box {
        max-width: 100%;
        padding: 4px;
        border-radius: 16px;
        box-shadow: 0 8px 20px -5px rgba(0, 0, 0, 0.08);
        flex-wrap: nowrap;
        /* منع انزياح الزر لسطر جديد */
    }

    .search-input {
        font-size: 1rem;
        padding: 0.8rem;
    }

    .search-action-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .search-icon-static {
        margin-left: 1rem;
        width: 20px;
        height: 20px;
    }

    /* ---------- CATEGORY FILTER OPTIMIZATION ---------- */

    .category-filter {
        padding: 0 0 1.5rem;
    }

    .filter-container {
        padding: 0 1rem;
    }

    .category-buttons {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0.75rem 0;
        gap: 0.75rem;
        display: flex;
        flex-wrap: nowrap;
        /* منع التفاف الأزرار */
    }

    .category-buttons::-webkit-scrollbar {
        display: none;
    }

    .category-btn {
        flex-shrink: 0;
        padding: 0.7rem 1.4rem;
        font-size: 0.9rem;
        white-space: nowrap;
        min-height: 46px;
        min-width: fit-content;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px;
        background: white;
        border: 1.5px solid var(--border-color);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .category-btn.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
        box-shadow: 0 4px 8px rgba(16, 185, 129, 0.25);
    }

    /* ---------- PRODUCT GRID OPTIMIZATION ---------- */

    main {
        padding: 0 1rem 4rem;
        margin: 2rem auto;
    }

    .medicines-grid {
        grid-template-columns: repeat(2, 1fr);
        /* عمودين للموبايل */
        gap: 1rem;
    }

    .medicine-card {
        border-radius: 12px;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    /* Enhanced mobile hover/active state (touch feedback) */
    .medicine-card:active {
        transform: scale(0.97);
        background: rgba(255, 255, 255, 0.95);
    }

    .card-image-wrap {
        padding: 1rem;
        aspect-ratio: 1/1;
    }

    .medicine-content {
        padding: 0.8rem;
    }

    .medicine-category {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
        margin-bottom: 0.6rem;
    }

    .medicine-name {
        font-size: 0.95rem;
        /* تصغير حجم اسم الدواء */
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }

    .medicine-description {
        font-size: 0.85rem;
        line-height: 1.45;
        margin-bottom: 1rem;
        min-height: 2.5em;
    }

    .medicine-footer {
        padding-top: 0.8rem;
    }

    .medicine-price {
        font-size: 1.3rem;
        letter-spacing: -0.01em;
    }

    .price-curr {
        font-size: 0.85rem;
    }

    /* Touch-optimized add button */
    .add-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    }

    .add-btn:active {
        transform: scale(0.92);
    }

    /* ---------- MODAL ENHANCEMENTS ---------- */

    .modal-window {
        width: 95%;
        max-height: 92vh;
        border-radius: 16px;
        padding: 2rem;
    }

    .modal-window.modal-lg {
        max-height: 95vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-grid {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .modal-col-left,
    .modal-col-right {
        padding: 1.5rem;
    }

    .modal-title-lg {
        font-size: 1.75rem;
        line-height: 1.15;
    }

    .modal-subtitle {
        font-size: 1rem;
    }

    .gallery-main {
        height: 180px;
        border-radius: 10px;
    }

    .gallery-thumbs img {
        height: 55px;
        border-radius: 6px;
    }

    .modal-input {
        padding: 0.85rem;
        font-size: 1rem;
        border-radius: 10px;
        margin-bottom: 0.85rem;
    }

    /* Touch-optimized buttons */
    .send-msg-btn,
    .modal-btn {
        padding: 0.9rem;
        font-size: 1rem;
        min-height: 48px;
        /* Touch target */
        border-radius: 10px;
    }

    .contact-row {
        padding: 0.5rem 0;
    }

    /* ---------- FOOTER OPTIMIZATION ---------- */

    footer {
        padding: 4rem 1.5rem 1.5rem;
        margin-top: 4rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
        margin-bottom: 3rem;
    }

    .footer-brand h2 {
        font-size: 1.6rem;
        justify-content: center;
    }

    .footer-logo-img {
        height: 36px;
    }

    .footer-desc {
        font-size: 0.95rem;
        margin: 0 auto;
    }

    .footer-col h3 {
        font-size: 1.05rem;
        margin-bottom: 1.25rem;
    }

    .footer-links-list {
        gap: 0.7rem;
    }

    .footer-contact li {
        justify-content: center;
        font-size: 0.95rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        padding-top: 1.5rem;
        font-size: 0.85rem;
    }

    /* ---------- LOADING & EMPTY STATES ---------- */

    .loading,
    .empty-state {
        padding: 3rem 1rem;
        font-size: 1rem;
    }

    .loading div:first-child,
    .empty-state div:first-child {
        font-size: 2.5rem;
    }

    /* ---------- SCROLL INDICATOR ---------- */

    .scroll-indicator {
        margin-top: 1.5rem;
    }

    .scroll-indicator i {
        width: 28px !important;
        height: 28px !important;
    }
}

/* ========================================================================== */
/* تحسينات للشاشات الدقيقة جداً (Small Screens) - 320px to 380px           */
/* ========================================================================== */

@media (max-width: 380px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    /* تحويل الشبكة لعمود واحد لضمان وضوح المحتوى */
    .medicines-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    /* جعل بطاقة المنتج أفقية (horizontal) */
    .medicine-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        border-radius: 14px;
    }

    .card-image-wrap {
        width: 100px;
        height: 100px;
        padding: 0.5rem;
        flex-shrink: 0;
    }

    .medicine-content {
        padding: 0.5rem 1rem;
        flex: 1;
    }

    .medicine-name {
        font-size: 0.9rem;
    }

    .medicine-description {
        display: none;
        /* إخفاء الوصف في الشاشات الصغيرة جداً لتوفير المساحة */
    }

    .medicine-price {
        font-size: 1.1rem;
    }

    /* زر الإضافة */
    .add-btn {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        transform: none !important;
        /* إيقاف الحركة الدورانية لتوفير المساحة */
    }

    /* البحث */
    .search-action-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    .category-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .modal-col-left,
    .modal-col-right {
        padding: 1.25rem;
    }

    .modal-title-lg {
        font-size: 1.4rem;
    }
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
}

.modal-close:hover {
    background: #fee2e2;
    color: var(--danger);
    transform: rotate(90deg);
}