* {
    box-sizing: border-box;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #f7f9fc; 
    color: #222; 
    margin: 0; 
    padding: 180px 15px 40px; 
}

.logo-container { 
    max-width: 700px; 
    margin: 0 auto 20px; 
    z-index: 10; 
    text-align: center; 
}

h3 { 
    color: #444; 
    border-bottom: 2px solid #0077cc; 
    padding-bottom: 8px; 
    margin: 30px 0 15px; 
    font-weight: 600; 
}

/* ===== טופס חיפוש ===== */
form#searchForm { 
    max-width: 700px; 
    margin: 30px auto 20px; 
    padding: 20px; 
    background: #fff; 
    border-radius: 10px; 
    box-shadow: 0 3px 8px rgba(0,0,0,0.1); 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    flex-wrap: wrap; 
    justify-content: center; 
}

.input-group { 
    display: flex; 
    gap: 10px; 
    width: 100%; 
    align-items: stretch; 
    flex-wrap: nowrap; 
}

.search-wrapper { 
    position: relative; 
    flex: 1; 
}

.search-wrapper input[type="text"] { 
    width: 100%; 
    padding: 10px 35px 10px 10px; 
    font-size: 1em; 
    border: 1.8px solid #0077cc; 
    border-radius: 6px; 
    height: 42px; 
}

.search-wrapper input[type="text"]:focus { 
    border-color: #005fa3; 
    outline: none; 
    box-shadow: 0 0 6px #66aaff99; 
}

#searchButton { 
    background: #0077cc; 
    width: 42px; 
    height: 42px; 
    padding: 0; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: background-color 0.3s; 
}

#searchButton:hover { 
    background-color: #005fa3; 
}

#clearSearch { 
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%); 
    left: 10px; 
    font-size: 16px; 
    color: #888; 
    cursor: pointer; 
    user-select: none; 
    z-index: 5; 
    display: none; 
}

#clearSearch:hover { 
    color: #cc0000; 
}

#searchForm.sticky-search { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    max-width: 700px; 
    margin: 0 auto; 
    z-index: 10; 
    background: #fff; 
    padding: 15px 20px; 
    box-shadow: 0 2px 6px rgba(0,0,0,0.1); 
    border-radius: 0 0 10px 10px; 
    transition: transform 0.3s; 
}

#searchForm.sticky-search.hide { 
    transform: translateY(-100%); 
}

/* ===== תוצאות חיפוש ===== */
#results { 
    width: 100%;
    max-width: 1200px;
    margin: 0 auto; 
    background: transparent;
    border-radius: 0;
    padding: 20px 15px;
    box-shadow: none;
    font-size: 1em; 
    line-height: 1.5em; 
    color: #333; 
    display: none;
    box-sizing: border-box;
}

