:root {
    --bg-dark: #0a0a0c;
    --nav-bg: rgba(10, 10, 12, 0.98); 
    --primary: #a855f7; 
    --accent: #22d3ee;  
    --card-bg: #141419;
    --text-main: #ffffff;
    --text-sub: #b0b0b0;
    --glow-primary: 0 0 10px rgba(168, 85, 247, 0.3);
    --glow-accent: 0 0 10px rgba(34, 211, 238, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', 'Segoe UI', sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
}

/* --- OPTIMIZED BACKGROUND ANIMATION --- */
.bg-animation {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: 
        radial-gradient(circle at 15% 20%, rgba(168, 85, 247, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(34, 211, 238, 0.06) 0%, transparent 40%);
    z-index: -1;
    /* Hardware acceleration activated */
    transform: translateZ(0);
    will-change: transform;
    animation: backgroundPulse 15s infinite alternate linear;
}

@keyframes backgroundPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 40px; background: var(--nav-bg); 
    border-bottom: 1px solid rgba(168, 85, 247, 0.2); 
    position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 15px; }
.logo-img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--primary); }

.store-name { 
    font-size: 26px; font-weight: 800; letter-spacing: 2px; color: #fff; text-transform: uppercase;
    text-shadow: 0 0 10px var(--primary);
}

.nav-center input {
    padding: 12px 25px; border-radius: 25px; border: 1px solid rgba(255,255,255,0.1); outline: none;
    background: rgba(255,255,255,0.05); color: #fff; width: 350px; transition: 0.3s;
}
.nav-center input:focus { border-color: var(--accent); box-shadow: var(--glow-accent); }

.nav-right ul { display: flex; list-style: none; gap: 30px; align-items: center; }
.nav-right a { color: #eee; text-decoration: none; font-weight: 500; transition: 0.3s; font-size: 15px;}
.nav-right a:hover { color: var(--accent); }
.btn-signup { background: var(--primary); padding: 10px 25px; border-radius: 25px; }

.container { display: flex; min-height: calc(100vh - 75px); }

.sidebar {
    width: 260px; background: rgba(0,0,0,0.2); padding: 40px 20px;
    border-right: 1px solid rgba(255,255,255,0.03);
}
.sidebar h3 { color: #888; margin-bottom: 25px; font-size: 13px; text-transform: uppercase; padding-left: 15px;}
.cat-btn {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 14px 15px; margin-bottom: 12px; background: transparent;
    color: #ccc; border: 1px solid transparent; border-radius: 10px; cursor: pointer; transition: 0.2s;
}
.cat-btn:hover { background: rgba(255,255,255,0.03); color: #fff; }
.cat-btn.active { 
    background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.4); 
    color: #fff; font-weight: 600;
}

.content { flex: 1; padding: 50px; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.content-header h1 { font-weight: 700; font-size: 32px; }

.filter-select {
    background: #141417; color: #eee; border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 18px; border-radius: 8px; outline: none;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 30px; }

/* --- OPTIMIZED CARDS --- */
.card {
    background: var(--card-bg); border-radius: 18px; padding: 22px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); 
    cursor: pointer; position: relative;
}
.card:hover { 
    transform: translateY(-5px); 
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0,0,0,0.4); 
}

.card img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 18px; background: #000; }
.card h2 { font-size: 21px; margin-bottom: 8px; }
.price { color: var(--accent); font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.validity { background: rgba(34, 211, 238, 0.1); color: var(--accent); padding: 4px 10px; border-radius: 6px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 12px; }
.desc { color: var(--text-sub); font-size: 14px; line-height: 1.5; height: 42px; overflow: hidden; }

/* --- MODAL OPTIMIZATION --- */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.9); z-index: 1000;
    justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s;
}
.modal.show { opacity: 1; }
.modal-content {
    background: #111114; width: 650px; padding: 40px; border-radius: 24px;
    border: 1px solid var(--primary); transform: scale(0.95); transition: transform 0.3s;
}
.modal.show .modal-content { transform: scale(1); }
.close-modal { position: absolute; top: 20px; right: 25px; font-size: 28px; cursor: pointer; color: #666; }
.modal-details { display: flex; gap: 30px; margin-top: 25px; }
.modal-img { width: 45%; border-radius: 15px; object-fit: cover; height: 220px;}
.modal-info { width: 55%; display: flex; flex-direction: column;}

.action-btns { margin-top: auto; padding-top: 20px; display: flex; gap: 10px; flex-direction: column; }
.btn { padding: 12px; border: none; border-radius: 10px; font-weight: 600; cursor: pointer; transition: 0.2s; width: 100%; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; }

.btn-buy { background: var(--primary); color: #fff; }
.btn-buy:hover { opacity: 0.9; }
.btn-cart { background: transparent; border: 1px solid var(--accent); color: var(--accent); }

.contact-options { display: none; margin-top: 15px; gap: 10px; }
.btn-wa { background: #25D366; color: #fff; }
.btn-tg { background: #0088cc; color: #fff; }

/* Admin and Scrollbar... (Remaining styles kept minimal) */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }

/* පවතින UI එක වෙනස් නොකර Description එක පාලනය කිරීම */
.card .desc {
    display: -webkit-box;
    -webkit-line-clamp: 3; /* පේළි ගණන (ඔබට අවශ්‍ය නම් මෙය වැඩි කළ හැක) */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    height: auto; /* auto කිරීමෙන් අකුරු ප්‍රමාණය අනුව හැඩගැසේ */
    margin-bottom: 10px;
}