/**
 * Tanoor Hadramout - Menu Styles
 * Cleaned & optimized for the new menu system
 */

/* ===== Base Variables ===== */
:root {
    --th-primary: #D4AF37;
    --th-secondary: #8B0000;
}

/* ===== Menu Wrapper ===== */
.th-menu-wrapper {
    padding: 30px 0;
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    direction: rtl;
}

/* ===== Toolbar (Search & Filter) ===== */
.th-menu-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    align-items: center;
}

/* ===== Search Box ===== */
.th-search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 350px;
}

.th-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.th-search-input {
    width: 100%;
    padding: 14px 45px 14px 40px;
    border: 2px solid #eee;
    border-radius: 30px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
    background: #fff;
}

.th-search-input:focus {
    outline: none;
    border-color: var(--th-primary);
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.th-search-clear {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #ddd;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.th-search-clear:hover {
    background: #ccc;
}

/* ===== Category Filter ===== */
.th-menu-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.th-desktop-filter {
    flex: 2;
}

.th-mobile-filter {
    display: none;
}

.th-filter-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 2px solid #eee;
    background: #fff;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s;
    color: #555;
}

.th-filter-btn:hover {
    border-color: var(--th-primary);
    color: var(--th-primary);
}

.th-filter-btn.active {
    background: var(--th-secondary);
    border-color: var(--th-secondary);
    color: #fff;
}

.th-filter-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.th-filter-btn.active .th-filter-count {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Select */
.th-category-select {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #eee;
    border-radius: 25px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
}

/* ===== Results Info ===== */
.th-results-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    font-size: 14px;
}

.th-clear-filters,
.th-clear-search {
    padding: 8px 16px;
    background: var(--th-secondary);
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.3s;
}

.th-clear-filters:hover,
.th-clear-search:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* ===== Menu Grid ===== */
.th-menu-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: 25px;
}

@media (max-width: 992px) {
    .th-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .th-menu-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ===== Menu Item Card ===== */
.th-menu-item {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.th-menu-item:hover,
.th-menu-item:focus {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    outline: none;
}

.th-menu-item:focus {
    box-shadow: 0 0 0 3px var(--th-primary), 0 20px 50px rgba(0, 0, 0, 0.15);
}

.th-menu-item.hidden {
    display: none;
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(25px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.th-menu-item:nth-child(1) {
    animation-delay: 0.05s;
}

.th-menu-item:nth-child(2) {
    animation-delay: 0.1s;
}

.th-menu-item:nth-child(3) {
    animation-delay: 0.15s;
}

.th-menu-item:nth-child(4) {
    animation-delay: 0.2s;
}

.th-menu-item:nth-child(5) {
    animation-delay: 0.25s;
}

.th-menu-item:nth-child(6) {
    animation-delay: 0.3s;
}

.th-menu-item:nth-child(7) {
    animation-delay: 0.35s;
}

.th-menu-item:nth-child(8) {
    animation-delay: 0.4s;
}

.th-menu-item:nth-child(9) {
    animation-delay: 0.45s;
}

.th-menu-item:nth-child(10) {
    animation-delay: 0.5s;
}

.th-menu-item:nth-child(11) {
    animation-delay: 0.55s;
}

.th-menu-item:nth-child(12) {
    animation-delay: 0.6s;
}

/* ===== Item Image ===== */
.th-menu-item-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.th-menu-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.th-menu-item:hover .th-menu-item-image img {
    transform: scale(1.08);
}

.th-menu-item-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    font-size: 60px;
}

/* ===== Badges ===== */
.th-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.th-menu-badge {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 700;
}

.th-menu-badge.th-sale {
    background: linear-gradient(135deg, #ff4757, #ff6b7a);
    color: #fff;
}

.th-menu-badge.th-featured {
    background: var(--th-primary);
    color: #1a1a2e;
}

/* ===== Quick View Overlay ===== */
.th-quick-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.th-quick-overlay span {
    background: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transform: translateY(10px);
    transition: transform 0.3s;
}

.th-menu-item:hover .th-quick-overlay,
.th-menu-item:focus .th-quick-overlay {
    opacity: 1;
}

.th-menu-item:hover .th-quick-overlay span,
.th-menu-item:focus .th-quick-overlay span {
    transform: translateY(0);
}

/* ===== Item Content ===== */
.th-menu-item-content {
    padding: 18px;
}

.th-menu-item-title {
    margin: 0 0 8px;
    font-size: 17px;
    color: #333;
    line-height: 1.3;
}

.th-menu-item-desc {
    color: #666;
    font-size: 13px;
    margin: 0 0 12px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.th-menu-item-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.th-meta-item {
    font-size: 12px;
    color: #888;
    background: #f5f5f5;
    padding: 4px 10px;
    border-radius: 12px;
}

/* ===== Item Footer ===== */
.th-menu-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.th-menu-item-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.th-price-old {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}

.th-price-current {
    font-size: 18px;
    font-weight: 700;
    color: var(--th-secondary);
}

/* ===== Order Button ===== */
.th-order-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: var(--th-primary);
    color: #1a1a2e;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s;
    white-space: nowrap;
}

.th-order-btn:hover {
    background: var(--th-secondary);
    color: #fff;
    transform: scale(1.05);
}

/* ===== Empty & No Results ===== */
.th-menu-empty,
.th-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 20px;
}

.th-empty-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.th-menu-empty p,
.th-no-results p {
    font-size: 18px;
    color: #666;
    margin: 0 0 15px;
}

/* ===== Modal ===== */
.th-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.th-modal.active {
    opacity: 1;
    visibility: visible;
}

.th-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.th-modal-content {
    position: relative;
    background: #fff;
    border-radius: 25px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s;
    direction: rtl;
}

.th-modal.active .th-modal-content {
    transform: scale(1) translateY(0);
}

.th-modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.th-modal-close:hover {
    background: #fff;
    transform: rotate(90deg);
}

.th-modal-image {
    position: relative;
    height: 280px;
    background: #f5f5f5;
}

.th-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.th-modal-badges {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.th-modal-body {
    padding: 25px;
}

.th-modal-title {
    margin: 0 0 12px;
    font-size: 24px;
    color: #333;
}

.th-modal-desc {
    color: #666;
    font-size: 15px;
    line-height: 1.7;
    margin: 0 0 20px;
}

.th-modal-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.th-modal-meta .th-meta-item {
    font-size: 14px;
    padding: 8px 15px;
}

.th-modal-categories {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.th-modal-cat {
    background: #f0f0f0;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    color: #666;
}

.th-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.th-modal-price {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.th-modal-price-old {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.th-modal-price-current {
    font-size: 26px;
    font-weight: 700;
    color: var(--th-secondary);
}

.th-modal-order-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.3s;
}

.th-modal-order-btn:hover {
    background: #128C7E;
    transform: scale(1.03);
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .th-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .th-desktop-filter {
        display: none;
    }

    .th-mobile-filter {
        display: block;
        flex: 1;
    }

    .th-search-box {
        max-width: none;
    }

    .th-menu-toolbar {
        flex-direction: column;
    }

    .th-modal-image {
        height: 220px;
    }

    .th-modal-title {
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .th-menu-grid {
        grid-template-columns: 1fr;
    }

    .th-menu-item-image {
        height: 180px;
    }

    .th-modal-footer {
        flex-direction: column;
    }

    .th-modal-order-btn {
        width: 100%;
        justify-content: center;
    }
}