* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
    touch-action: pan-y;
}

:root { 
    --primary: #00a86b; --accent: #ff4757; --bg: #f8fafc; 
    --card: #ffffff; --text: #334155; --border: #e2e8f0; 
}

[data-theme='dark'] { 
    --bg: #0f172a; --card: #1e293b; --text: #f1f5f9; --border: #334155; 
}

body { 
    font-family: 'Segoe UI', sans-serif; 
    margin: 0; 
    background: var(--bg); 
    color: var(--text); 
    transition: 0.3s; 
    overflow-x: hidden; 
}

/* --- Navigation Bar (Fixed to Top) --- */
.navbar { 
    background: var(--card); 
    padding: 0 15px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: fixed; 
    top: 0; 
    left: 0;
    width: 100%;
    z-index: 1000; 
    height: 70px; 
    border-bottom: 1px solid var(--border); 
    box-sizing: border-box;
}

/* --- Content Offset for Fixed Navbar --- */
#app {
    margin-top: 70px; 
}

.logo-container { display: flex; align-items: center; gap: 10px; cursor: pointer; }
#site-logo { height: 50px; width: auto; object-fit: contain; }
#site-title { font-weight: 800; color: var(--primary); font-size: 1.1rem; }

.nav-icons-group { display: flex; align-items: center; gap: 12px; }
.icon-btn { position: relative; font-size: 1.25rem; color: var(--text); cursor: pointer; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; }
.badge { position: absolute; top: -5px; right: -5px; background: var(--accent); color: white; font-size: 0.6rem; padding: 2px 5px; border-radius: 10px; font-weight: bold; border: 2px solid var(--card); }

/* --- Category Scroll --- */
.category-scroll { 
    display: flex; overflow-x: auto; padding: 15px 10px; gap: 15px; 
    background: var(--card); border-bottom: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-item { display: flex; flex-direction: column; align-items: center; min-width: 80px; cursor: pointer; text-align: center; }
.cat-img { width: 60px; height: 60px; border-radius: 50%; overflow: hidden; border: 2px solid var(--primary); margin-bottom: 5px; background: white; }
.cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-item span { font-size: 0.65rem; font-weight: 700; color: var(--text); line-height: 1.2; }

/* --- Product Layout --- */
.container { padding: 10px; max-width: 1100px; margin: auto; }
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 10px; }
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card { 
    background: var(--card); border-radius: 16px; overflow: hidden; 
    position: relative; border: 1px solid var(--border); 
    display: flex; flex-direction: column; transition: 0.2s; height: 100%;
}

.fav-heart { 
    position: absolute; top: 10px; left: 10px; z-index: 10;
    font-size: 1.3rem; color: #ccc; cursor: pointer;
    background: rgba(255,255,255,0.8); border-radius: 50%; 
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.fav-heart.active { color: #ff4757 !important; }

.product-img { width: 100%; height: 150px; object-fit: contain; padding: 15px; background: white; box-sizing: border-box; }

.product-info { 
    padding: 12px; 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
}

.product-name { 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: var(--text); 
    margin-bottom: 4px; 
    line-height: 1.3;
    display: block;
    height: auto;
    overflow: visible;
}

.product-price { 
    color: var(--primary); 
    font-weight: 700; 
    font-size: 1rem; 
    margin-bottom: 12px; 
}

/* --- Buttons (Updated to align at bottom) --- */
.btn { 
    background: var(--primary); 
    color: white; 
    border: none; 
    padding: 14px; 
    border-radius: 12px; 
    width: 100%; 
    font-weight: bold; 
    cursor: pointer; 
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    margin-top: auto; /* This forces the button to the bottom of the card */
}

.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.96); }
.btn:disabled { background: #999; opacity: 0.5; cursor: not-allowed; transform: none; }

/* --- MODERN STYLISH FORM FIELDS --- */
input, select, textarea {
    width: 100%;
    padding: 16px 18px;
    border: 2px solid var(--border);
    border-radius: 16px;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    margin-bottom: 18px;
    background: var(--card);
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    background: var(--card);
    box-shadow: 0 0 0 4px rgba(0, 168, 107, 0.1);
    transform: translateY(-1px);
}

input::placeholder, textarea::placeholder { color: #94a3b8; font-weight: 400; opacity: 0.7; transition: all 0.3s ease; }
input:focus::placeholder { transform: translateX(10px); opacity: 0.4; }

select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2300a86b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
    padding-right: 40px;
    appearance: none;
}

/* --- Misc UI --- */
.status-stripe { background: #ff4757 !important; color: white !important; text-align: center; padding: 12px; font-weight: bold; font-size: 0.85rem; width: 100%; }
.return-bar { padding: 10px 0; color: var(--primary); font-weight: bold; cursor: pointer; display: flex; align-items: center; gap: 8px; }

/* Loader */
#loader-shell { position: fixed; inset: 0; background: #fff; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.spin { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #00a86b; border-radius: 50%; animation: rot 1s linear infinite; }
@keyframes rot { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@keyframes iconBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }
.animate-bounce { animation: iconBounce 0.4s ease-out; }
