:root {
    --primary-color: #3b5dce;
    /* Royal Blue */
    --secondary-color: #2c3e50;
    --bg-light: #f4f7f6;
    --bg-white: #ffffff;
    --text-dark: #333333;
    --text-gray: #666666;
    --border-color: #e0e0e0;
    --font-main: 'Tajawal', sans-serif;
    --price-color: #d32f2f;
    /* Red for price */
    --badge-bg: #7cb342;
    /* Green for badge */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Top Bar */
.top-bar {
    background-color: #f8f9fa;
    color: #333;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-info span {
    margin-left: 15px;
    color: #666;
}

.contact-info i {
    color: var(--primary-color);
    margin-left: 5px;
}

/* Header */
.header {
    background-color: white;
    padding: 25px 0;
    position: relative;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.logo h1 {
    font-size: 32px;
    font-weight: 800;
    color: #333;
    letter-spacing: -1px;
}

.logo span {
    color: var(--primary-color);
}

.search-bar {
    flex: 1;
    max-width: 700px;
    position: relative;
    margin: 0 40px;
    display: flex;
}

.search-bar input {
    width: 100%;
    padding: 14px 25px;
    padding-left: 60px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 15px;
    background: white;
    outline: none;
    transition: all 0.3s;
}

.search-bar input:focus {
    box-shadow: 0 0 10px rgba(59, 93, 206, 0.15);
}

.search-bar button {
    position: absolute;
    left: 2px;
    top: 2px;
    bottom: 2px;
    width: 55px;
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px 0 0 6px;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar button:hover {
    background: #2a4497;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 5px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.suggestion-item:hover {
    background: #f4f7ff;
}

.suggestion-item img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.suggestion-item .details h4 {
    font-size: 14px;
    margin: 0;
    color: #333;
}

.suggestion-item .details p {
    font-size: 13px;
    color: var(--price-color);
    margin: 4px 0 0;
    font-weight: bold;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #333;
    text-decoration: none;
    font-size: 12px;
    position: relative;
}

.header-icon i {
    font-size: 22px;
    margin-bottom: 5px;
    color: #555;
}

.header-icon:hover i {
    color: var(--primary-color);
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Nav Bar (New) */
.nav-bar {
    background: #2c3e50;
    color: white;
    padding: 0;
}

.nav-bar .container {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: background 0.3s;
}

.nav-links li a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-links li.active a {
    background: var(--primary-color);
}

/* Main Layout */
.main-content {
    display: flex;
    gap: 30px;
    padding: 40px 0;
    align-items: flex-start;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.filter-group label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-gray);
}

.filter-group input {
    margin-left: 10px;
}

.price-inputs {
    display: flex;
    gap: 10px;
}

.price-inputs input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Products Section */
.products-section {
    flex: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.product-card {
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    border: 1px solid transparent;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--badge-bg);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.product-image {
    height: 220px;
    /* Increased height slightly */
    padding: 35px 20px 20px 20px;
    /* More top padding to push image down */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
}

.product-brand {
    color: var(--text-gray);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
    height: 44px;
    /* Limit to 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.price-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.current-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--price-color);
}

.old-price {
    font-size: 14px;
    text-decoration: line-through;
    color: var(--text-gray);
}

.add-to-cart {
    width: 100%;
    padding: 10px;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.add-to-cart:hover {
    background: var(--primary-color);
    color: white;
}

.whatsapp-card-btn {
    display: inline-block;
    /* Fix for anchor tag behaving like inline */
    width: 100%;
    padding: 10px;
    background: #25d366;
    /* WhatsApp Green */
    color: white !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    margin-top: 5px;
    /* Spacing from add to cart */
    transition: background 0.3s;
    box-sizing: border-box;
    /* Ensure padding doesn't overflow */
}

.whatsapp-card-btn:hover {
    background: #128c7e;
}

.whatsapp-card-btn i {
    margin-left: 5px;
}

/* Footer */
.footer {
    background-color: #2c3e50;
    color: white;
    padding: 60px 0 20px;
    margin-top: 60px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.footer-section h4 {
    font-size: 18px;
    margin-bottom: 20px;
    color: white;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 5px;
}

.footer-section p {
    color: #ddd;
    line-height: 1.8;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    color: white;
    font-size: 20px;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    font-size: 14px;
}

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    left: -400px;
    /* Hidden by default */
    width: 400px;
    height: 100%;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    left: 0;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 4px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-details h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.cart-item-price {
    color: var(--price-color);
    font-weight: bold;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.qty-btn {
    width: 25px;
    height: 25px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.remove-item {
    color: #ff4444;
    cursor: pointer;
    padding: 5px;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: #f8f9fa;
}

.total {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.overlay.active {
    display: block;
}

/* Floating WhatsApp Button */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25D366;
    color: white;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    text-align: center;
    font-size: 32px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: wa-pulse 2s infinite;
}

@keyframes wa-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.whatsapp-float:hover {
    background-color: #128C7E;
    transform: scale(1.1) rotate(5deg);
}

/* Product Page New Layout */
.product-page-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.breadcrumbs {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
}

.breadcrumbs a {
    color: #3b5dce;
    text-decoration: none;
}

.product-top-section {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

.product-gallery-section {
    flex: 1;
    min-width: 0;
}

.gallery-inner {
    display: flex;
    gap: 15px;
}

.thumbnails-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80px;
}

.thumb-img {
    width: 100%;
    height: 60px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
}

.thumb-img:hover {
    border-color: #3b5dce;
}

.main-image-container {
    flex: 1;
    position: relative;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    overflow: hidden;
    /* Important for zoom */
    cursor: zoom-in;
}

#main-product-img {
    max-width: 100%;
    max-height: 400px;
    transition: transform 0.1s ease-out;
    /* Smooth follow */
    pointer-events: none;
    /* Let container handle events */
}

.badge-large {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #7cb342;
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    font-weight: bold;
}

.zoom-hint {
    text-align: center;
    color: #999;
    font-size: 12px;
    margin-top: 10px;
}

.product-info-section {
    flex: 1;
}

.brand-link a {
    color: #666;
    font-size: 14px;
    text-decoration: none;
}

.product-title-main {
    font-size: 24px;
    margin: 10px 0 20px;
    line-height: 1.4;
}

.product-meta {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    font-size: 14px;
}

.product-meta>div {
    margin-bottom: 8px;
}

.meta-label {
    color: #666;
    margin-left: 5px;
}

.status-available {
    color: #28a745;
    font-weight: bold;
}

.social-share {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.share-icon {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 4px;
    text-decoration: none;
    font-size: 16px;
}

.whatsapp {
    background: #25D366;
}

.facebook {
    background: #3b5998;
}

.twitter {
    background: #1DA1F2;
}

.pinterest {
    background: #E60023;
}

.linkedin {
    background: #0077b5;
}

.google {
    background: #db4437;
}

.price-section-large {
    margin-bottom: 30px;
}

.current-price-huge {
    font-size: 32px;
    color: #d32f2f;
    font-weight: bold;
}

.old-price-huge {
    font-size: 20px;
    color: #999;
    text-decoration: line-through;
    margin-right: 15px;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-add-cart-large {
    background: #3b5dce;
    color: white;
    border: none;
    padding: 15px;
    font-size: 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-add-cart-large:hover {
    background: #2a45a0;
}

.btn-whatsapp-large {
    background: #25D366;
    color: white;
    padding: 15px;
    font-size: 18px;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-whatsapp-large:hover {
    background: #128C7E;
}

.product-overview-section {
    background: #fcfcfc;
    padding: 30px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 40px;
}

.overview-title {
    font-size: 24px;
    margin-bottom: 20px;
    border-bottom: 3px solid #3b5dce;
    display: inline-block;
    padding-bottom: 10px;
}

.overview-text {
    margin-bottom: 30px;
    line-height: 1.8;
    color: #555;
    font-size: 16px;
    background: #fdfdfd;
    border-right: 4px solid #3b5dce;
    padding: 15px;
}

.full-specs-list {
    margin-bottom: 30px;
    display: grid;
    gap: 15px;
}

.spec-item {
    display: flex;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 10px;
    align-items: baseline;
}

.spec-item strong {
    min-width: 120px;
    color: #333;
}

.spec-item span {
    color: #666;
    line-height: 1.6;
}

.features-list {
    margin-bottom: 30px;
    list-style: none;
}

.features-list li {
    margin-bottom: 10px;
    position: relative;
    padding-right: 25px;
    font-weight: 500;
}

.features-list li:before {
    content: "\f00c";
    /* FontAwesome check */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #3b5dce;
    position: absolute;
    right: 0;
}

.audience-section {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.audience-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.audience-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.audience-list li {
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    display: flex;
    align-items: center;
}

.audience-list li i {
    color: #28a745;
    margin-left: 10px;
}

/* Card Button Hover Effects */
.whatsapp-card-btn:hover {
    background-color: #218838 !important;
}

@media (max-width: 900px) {
    .product-top-section {
        flex-direction: column;
    }

    .gallery-inner {
        flex-direction: column-reverse;
    }

    .thumbnails-list {
        flex-direction: row;
        width: 100%;
        gap: 10px;
        overflow-x: auto;
    }

    .thumb-img {
        width: 70px;
        height: 70px;
        flex-shrink: 0;
    }
}

/* Login Page Styles */
.login-container {
    max-width: 450px;
    margin: 60px auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.login-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.login-header h2 {
    flex: 1;
    text-align: center;
    padding: 20px;
    margin: 0;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
}

.login-header h2.active {
    background: white;
    color: var(--primary-color);
    border-top: 3px solid var(--primary-color);
    font-weight: bold;
}

.login-card {
    padding: 30px;
}

.login-card h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 20px;
}

.login-card.hidden {
    display: none;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    transition: border 0.3s;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.password-group input {
    padding-left: 40px;
}

.toggle-password {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: pointer;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 14px;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #2a45a0;
}

/* Floating AI Assistant Button (Matches WhatsApp Style) */
.ai-float {
    position: fixed;
    bottom: 110px;
    /* Positioned above WhatsApp */
    right: 30px;
    background: linear-gradient(135deg, #3b5dce, #6a82fb);
    color: white;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    text-align: center;
    font-size: 28px;
    box-shadow: 0 4px 15px rgba(59, 93, 206, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 93, 206, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(59, 93, 206, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 93, 206, 0);
    }
}

.ai-float:hover {
    background: linear-gradient(135deg, #2a4497, #3b5dce);
    transform: scale(1.1) rotate(-5deg);
}

/* AI Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ai-chat-window.active {
    display: flex;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-chat-header {
    background: linear-gradient(135deg, #3b5dce, #6a82fb);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-close {
    cursor: pointer;
    font-size: 18px;
    opacity: 0.8;
}

.ai-chat-close:hover {
    opacity: 1;
}

.ai-chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f9f9;
}

.ai-message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-message.assistant {
    background: #e9ecef;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-message.user {
    background: #3b5dce;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-chat-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.ai-chat-footer input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-family: var(--font-main);
}

.ai-chat-footer button {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.ai-chat-footer button:hover {
    background: #2a4abe;
}



/* =========================================
   MOBILE RESPONSIVENESS (Optimized)
   ========================================= */
@media (max-width: 768px) {

    /* --- Layout Fixes --- */
    .container {
        padding: 0 15px;
    }

    /* --- 1. Top Bar (Compact & Styled) --- */
    .top-bar .container {
        flex-direction: row;
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
        padding: 5px;
    }

    .contact-info {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
        font-size: 11px;
    }

    .social-top {
        display: none;
        /* Hide map/social on very small screens to save vertical space if needed, or keep compact */
    }

    /* --- 2. Header (Flex Layout for Stability) --- */
    .header .container {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    /* Logo: Full Width, Top */
    .logo {
        width: 100%;
        text-align: center;
        order: 1;
        margin-bottom: 10px;
    }

    .logo img {
        max-height: 50px !important;
        width: auto;
    }

    .logo h1 {
        font-size: 16px !important;
        white-space: normal;
    }

    /* Search: Takes available space */
    .search-bar {
        flex: 1;
        order: 2;
        min-width: 0;
        /* Fix flex overflow */
        margin-left: 10px;
        /* Space between search and icons */
    }

    .search-bar input {
        width: 100%;
        padding: 8px 10px;
        padding-left: 40px;
        font-size: 13px;
        height: 38px;
    }

    .search-bar button {
        width: 35px;
        height: 38px;
    }

    /* Icons: Auto Width */
    .header-actions {
        width: auto;
        order: 3;
        gap: 10px;
        display: flex;
        justify-content: center;
    }

    .header-icon {
        margin: 0;
    }

    .header-icon span {
        display: none;
        /* Hide text labels on mobile to save space */
    }

    .header-icon i {
        font-size: 20px;
        margin: 0;
    }

    #cart-count {
        top: -5px;
        right: -5px;
        width: 16px;
        height: 16px;
        font-size: 10px;
    }



    /* --- 3. Navigation (Scrollable) --- */
    .nav-bar .container {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
        /* Scrollbar space */
        -webkit-overflow-scrolling: touch;
    }

    .nav-links {
        display: inline-flex;
        width: auto;
        padding: 0;
    }

    .nav-links li a {
        font-size: 13px;
        padding: 12px 15px;
    }

    /* --- 4. Main Content & Sidebar (CRITICAL FIX) --- */
    .main-content {
        display: flex;
        flex-direction: column;
        padding: 10px 0;
        gap: 20px;
    }

    .products-section {
        order: 1;
        /* Show Products FIRST */
    }

    .sidebar {
        width: 100%;
        order: 2;
        /* Show Filters BELOW products */
        margin-top: 20px;
        border: 1px solid #eee;
        background: #fcfcfc;
    }

    /* Optional: Make sidebar collapsible title to save scroll? */
    .sidebar-section h3:after {
        content: '(اضغط للفتح)';
        font-size: 12px;
        float: left;
        color: #999;
    }

    /* --- 5. Product Grid (2 Columns) --- */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card {
        border-radius: 6px;
    }

    .product-image {
        height: 140px;
        padding: 10px;
    }

    .product-info {
        padding: 10px;
    }

    .product-title {
        font-size: 13px;
        height: 38px;
        /* 2 lines aprox */
        margin-bottom: 5px;
    }

    .product-brand {
        font-size: 10px;
    }

    .price-container {
        margin-bottom: 8px;
        gap: 5px;
        flex-wrap: wrap;
    }

    .current-price {
        font-size: 14px;
    }

    .old-price {
        font-size: 11px;
    }

    /* Buttons */
    .add-to-cart,
    .whatsapp-card-btn {
        padding: 8px;
        font-size: 12px;
    }

    /* --- 6. Footer --- */
    .footer {
        padding: 30px 0;
        text-align: center;
    }

    .footer-content {
        gap: 30px;
        text-align: center;
    }

    .footer-section h4 {
        display: inline-block;
        /* Center underline */
    }

    .social-links {
        justify-content: center;
    }

    /* --- 7. Cart Sidebar Mobile --- */
    .cart-sidebar {
        width: 85%;
        /* Not full width to show overlay */
        max-width: 350px;
        left: -100%;
    }

    /* --- 8. Floating Buttons --- */
    .whatsapp-float,
    .ai-float {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 20px;
        right: 20px;
    }

    .ai-float {
        bottom: 80px;
        /* Stack above whatsapp */
    }
}