.results-list {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    margin: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.result-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.result-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

.result-item h4.product-name {
    margin: 0 0 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: #1e3a8a;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-item p {
    margin: 5px 0;
    font-size: 0.95em;
    color: #555;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-item p strong { 
    color: #0059b3; 
}

.result-item a { 
    color: #0077cc; 
    text-decoration: none; 
}

/* צבעי רקע לתוצאות חיפוש */
.result-item.bg-1 { background-color: #f8fafc; }
.result-item.bg-2 { background-color: #f1f5f9; }
.result-item.bg-3 { background-color: #fefce8; }
.result-item.bg-4 { background-color: #ecfeff; }
.result-item.bg-5 { background-color: #fdf2f8; }
.result-item.bg-6 { background-color: #f0fdf4; }
.result-item.bg-7 { background-color: #fef3c7; }
.result-item.bg-8 { background-color: #ede9fe; }
.result-item.bg-9 { background-color: #ffedd5; }
.result-item.bg-10 { background-color: #e0f2fe; }

/* ===== גריד המוצרים ===== */
#productsWrapper {
    margin: 0 auto;
    padding: 20px 15px;
}

#productsWrapper .row {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 0;
}

.product-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

/* רקעים בהירים מתחלפים */
.product-card.bg-1 { background-color: #f8fafc; }  /* כחול בהיר */
.product-card.bg-2 { background-color: #f1f5f9; }  /* אפור-כחול */
.product-card.bg-3 { background-color: #fefce8; }  /* צהוב בהיר */
.product-card.bg-4 { background-color: #ecfeff; }  /* תכלת בהיר */
.product-card.bg-5 { background-color: #fdf2f8; }  /* ורוד בהיר */
.product-card.bg-6 { background-color: #f0fdf4; }  /* ירוק בהיר */
.product-card.bg-7 { background-color: #fef3c7; }  /* זהב בהיר */
.product-card.bg-8 { background-color: #ede9fe; }  /* סגול בהיר */
.product-card.bg-9 { background-color: #ffedd5; }  /* כתום בהיר */
.product-card.bg-10 { background-color: #e0f2fe; } /* תכלת פסטל */

.product-card .card-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 8px;
    margin: 0 0 10px;
}

.product-card .card-text {
    font-size: 0.95rem;
    color: #555;
    margin: 4px 0;
}

.product-card p strong {
    font-weight: 700;
    color: #0077cc;
}

/* ===== ניווט עמודים (Pagination) ===== */
.pagination {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin: 30px 0;
    padding: 0;
    list-style: none;
}

.pagination .page-item {
    display: inline-flex;
    margin: 0;
}

.pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    margin: 0;
    border-radius: 0;
    text-decoration: none;
    color: #0077cc;
    background: #e8f0fc;
    border: 1px solid #cce0fc;
    border-left: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pagination .page-item:first-child .page-link {
    border-radius: 0 8px 8px 0;
    border-left: 1px solid #cce0fc;
}

.pagination .page-item:last-child .page-link {
    border-radius: 8px 0 0 8px
}

.pagination .page-link:hover {
    background: #cce0fc;
    border-color: #0077cc;
    z-index: 2;
    position: relative;
    
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);    
}

.pagination .page-item.active .page-link {
    background-color: #0077cc;
    border-color: #0077cc;
    color: #fff;
    font-weight: 600;
    pointer-events: none;
    z-index: 3;
    position: relative;
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* ===== מודאל ===== */
.modal-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.6); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 9999; 
    padding: 15px; 
}

#productModal { 
    position: fixed; 
    top: 0; 
    left: 0; 
    z-index: 1001; 
    background: #fff; 
    width: 100%; 
    height: 100%; 
    overflow: auto; 
}

.modal-content { 
    position: relative; 
    background: #fff; 
    padding: 20px; 
    border-radius: 10px; 
    max-width: 600px; 
    width: 90%; 
    max-height: 90%; 
    overflow-y: auto; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.3); 
}

body.modal-open, html.modal-open { 
    overflow: hidden; 
    height: 100%; 
}

.modal-header { 
    position: sticky; 
    top: 0; 
    background: #fff; 
    z-index: 10; 
    text-align: left; 
}

.modal-close { 
    position: absolute; 
    top: 12px; 
    left: 15px; 
    font-size: 24px; 
    font-weight: bold; 
    color: #444; 
    background-color: #eeeeee94; 
    cursor: pointer; 
    display: inline-block; 
    padding: 5px 10px; 
    border-radius: 8px; 
    transition: background-color 0.3s; 
}

.modal-close:hover { 
    background-color: #eee; 
}

.modal-inner-content { 
    font-family: 'Segoe UI', Tahoma, sans-serif; 
    font-size: 16px; 
    color: #222; 
    line-height: 1.6; 
}

.modal-inner-content h2 { 
    font-size: 24px; 
    color: #003366; 
    margin-top: 0; 
}

.modal-inner-content p { 
    margin: 10px 0; 
}

.modal-inner-content a { 
    color: #0066cc; 
    text-decoration: none; 
}

.modal-inner-content a:hover { 
    text-decoration: underline; 
}

/* ===== אלמנטים נוספים ===== */
#loadingOverlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(255,255,255,0.85); 
    z-index: 9999; 
    text-align: center; 
    padding-top: 200px; 
    font-family: Arial, sans-serif; 
    font-weight: 600; 
    color: #0077cc; 
    font-size: 18px; 
}

#loadingOverlay img { 
    display: block; 
    margin: 0 auto 10px; 
    width: 60px; 
    height: 60px; 
}

p.update-time { 
    text-align: center; 
    margin-top: 20px; 
    font-size: 0.9em; 
    color: #666; 
    font-style: italic; 
}

#scrollToTop {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 999;
  background: #0077cc;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: none;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
  padding: 0;
}

#scrollToTop:hover {
  background: #005fa3;
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.progress-ring__bg {
  fill: none;
  stroke: rgba(255,255,255,0.2);
  stroke-width: 3;
}

.progress-ring__fill {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 125.6;
  stroke-dashoffset: 125.6;
  transition: stroke-dashoffset 0.1s linear;
}

.arrow {
  position: absolute;
  font-size: 20px;
  line-height: 1;
}

.note-content { 
    display: none; 
    max-height: 300px; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
    padding: 10px; 
    border: 1px solid #ddd; 
    background: #f9f9f9; 
    margin-top: 10px; 
    white-space: pre-wrap; 
}

.copy-btn { 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 2px; 
    vertical-align: middle; 
}

.copy-btn:hover svg { 
    fill: #007bff; 
}

/* ===== רספונסיבי ===== */
@media (max-width: 992px) {
    #productsWrapper .row {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    .results-list {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px !important;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 160px;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    #results {
        padding: 15px 10px;
    }
    
    #productsWrapper .row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .results-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .product-card {
        padding: 15px;
        min-width: 0;
    }
    
    .product-card .card-title {
        font-size: 0.95rem;
    }
    
    .product-card .card-text {
        font-size: 0.85rem;
    }
    
    .result-item {
        padding: 15px;
        min-width: 0;
    }
    
    .result-item h4.product-name {
        font-size: 0.95rem;
    }
    
    .result-item p {
        font-size: 0.85rem;
    }
    
    .pagination .page-link {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    #results {
        padding: 12px 8px;
    }
    
    #productsWrapper {
        padding: 20px 8px;
    }
    
    #productsWrapper .row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    .results-list {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .product-card {
        padding: 12px;
        min-width: 0;
    }
    
    .product-card .card-title {
        font-size: 0.9rem;
    }
    
    .product-card .card-text {
        font-size: 0.8rem;
    }
    
    .result-item {
        padding: 12px;
        min-width: 0;
    }
    
    .result-item h4.product-name {
        font-size: 0.9rem;
    }
    
    .result-item p {
        font-size: 0.8rem;
    }
    
    .pagination {
        gap: 0;
    }
    
    .pagination .page-link {
        min-width: 32px;
        height: 32px;
        padding: 4px 8px;
        font-size: 13px;
    }
}