/* --- Global Styles & Variables --- */
:root {
    --gold-color: #D4AF37;
    --dark-color: #1a1a1a;
    --light-color: #f4f4f4;
    --green-color: #2E4034;
    --white-color: #ffffff;
    --font-primary: 'Tajawal', sans-serif;
    --font-secondary: 'Cairo', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    direction: rtl;
}

.container {
    max-width: 1100px;
    margin: auto;
    padding: 4rem 2rem;
    overflow: hidden;
}

h1, h2, h3 {
    font-family: var(--font-secondary);
    font-weight: 700;
}

h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2.5rem;
    color: var(--dark-color);
}

a {
    text-decoration: none;
    color: var(--gold-color);
}

/* --- Header & Navbar --- */
#main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    transition: background-color 0.5s ease;
}

#main-header.scrolled {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

#main-header.header-solid {
    background: var(--dark-color);
}

#navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

#navbar .brand {
    font-family: var(--font-secondary);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white-color);
}

#navbar ul {
    list-style: none;
    display: flex;
}

#navbar ul li a {
    color: var(--white-color);
    padding: 0.75rem;
    margin: 0 0.5rem;
    transition: color 0.3s ease;
}

#navbar ul li a:hover, #navbar ul li a.active {
    color: var(--gold-color);
}

#navbar .nav-right {
    display: flex;
    align-items: center;
}

.menu-toggle {
    display: none;
    color: var(--white-color);
    font-size: 1.8rem;
    cursor: pointer;
    background: none;
    border: none;
}

#navbar .lang-switcher {
    color: var(--white-color);
    margin-left: 1rem; /* Adjusted for RTL */
}

.cart-icon-wrapper a {
    color: var(--white-color);
    display: flex;
    align-items: center;
    position: relative;
    text-decoration: none;
}

.cart-icon-wrapper .cart-svg {
    stroke: var(--white-color);
    margin-left: 8px; /* Adjusted for RTL */
}

.cart-icon-wrapper #cart-count {
    background-color: var(--gold-color);
    color: var(--dark-color);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 5px; /* Adjusted for RTL */
}

/* --- Hero Section --- */
#hero {
    height: 100vh;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('assets/hero-bg.png') no-repeat center center/cover;
    color: var(--white-color);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.cta-button {
    background: var(--gold-color);
    color: var(--dark-color);
    padding: 1rem 2rem;
    border-radius: 5px;
    font-family: var(--font-secondary);
    font-weight: 700;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background: var(--dark-color);
    color: var(--white-color);
}

/* --- Cards --- */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--white-color);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

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

.card h3 {
    padding: 1rem;
    color: var(--green-color);
}

.card .price {
    padding: 0 1rem;
    font-weight: bold;
    color: var(--gold-color);
}

.card p {
    padding: 0 1rem 1rem;
}

.btn {
    display: block;
    width: calc(100% - 2rem);
    margin: 1rem;
    padding: 0.75rem;
    background: var(--gold-color);
    color: var(--dark-color);
    text-align: center;
    border-radius: 8px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--dark-color);
    color: var(--white-color);
}

/* --- Product Grid --- */
.product-grid {
    display: grid;
    /* This ensures all cards have a fixed width and the grid is centered */
    grid-template-columns: repeat(auto-fill, minmax(250px, 280px));
    justify-content: center;
    gap: 1.5rem;
}

.product-item {
    background: var(--white-color);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.product-item:hover img {
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    transform: translateY(-5px);
}

.product-item h3 {
    padding: 1rem 1rem 0.5rem;
    color: var(--green-color);
    min-height: 60px; /* Ensure space for two lines of title */
}

.product-item .product-copy {
    padding: 0 1rem 1rem;
    flex-grow: 1; /* Allow description to fill available space */
    min-height: 75px; /* Reserve space for about 3 lines of text */
    
    /* The magic for truncating text to 3 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.product-item .price {
    padding: 0 1rem 1rem;
    font-weight: bold;
    color: var(--gold-color);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* --- Page Header for subpages --- */
.page-section {
    padding-top: 100px;
}

/* --- Packages --- */
/* No unique styles needed if using product-item layout */

/* --- Location --- */
#map iframe {
    border-radius: 16px;
    filter: grayscale(1) contrast(1.2) opacity(0.8);
    transition: filter 0.3s ease;
}

#map iframe:hover {
    filter: grayscale(0) contrast(1) opacity(1);
}

.location-content p {
    text-align: center;
    margin-top: 1rem;
    font-size: 1.2rem;
}

/* --- Footer --- */
footer {
    background: var(--dark-color);
    color: var(--white-color);
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* --- Animations --- */
.hidden-anim {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Styles --- */
@media(max-width: 992px) {
    .container {
        padding: 3rem 1.5rem;
    }

    h2 {
        font-size: 2.2rem;
    }

    .hero-content {
        padding: 0 1.5rem;
    }
    
    .hero-content h1 {
        font-size: 2.8rem;
    }

    .hero-content p {
        font-size: 1.2rem;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .cards-container {
        grid-template-columns: 1fr;
    }

    #navbar {
        padding: 1rem 1.5rem;
    }

    #navbar ul {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    #navbar ul.show {
        display: flex;
    }

    #navbar ul li {
        text-align: center;
        margin: 0;
    }

    #navbar ul li a {
        padding: 1rem;
        display: block;
        width: 100%;
    }
    
    .menu-toggle {
        display: block;
    }

    .checkout-layout {
        grid-template-columns: 1fr;
    }

    .order-summary {
        margin-top: 2rem;
    }
}

