/* category.css - Yalnız category.html üçün xüsusi stillər */

/* --- Axtarış Sahəsi --- */
.search-container {
    margin: 20px 0 30px;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    padding: 12px 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.search-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(var(--primary-color-rgb, 85, 85, 85), 0.2);
    transform: translateY(-2px);
}

.search-icon {
    color: var(--text-color);
    opacity: 0.7;
    font-size: 1.2rem;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    padding: 0;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--text-color);
    opacity: 0.5;
}

.clear-search-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.clear-search-btn:hover {
    opacity: 1;
    background-color: rgba(var(--primary-color-rgb, 85, 85, 85), 0.1);
}

.clear-search-btn.hidden {
    display: none;
}

.search-count {
    margin-top: 10px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    animation: fadeIn 0.3s ease;
}

.search-count.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Axtarış Nəticələri --- */
.search-results-container {
    margin-top: 30px;
    animation: slideUp 0.4s ease;
}

.search-results-container.hidden {
    display: none;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-results-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
    position: relative;
    padding-bottom: 10px;
}

.search-results-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Axtarış zamanı kateqoriya naviqasiyasını gizlətmək üçün */
.searching .category-nav-slider {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Axtarış nəticələri üçün xüsusi məhsul item stili */
.search-product-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
    background-color: var(--card-background);
    padding: 18px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.search-product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(var(--primary-color-rgb, 85, 85, 85), 0.2);
}

.search-product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background-color: var(--primary-color);
    opacity: 1;
}

.search-product-category {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--header-text-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
    margin-right: 8px;
}

/* --- Kateqoriya Naviqasiyası (Slider) --- */
.category-nav-slider {
    display: flex;
    overflow-x: auto; /* Sürüşdürmə effekti verir */
    white-space: nowrap; 
    padding-bottom: 15px; /* Görünüş üçün */
    margin-bottom: 30px;
    -webkit-overflow-scrolling: touch; /* iOS üçün hamar sürüşdürmə */
    position: relative;
    
    /* Scrollbarı gizlətmək (dəstəkləyən brauzerlər üçün) */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

/* Scrollbarı gizlətmək (Chrome, Safari, Opera) */
.category-nav-slider::-webkit-scrollbar {
    display: none;
}

.category-nav-item {
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--card-background);
    border: 2px solid var(--border-color);
    padding: 10px 18px;
    margin-right: 12px; /* Yan-yana məsafə */
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Elementlərin kiçilməsini əngəlləyir */
    position: relative;
    display: inline-block;
}

.category-nav-item:hover {
    background-color: var(--primary-color);
    color: var(--header-text-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-nav-item.active {
    background-color: var(--primary-color);
    color: var(--header-text-color);
    border-color: var(--primary-color);
    font-weight: 700;
    transform: scale(1.08);
    box-shadow: 0 6px 15px rgba(85, 85, 85, 0.3);
    position: relative;
}

/* Aktiv kateqoriya üçün aşağı ox işarəsi */
.category-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Gecə rejimi düzəlişi */
.dark-mode .category-nav-item {
    background-color: var(--card-background);
    color: var(--text-color);
    border-color: var(--border-color);
}

.dark-mode .category-nav-item:hover,
.dark-mode .category-nav-item.active {
    background-color: var(--primary-color);
    color: var(--header-text-color);
    border-color: var(--primary-color);
}

.dark-mode .category-nav-item.active {
    box-shadow: 0 6px 15px rgba(85, 85, 85, 0.5);
}

/* --- Yemək Siyahısı Və Elementi --- */
.product-list-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 40px;
    min-height: 300px; /* Minimum hündürlük */
}

.product-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
    background-color: var(--card-background);
    padding: 18px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.product-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.product-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-item:hover::before {
    opacity: 1;
}

.product-details {
    flex: 1;
    padding-right: 20px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Bu vacibdir: flex item-in overflow problemi üçün */
}

.product-name {
    font-size: 1.2rem;
    font-weight: 700; /* Qalın şrift */
    color: var(--primary-color);
    margin-bottom: 8px;
    line-height: 1.3;
    word-break: break-word; /* Uzun sözləri sındır */
}

.product-price {
    font-size: 1.2rem;
    font-weight: 600;
    color: #463f3f; /* Boz rəng - gündüz rejimi */
    margin-bottom: 10px;
    flex-shrink: 0; /* Qiymət ölçüsü sabit qalsın */
}

/* Gecə rejimində qiymət rəngi */
.dark-mode .product-price {
    color: #ffffff; /* Ağ rəng - gecə rejimi */
}

.product-description {
    font-size: 0.9rem;
    font-weight: 300; /* Nazik şrift */
    color: var(--text-color);
    opacity: 0.8;
    line-height: 1.5;
    /* Uzun mətn üçün limitləmə */
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Default: 3 sətir */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1; /* Boş yeri tutsun */
    word-break: break-word; /* Uzun sözləri sındır */
}

.product-image {
    width: 100px; 
    height: 100px;
    min-width: 100px; /* Minimum en */
    max-width: 100px; /* Maksimum en */
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--border-color);
    flex-shrink: 0; /* Şəklin kiçilməsini əngəllə */
    margin-left: 15px; /* Soldan boşluq */
    transition: all 0.3s ease;
}

