/* Farma Tony - Ecosystem Super App Style (V3.1 Professional) */
:root {
    --primary: #0044CC;
    /* Farmatodo-like Blue */
    --primary-dark: #003399;
    --secondary: #00C853;
    /* Success Green */
    --accent: #FF3D00;
    /* Sale Red */
    --bg-body: #F4F6F8;
    --bg-white: #FFFFFF;
    --text-main: #333333;
    --text-light: #757575;
    --border: #E0E0E0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.1);
    /* Deeper shadow for pro feel */
    --radius: 8px;
    --header-height: 120px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-top: var(--header-height);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

/* --- HEADER (SUPER APP) --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--bg-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.top-strip {
    background: var(--primary);
    color: white;
    font-size: 0.8rem;
    padding: 8px 0;
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.main-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 40px;
    gap: 30px;
    max-width: 1440px;
    margin: 0 auto;
}

.brand-logo {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
}

/* Search Bar (The Core) */
.search-container {
    flex: 1;
    position: relative;
    max-width: 600px;
}

.search-input {
    width: 100%;
    padding: 14px 20px;
    padding-left: 50px;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    font-size: 0.95rem;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 68, 204, 0.15);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.1rem;
}

.user-actions {
    display: flex;
    gap: 25px;
    align-items: center;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-main);
    background: none;
    gap: 4px;
    position: relative;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--primary);
}

.action-btn i {
    font-size: 1.3rem;
    color: var(--text-main);
}

.action-btn:hover i {
    color: var(--primary);
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -2px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Subnav */
.subnav {
    border-top: 1px solid var(--border);
    padding: 0 40px;
    display: flex;
    gap: 35px;
    max-width: 1440px;
    margin: 0 auto;
    overflow-x: auto;
    height: 44px;
    align-items: center;
}

.subnav a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    position: relative;
    padding: 12px 0;
}

.subnav a:hover,
.subnav a.active {
    color: var(--primary);
}

.subnav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

/* --- MAIN LAYOUT --- */
.app-container {
    max-width: 1440px;
    margin: 30px auto;
    padding: 0 40px;
    display: grid;
    gap: 30px;
}

/* Home View */
.home-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    /* Sidebar + Content */
    gap: 30px;
}

/* PROFESSIONAL SIDEBAR */
.category-sidebar {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 15px 0;
    /* Padding vertical only */
    height: fit-content;
    position: sticky;
    top: 140px;
    border: 1px solid var(--border);
}

.cat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space for arrow */
    padding: 12px 20px;
    transition: all 0.2s;
    cursor: pointer;
    color: var(--text-main);
    border-left: 3px solid transparent;
}

.cat-item:hover {
    background: #f8f9fa;
    color: var(--primary);
    border-left: 3px solid var(--primary);
    padding-left: 25px;
    /* Slight slide effect */
}

.cat-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cat-icon {
    width: 28px;
    height: 28px;
    /* Slightly smaller for refinement */
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.9rem;
}

.cat-arrow {
    font-size: 0.8rem;
    color: #ccc;
}

.cat-item:hover .cat-arrow {
    color: var(--primary);
}

/* Main Content Area */
.content-area {
    min-height: 80vh;
}

/* PRO HERO BANNER */
.hero-banner {
    height: 320px;
    border-radius: var(--radius);
    background: linear-gradient(120deg, var(--primary) 0%, #002875 100%);
    color: white;
    display: flex;
    align-items: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: var(--shadow-md);
}

.hero-banner-content {
    z-index: 2;
    max-width: 55%;
}

.hero-banner h1 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    font-weight: 800;
    line-height: 1.1;
}

.hero-banner p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 25px;
}

.hero-banner img {
    position: absolute;
    right: 5%;
    bottom: 0;
    height: 110%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.hero-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.dot {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transition: all 0.3s;
}

.dot.active {
    background: white;
    width: 25px;
    border-radius: 10px;
}

/* Grids */
.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}

/* Product Card */
.product-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid transparent;
    /* Cleaner initial state */
    padding: 15px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
    border-color: #e0e0e0;
}

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Image Optimization */
.card-img-wrapper {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    background: white;
    padding: 10px;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-cat {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
    /* Fixed height for alignment */
}

.card-rating {
    font-size: 0.8rem;
    color: #ffc107;
    margin-bottom: 15px;
}

.card-price-row {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.old-price {
    font-size: 0.85rem;
    color: var(--text-light);
    text-decoration: line-through;
    margin-left: 5px;
}

.btn-add {
    background: white;
    border: 1px solid var(--primary);
    color: var(--primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-add:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 68, 204, 0.3);
    transform: scale(1.05);
}

/* Cart Drawer */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.cart-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.cart-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 450px;
    height: 100%;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
}

.cart-overlay.open .cart-drawer {
    transform: translateX(0);
}

.cart-header {
    padding: 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.cart-item {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: white;
    object-fit: contain;
    border: 1px solid #f0f0f0;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-weight: bold;
    color: #555;
    transition: all 0.2s;
}

.qty-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cart-footer {
    padding: 30px;
    border-top: 1px solid var(--border);
    background: white;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--text-main);
}

.btn-checkout {
    width: 100%;
    background: var(--secondary);
    color: white;
    padding: 16px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 200, 83, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-checkout:hover {
    background: #00b34a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 200, 83, 0.4);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 3000;
}

.toast {
    background: #222;
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    margin-top: 15px;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Cashea Integration */
.cashea-badge {
    background: #FFD700;
    color: #4B0082;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    vertical-align: middle;
}

.cashea-price-row {
    font-size: 0.75rem;
    color: #4B0082;
    margin-top: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    padding-top: 8px;
    border-top: 1px dashed #e0d0f0;
}

.cashea-icon {
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    margin-right: 6px;
    display: inline-block;
}

/* Flash Offers */
.flash-banner {
    background: linear-gradient(90deg, #FF3D00, #FF9100);
    color: white;
    padding: 20px 30px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    box-shadow: 0 8px 20px rgba(255, 61, 0, 0.25);
}

.flash-timer {
    font-family: monospace;
    font-size: 1.6rem;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 20px;
    border-radius: 8px;
    letter-spacing: 2px;
}

/* WhatsApp Button */
.btn-whatsapp {
    background: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background: #128C7E;
}

/* Responsive Footer */
@media (max-width: 600px) {
    footer .app-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

/* Responsive */
@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }

    .category-sidebar {
        display: none;
    }

    /* Hide sidebar on mobile for now */
    .subnav {
        display: none;
    }

    /* Simplify header */
}

@media (max-width: 600px) {
    .main-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
    }

    .search-container {
        width: 100%;
    }

    .cart-drawer {
        width: 100%;
    }

    .app-container {
        padding: 0 15px;
    }

    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Mobile Card Height Fix */
    .card-img-wrapper {
        height: 140px;
    }

    .btn-add {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .hero-banner {
        height: 260px;
        padding: 30px;
    }

    .hero-banner h1 {
        font-size: 1.8rem;
    }
}