/* Main Container */
.mehrdad-search-container {
    position: relative;
    z-index: 1;
    padding: 60px 20px;
    text-align: center;
    color: #ffffff;
    background-color: #0d2a4d; /* ترکیب دو قانون */
}

#particles-js {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Keeps particles behind content */
    pointer-events: none; /* Ensures particles do not block mouse interaction with other elements */
}

/* Search Box */
.mehrdad-search-box {
    position: relative;
    overflow: visible; /* Ensure child elements can overflow */
    max-width: 800px;
    margin: 0 auto;
    padding: 40px; /* ترکیب دو قانون */
}

/* Title and Subtitle */
.search-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #e6e6e6;
}

.search-subtitle {
    font-size: 16px;
    color: #cbd4e1;
    margin-bottom: 30px;
}

/* Search Form */
.mehrdad-search-form {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-inline {
    display: flex;
    gap: 10px;
    width: 100%;
}

.search-field {
    flex-grow: 1;
}

.search-field input[type="text"] {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px 0 0 5px;
    outline: none;
    color: #333;
    height: 48px; /* Ensuring button and text box have the same height */
}

#searchButton {
    padding: 14px 20px;
    font-size: 16px;
    color: #fff;
    background-color: #0073e6;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#searchButton:hover {
    background-color: #005bb5;
}

/* Custom Radio Buttons */
.search-options {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 20px;
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #cbd4e1;
    cursor: pointer;
    position: relative;
}

.search-options input[type="radio"] {
    display: none;
}

.search-options input[type="radio"] + span {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #4ea3f8;
    border-radius: 50%;
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

.search-options input[type="radio"]:checked + span {
    background-color: #4ea3f8;
    border-color: #4ea3f8;
}

.search-options input[type="radio"]:checked + span::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #fff;
}

/* Live Search Results */
#liveSearchResults {
    position: absolute;
    background-color: #fff;
    border: 1px solid #ccc;
    width: 100%;
    max-height: 400px; /* بزرگ‌تر برای تطبیق */
    overflow-y: auto;
    z-index: 1000;
    padding: 10px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    display: none; /* Initially hidden */
}

.live-search-item {
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
}

.live-search-item img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.live-search-item:hover {
    background-color: #f0f0f0;
}

/* Full Search Results */
#searchResults {
    display: block;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
    width: 100%;
}

/* استایل کارت محصول */
.product-box {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
    direction: rtl;
    text-align: right;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.product-image img {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.product-details p {
    margin: 5px 0;
    font-size: 14px;
    color: #333;
}

.price-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.price-table th, .price-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    font-size: 14px;
}

.price-table th {
    background-color: #f4f4f4;
    font-weight: bold;
}

.product-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.action-button {
    padding: 10px 15px;
    background-color: #007BFF;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    width: 140px; /* هماهنگ کردن اندازه دکمه‌ها */
    text-align: center;
}

.action-button:hover {
    background-color: #0056b3;
}

.action-button:first-of-type {
    background-color: #4CAF50;
}

.action-button:first-of-type:hover {
    background-color: #45a049;
}


.product-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

/* Loader */
#loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
}

#loader p {
    margin-top: 10px;
    font-size: 18px;
    color: #666;
}

/* Additional Info */
.additional-info {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    color: #cbd4e1;
    font-size: 14px;
}

.additional-info div {
    max-width: 200px;
    text-align: center;
}

.additional-info i {
    display: block;
    font-size: 24px;
    color: #4ea3f8;
    margin-bottom: 5px;
}

/* Styles for manufacturer search fields */
#keywordManufacturerSearch {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 10px;
    justify-content: center;
}

#keywordManufacturerSearch input[type="text"] {
    width: 40%;
    padding: 14px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    color: #333;
    min-width: 250px;
}

/* Full-width button */
.full-width-button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    color: #fff;
    background-color: #0073e6;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.full-width-button:hover {
    background-color: #005bb5;
}
 /* استایل فرم آپلود فایل */

 .product-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 10px 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%; /* استفاده از تمام عرض والد */
    margin: 0 auto; /* وسط‌چین کردن کارت */
}


.results-table {
    width: 100%; /* جدول داخل کارت نیز تمام عرض باشد */
}

.product-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.product-card-image {
    width: 80px;
    height: auto;
    margin-right: 10px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.product-card-title h4 {
    font-size: 1.2em;
    margin: 0 0 5px;
}

.product-card-title p {
    font-size: 0.9em;
    color: #666;
}

.product-card-body {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.product-card-details,
.product-card-pricing {
    width: 48%;
}

.product-card-details p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #333;
}

.product-card-pricing div {
    margin: 5px 0;
    font-size: 0.9em;
    color: #444;
}

.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.btn {
    padding: 8px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
}

.btn-add-to-bom {
    background-color: #007BFF;
    color: #fff;
}

.btn-compare {
    background-color: #28A745;
    color: #fff;
}

.btn-datasheet {
    background-color: #FFC107;
    color: #fff;
    text-decoration: none;
    text-align: center;
}

.no-datasheet {
    color: red;
    font-size: 0.9em;
}
#products-container {
    width: 100%; /* تمام عرض صفحه */
    display: flex;
    flex-direction: column; /* کارت‌ها زیر هم نمایش داده شوند */
    gap: 20px; /* فاصله بین کارت‌ها */
}
#products-container {
    width: 100%; /* تمام عرض صفحه */
    display: flex;
    flex-direction: column; /* کارت‌ها زیر هم نمایش داده شوند */
    gap: 20px; /* فاصله بین کارت‌ها */
}
@media (max-width: 768px) {
    .product-card div[style*="flex-shrink: 0; text-align: center;"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .results-table thead {
        display: none; /* مخفی کردن هدر جدول */
    }

    .results-table,
    .results-table tbody,
    .results-table tr,
    .results-table td {
        display: block; /* نمایش هر ردیف به صورت بلوکی */
        width: 100%;
    }

    .results-table td {
        border: none; /* حذف خطوط اضافی جدول */
        border-bottom: 1px solid #ddd;
        margin-bottom: 10px;
        position: relative;
        padding-left: 50%; /* فاصله از چپ برای درج عنوان ستون */
        text-align: left;
    }

    .results-table td:before {
        content: attr(data-label);
        display: block;              /* نمایش عنوان در یک خط جداگانه */
        margin-bottom: 5px;          /* فاصله بین عنوان و مقدار */
        font-weight: bold;
        text-align: left;
    }

    /* اطمینان از مرکزچین شدن تصویر محصول */
    .results-table td div[style*="text-align: center"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .results-table td img {
        display: block;
        margin: 0 auto;
        max-width: 100%;  /* جلوگیری از بزرگ‌تر شدن تصویر */
    }
}

/* Popup AI Info */
.ai-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-popup.show {
    visibility: visible;
    opacity: 1;
}

.ai-popup-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh; /* جلوگیری از بزرگ‌تر شدن بیش از حد */
    overflow-y: auto; /* فعال‌سازی اسکرول داخلی */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease-in-out;
}

.ai-popup.show .ai-popup-content {
    transform: scale(1);
}

.ai-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.ai-loading {
    text-align: center;
    font-size: 18px;
    color: #007bff;
}

.ai-section {
    margin-top: 20px;
    padding: 10px;
    border-radius: 8px;
    background: #f9f9f9;
}

.ai-section h3 {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.ai-section ul {
    list-style-type: none;
    padding: 0;
}

.ai-section ul li {
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}