.product-item:hover .product-image {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* --- Modal Panel (Aşağıdan Yuxarı) --- */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Fon qaraltma */
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Aşağıdan yuxarı gəlsin */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.product-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--background-color);
    width: 100%;
    max-width: 700px; /* Container-ə uyğun */
    border-radius: 25px 25px 0 0;
    padding: 25px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
    
    /* Animasiya - FİKS OLUNDU */
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.product-modal.show .modal-content {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: var(--header-text-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-modal.show .modal-close-btn {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
}

.modal-close-btn:hover {
    transform: scale(1.1) rotate(90deg);
    background: var(--accent-color);
}

.modal-image-container {
    width: 100%;
    padding-top: 100%; /* 1:1 nisbət */
    position: relative;
    margin-bottom: 25px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    border-radius: 15px;
    overflow: hidden;
}

.product-modal.show .modal-image-container {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease 0.1s, transform 0.5s ease 0.1s;
}

#modal-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.modal-details {
    text-align: left;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.product-modal.show .modal-details {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

.modal-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    line-height: 1.2;
    word-break: break-word;
}

.modal-price {
    font-size: 1.8rem;
    font-weight: 600;
    color: #463f3f; /* Boz rəng - gündüz rejimi */
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

/* Gecə rejimində modal qiymət rəngi */
.dark-mode .modal-price {
    color: #ffffff; /* Ağ rəng - gecə rejimi */
}

.modal-description {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-color);
    line-height: 1.6;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
    word-break: break-word;
    padding-top: 15px;
}

/* Modal description scrollbar */
.modal-description::-webkit-scrollbar {
    width: 6px;
}

.modal-description::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 3px;
}

.modal-description::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* --- Hidden class --- */
.hidden {
    display: none !important;
}

/* --- Loading State --- */
.loading {
    text-align: center;
    padding: 50px 0;
    color: var(--text-color);
    opacity: 0.7;
}

.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-color);
    opacity: 0.6;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--border-color);
}

/* Tablet və kiçik ekranlar */
@media (max-width: 768px) {
    .search-container {
        margin: 15px 0 25px;
    }
    
    .search-wrapper {
        padding: 10px 16px;
    }
    
    .search-icon {
        font-size: 1.1rem;
        margin-right: 10px;
    }
    
    .search-input {
        font-size: 0.95rem;
    }
    
    .search-results-title {
        font-size: 1.3rem;
    }
    
    .category-nav-item {
        padding: 8px 15px;
        font-size: 0.9rem;
        margin-right: 8px;
    }
    
    .product-item {
        min-height: 110px;
        padding: 15px;
        border-radius: 12px;
    }
    
    .product-details {
        padding-right: 15px;
    }
    
    .product-name {
        font-size: 1.1rem;
        -webkit-line-clamp: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .product-price {
        font-size: 1.1rem;
        color: #463f3f; /* Mobil üçün də eyni rəng */
    }
    
    .dark-mode .product-price {
        color: #ffffff; /* Mobil gecə rejimi */
    }
    
    .product-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        max-height: 40px;
        line-height: 1.4;
    }
    
    .product-image {
        width: 90px;
        height: 90px;
        min-width: 90px;
        max-width: 90px;
        margin-left: 10px;
    }
    
    .modal-content {
        padding: 20px;
        border-radius: 20px 20px 0 0;
    }
    
    .modal-name {
        font-size: 1.6rem;
    }
    
    .modal-price {
        font-size: 1.5rem;
        color: #463f3f;
    }
    
    .dark-mode .modal-price {
        color: #ffffff;
    }
    
    .modal-description {
        font-size: 1rem;
        max-height: 200px;
    }
}