/* --- Cart Drawer --- */
.cart-drawer {
    position: fixed;
    top: 0;
    left: -400px; /* Start off-screen to the left for RTL */
    width: 400px;
    height: 100%;
    background-color: var(--white-color);
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    z-index: 1001;
    transition: left 0.4s ease;
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    left: 0;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.cart-header h3 {
    margin: 0;
}

#close-cart-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid #f4f4f4;
    padding-bottom: 1rem;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    margin-left: 1rem; /* Adjusted for RTL */
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-details h4 {
    margin: 0 0 0.5rem 0;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
}

.cart-item-quantity input {
    width: 40px;
    text-align: center;
    border: 1px solid #ddd;
    margin: 0 0.5rem;
}

.remove-item {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.remove-item .trash-svg {
    stroke: var(--dark-color);
    transition: stroke 0.3s ease;
}

.remove-item:hover .trash-svg {
    stroke: #e63946; /* A nice red for delete */
}

.cart-footer {
    padding: 1rem;
    border-top: 1px solid #eee;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.checkout-btn {
    width: 100%;
}

.cart-overlay {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* == Packages Page == */
/* No unique styles needed if using product-item layout */

/* == Location Page == */
#location-map {
    margin-top: 2rem;
    border-radius: 16px;
}

/* == Packages Page == */
#packages .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

#offers .product-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

/* --- Checkout Page --- */
.checkout-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.checkout-form .form-group {
    margin-bottom: 1.5rem;
}

.checkout-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.checkout-form input,
.checkout-form textarea,
.checkout-form select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-primary);
}

.order-summary {
    background: var(--white-color);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    height: fit-content;
}

.order-summary h3 {
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.summary-item .item-name {
    font-weight: bold;
}

.summary-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
}

.text-center {
    text-align: center;
}

.delivery-cost-note {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    margin-top: 1rem;
}

/* === New Sleek Checkout Page Styles === */

.checkout-container {
    background-color: var(--white-color);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.checkout-header {
    text-align: center;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1.5rem;
}

.checkout-header h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.checkout-steps {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-family: var(--font-secondary);
}

.checkout-steps .step {
    color: #999;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background-color: #f7f7f7;
    transition: all 0.3s ease;
}

.checkout-steps .step.active {
    color: var(--white-color);
    background-color: var(--green-color);
    font-weight: 700;
}

.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

.checkout-form-container h3,
.order-summary-container h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-icon {
    font-size: 1.8rem;
}

.checkout-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.checkout-form .form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.checkout-form label {
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.checkout-form input,
.checkout-form select,
.checkout-form textarea {
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    padding: 0.9rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.checkout-form input:focus,
.checkout-form select:focus,
.checkout-form textarea:focus {
    outline: none;
    border-color: var(--gold-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    background-color: var(--white-color);
}

.order-summary-container {
    background-color: #f7f9fc;
    padding: 1.5rem;
    border-radius: 16px;
    height: fit-content;
}

.order-summary .summary-item-placeholder {
    text-align: center;
    padding: 2rem 0;
    color: #888;
    border-bottom: 1px solid #e0e0e0;
}

.order-summary .summary-breakdown {
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1rem;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    color: #555;
}

.summary-line span:last-child {
    font-weight: 700;
}

.order-summary .summary-total {
    font-size: 1.2rem;
    font-weight: 700;
}
.order-summary .summary-total span:last-child {
    color: var(--gold-color);
}

.btn-primary.btn-block {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.arrow-icon {
    transition: transform 0.3s ease;
}

.btn-primary:hover .arrow-icon {
    transform: translateX(-5px);
}

/* --- Responsive Checkout --- */
@media (max-width: 992px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    .order-summary-container {
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .checkout-form {
        grid-template-columns: 1fr;
    }
    #honey .product-grid,
    #offers .product-grid,
    #royal-jelly .product-grid,
    #pharmacy .product-grid,
    #packages .product-grid,
    #index .product-grid {
        grid-template-columns: 1fr;
    }
}

/* === Dynamic Product Loader Styles === */

.page-description {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 2.5rem;
    font-size: 1.1rem;
    color: #666;
}

.product-category-section {
    margin-bottom: 4rem;
}

.category-title {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gold-color);
    display: inline-block;
}

.loading-placeholder {
    text-align: center;
    padding: 4rem;
    color: #888;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--gold-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    color: #d9534f;
    background-color: #f2dede;
    padding: 1rem;
    border-radius: 8px;
}

#pharmacy .product-grid {
    justify-content: center;
    grid-template-columns: repeat(auto-fit, minmax(250px, 300px));
}