﻿/* --- 1. RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

/* --- 2. DESIGN SYSTEM --- */
:root {
    --bg-body: #0a0a0a;
    --bg-surface: #141414;
    --bg-card: #1c1c1c;
    --primary: #D4A373;
    --primary-glow: rgba(212, 163, 115, 0.4);
    --text-main: #ffffff;
    --text-muted: #888888;
    --danger: #e63946;
    --success: #2a9d8f;
    --radius: 16px;
    --header-h: 65px;
    --nav-w: 85px;
    /* Skeleton Colors */
    --skel-base: #202020;
    --skel-highlight: #2a2a2a;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Cairo', sans-serif;
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-top: 0;
}

/* --- 3. HEADER --- */
.app-header {
    height: var(--header-h);
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
}

.brand-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    color: var(--primary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .btn-icon:active {
        transform: scale(0.9);
    }

/* --- 4. SEARCH OVERLAY --- */
.search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-surface);
    padding: 0 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 60;
}

    .search-overlay.active {
        transform: translateY(0);
    }

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'Cairo';
    font-size: 1.1rem;
    outline: none;
}

/* --- 5. APP LAYOUT --- */
.layout-grid {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: var(--nav-w);
    background: var(--bg-surface);
    border-left: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: scroll;
    padding-top: 10px;
}

    .sidebar::-webkit-scrollbar {
        display: none;
    }

.nav-tab {
    width: 100%;
    padding: 15px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

    .nav-tab i {
        font-size: 1.4rem;
        transition: 0.3s;
    }

    .nav-tab span {
        font-size: 0.7rem;
        font-weight: 600;
        text-align: center;
        line-height: 1.1;
    }

    .nav-tab.active {
        color: var(--primary);
        background: linear-gradient(90deg, rgba(212,163,115,0.08), transparent);
    }

        .nav-tab.active i {
            transform: scale(1.1);
            text-shadow: 0 0 10px var(--primary-glow);
        }

        .nav-tab.active::before {
            content: '';
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            height: 25px;
            width: 3px;
            background: var(--primary);
            border-radius: 4px 0 0 4px;
        }

.content-area {
    flex: 1;
    background: var(--bg-body);
    overflow-y: auto;
    padding: 15px;
    position: relative;
}

/* --- 6. CATEGORY SECTIONS --- */
.menu-section {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
    padding-bottom: 80px;
}

    .menu-section.active-view {
        display: block;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.sec-title {
    font-size: 1.3rem;
    color: #fff;
    font-weight: 700;
}

.sec-count {
    font-size: 0.85rem;
    color: var(--primary);
}

/* --- 7. PRODUCT ITEMS --- */
.item-list {
    display: grid;
    gap: 12px;
}

.product-item {
    display: grid;
    grid-template-columns: 85px 1fr auto;
    gap: 12px;
    background: var(--bg-card);
    padding: 10px;
    border-radius: var(--radius);
    align-items: center;
    border: 1px solid transparent;
    transition: transform 0.2s;
    position: relative;
}

    .product-item:active {
        transform: scale(0.98);
        background: #252525;
    }

.p-thumb {
    width: 85px;
    height: 85px;
    border-radius: 10px;
    overflow: hidden;
    background: #2a2a2a;
    position: relative;
    cursor: pointer;
}

.p-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.p-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.p-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    line-height: 1.3;
}

.p-desc {
    font-size: 0.75rem;
    color: #888;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.p-price {
    font-size: 1rem;
    color: var(--primary);
    font-weight: 700;
    margin-top: 5px;
}

    .p-price::after {
        content: ' ل.س';
        font-size: 0.75rem;
        opacity: 0.8;
    }

.add-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(212,163,115,0.2);
    background: rgba(255,255,255,0.03);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.2s;
}

    .add-btn.added {
        background: var(--primary);
        color: #000;
        border-color: var(--primary);
    }

/* UI State for disabled items */
.product-item.disabled {
    opacity: 0.6;
    position: relative;
}

    .product-item.disabled .p-img {
        filter: grayscale(1);
    }

    .product-item.disabled::before {
        content: 'غير متوفر';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(-20deg);
        background: rgba(230, 57, 70, 0.9);
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
        font-weight: bold;
        z-index: 2;
        white-space: nowrap;
    }

    .product-item.disabled .add-btn {
        display: none;
    }

.product-item.hidden {
    display: none !important;
}

/* --- 8. CART FAB --- */
.fab-cart {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--primary), #b08d55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 90;
    color: #000;
    font-size: 1.5rem;
    transform: scale(0) rotate(180deg);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    border: none;
}

    .fab-cart.show {
        transform: scale(1) rotate(0deg);
    }

.badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-body);
}

/* --- 9. CART MODAL --- */
.modal-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    display: flex;
    align-items: flex-end;
}

    .modal-wrap.active {
        opacity: 1;
        pointer-events: all;
    }