/* Mobil telefonlar */
@media (max-width: 480px) {
    .search-container {
        margin: 10px 0 20px;
    }
    
    .search-wrapper {
        padding: 8px 14px;
        border-radius: 40px;
    }
    
    .search-icon {
        font-size: 1rem;
        margin-right: 8px;
    }
    
    .search-input {
        font-size: 0.9rem;
    }
    
    .clear-search-btn {
        width: 26px;
        height: 26px;
        font-size: 0.9rem;
    }
    
    .search-count {
        font-size: 0.85rem;
    }
    
    .search-results-title {
        font-size: 1.2rem;
    }
    
    .search-product-category {
        font-size: 0.75rem;
        padding: 3px 10px;
    }
    
    .category-nav-slider {
        padding-bottom: 12px;
        margin-bottom: 25px;
    }
    
    .category-nav-item {
        padding: 7px 12px;
        font-size: 0.85rem;
        margin-right: 6px;
        border-radius: 20px;
    }
    
    .category-nav-item.active::after {
        bottom: -8px;
        width: 20px;
        height: 3px;
    }
    
    .product-item {
        min-height: 100px;
        padding: 12px;
        border-radius: 10px;
    }
    
    .product-details {
        padding-right: 10px;
    }
    
    .product-name {
        font-size: 1rem;
        margin-bottom: 4px;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .product-price {
        font-size: 1rem;
        margin-bottom: 6px;
        color: #463f3f;
    }
    
    .dark-mode .product-price {
        color: #ffffff;
    }
    
    .product-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        max-height: 36px;
        line-height: 1.3;
    }
    
    .product-image {
        width: 80px;
        height: 80px;
        min-width: 80px;
        max-width: 80px;
        margin-left: 8px;
    }
    
    .modal-name {
        font-size: 1.4rem;
    }
    
    .modal-price {
        font-size: 1.3rem;
        color: #463f3f;
    }
    
    .dark-mode .modal-price {
        color: #ffffff;
    }
    
    .modal-description {
        font-size: 0.95rem;
        max-height: 180px;
    }
}

/* Çox kiçik ekranlar (iPhone SE kimi) */
@media (max-width: 375px) {
    .product-item {
        min-height: 95px;
        padding: 10px;
    }
    
    .product-name {
        font-size: 0.95rem;
    }
    
    .product-price {
        font-size: 0.95rem;
        color: #463f3f;
    }
    
    .dark-mode .product-price {
        color: #ffffff;
    }
    
    .product-description {
        font-size: 0.75rem;
        -webkit-line-clamp: 1; /* Çox kiçik ekranlarda 1 sətir */
        max-height: 18px;
    }
    
    .product-image {
        width: 70px;
        height: 70px;
        min-width: 70px;
        max-width: 70px;
    }
}

/* Ən kiçik ekranlar */
@media (max-width: 320px) {
    .product-item {
        flex-wrap: wrap; /* Çox dar ekranlarda wrap edək */
        min-height: auto;
    }
    
    .product-details {
        width: 100%;
        padding-right: 0;
        margin-bottom: 10px;
    }
    
    .product-price {
        color: #463f3f;
    }
    
    .dark-mode .product-price {
        color: #ffffff;
    }
    
    .product-image {
        width: 100%;
        height: 140px;
        min-width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .product-name {
        -webkit-line-clamp: 2;
        white-space: normal;
    }
    
    .product-description {
        -webkit-line-clamp: 2;
        max-height: 36px;
    }
}