.bottom-sheet {
    background: #181818;
    width: 100%;
    max-height: 80vh;
    border-radius: 24px 24px 0 0;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.1, 0.7, 0.1, 1);
    display: flex;
    flex-direction: column;
}

.modal-wrap.active .bottom-sheet {
    transform: translateY(0);
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sheet-title {
    font-family: 'Playfair Display';
    font-size: 1.4rem;
    color: var(--primary);
}

.cart-list {
    overflow-y: auto;
    flex: 1;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.qty-ctrl {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 4px 8px;
    border-radius: 20px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.btn-action {
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    border: none;
    font-family: 'Cairo';
    cursor: pointer;
    font-size: 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s;
}

    .btn-action:active {
        transform: scale(0.95);
    }

    .btn-action i {
        font-size: 1.1rem;
    }

.btn-primary {
    background: var(--primary);
    color: #000;
    flex: 2;
}

.btn-danger {
    background: rgba(230, 57, 70, 0.15);
    color: var(--danger);
    flex: 1;
}

/* --- 10. ANIMATIONS & EXTRAS --- */
.fly-img {
    position: fixed;
    z-index: 9999;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    pointer-events: none;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    display: none;
}

.price-on-request {
    font-size: 0.85rem;
    color: var(--primary);
    font-style: italic;
    margin-top: 5px;
    opacity: 0.8;
}

.custom-scroll::-webkit-scrollbar {
    width: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

    .custom-scroll::-webkit-scrollbar-thumb:hover {
        background: var(--primary);
    }

/* --- 11. SKELETON LOADING --- */
.skeleton-wrapper {
    width: 100%;
    animation: fadeOut 0.5s ease-out forwards;
}

.skeleton-card {
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.02);
}

.skeleton-anim {
    background: var(--skel-base);
    background: linear-gradient(90deg, var(--skel-base) 25%, var(--skel-highlight) 50%, var(--skel-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-move 1.5s infinite linear;
    border-radius: 4px;
}

.skeleton-line {
    display: block;
    background-color: var(--skel-base);
}

@keyframes skeleton-move {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ========================================================= */
/* --- 12. IMAGE VIEWER MODAL --- */
/* ========================================================= */
.image-viewer-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.iv-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
}

.iv-content {
    position: relative;
    z-index: 2001;
    width: 90%;
    max-width: 450px;
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    border: 1px solid rgba(212, 163, 115, 0.15);
    opacity: 0;
    transform: scale(0.8);
    display: flex;
    flex-direction: column;
}

.iv-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    z-index: 10;
}

    .iv-close:active {
        transform: scale(0.85);
        background: var(--danger);
    }

.iv-img {
    max-width: 100%;
    width: auto;
    max-height: 50vh; /* Yüksekliği biraz kıstık ki devasa durmasın */
    object-fit: contain;
    background: transparent; /* Siyah arka planı kaldırdık, kartla bütünleşsin */
    margin: 25px auto 0 auto; /* Üstten nefes alma boşluğu bıraktık */
    display: block;
    border-radius: 12px; /* Fotoğrafın kendi köşelerini de yumuşattık (Premium his) */
    box-shadow: 0 8px 20px rgba(0,0,0,0.4); /* Fotoğrafa hafif bir derinlik verdik */
}

.iv-info {
    padding: 20px;
    text-align: center;
    background: var(--bg-card);
}

.iv-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.4;
}

.iv-price {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 700;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    :root {
        --nav-w: 70px;
        --header-h: 60px;
    }

    .brand-text {
        font-size: 1rem;
    }

    .p-thumb {
        width: 70px;
        height: 70px;
    }

    .fab-cart {
        bottom: 20px;
        left: 20px;
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    :root {
        --nav-w: 65px;
    }

    .content-area {
        padding: 10px;
    }

    .product-item {
        grid-template-columns: 60px 1fr auto;
        gap: 10px;
        padding: 8px;
    }

    .p-thumb {
        width: 60px;
        height: 60px;
    }

    .p-name {
        font-size: 0.85rem;
    }

    .p-price {
        font-size: 0.9rem;
    }

    .price-on-request {
        font-size: 0.75rem;
    }

    .add-btn {
        width: 36px;
        height: 36px;
    }

    /* --- MOBİL İÇİN YENİ IMAGE VIEWER AYARLARI --- */
    .iv-content {
        width: 85%; /* %95'ten %85'e düşürdük. Kenarlardan boşluk kalarak resmi sıkıştırır */
        max-width: 320px; /* Mobilde çok büyümesini engeller */
    }

    .iv-img {
        max-height: 35vh; /* Mobilde dikeyde çok yer kaplamasını ve bozulmasını engeller */
        max-width: 90%; /* Resmin sağdan soldan biraz daha içeride durmasını sağlar */
        margin-top: 20px;
    }

    .iv-title {
        font-size: 1.15rem; /* Mobilde başlığı bir tık küçülttük */
    }

    .iv-price {
        font-size: 1rem;
    }
}
