:root {
    --primary-yellow: #FFDE20;
    --primary-blue: #4DC3D8;
    --dark-blue: #0288D1;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --bg-main: #F9FAFB;
    --white: #FFFFFF;
    --success: #25D366;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-nav: 0 -2px 10px rgba(0, 0, 0, 0.05);

    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* App-like unselectable text except inputs */
}

input,
textarea {
    user-select: text;
}

body {
    font-family: 'Cairo', 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    padding-bottom: 90px;
    /* Space for bottom nav */
    overscroll-behavior-y: none;
    /* Disables pull-to-refresh on page body in some browsers */
}

/* --- App Header --- */
.app-header {
    background-color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    padding-bottom: 10px;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px 10px 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--primary-yellow);
    object-fit: cover;
}

.user-welcome {
    display: flex;
    flex-direction: column;
}

.welcome-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    background-color: #f3f4f6;
    position: relative;
    cursor: pointer;
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #FF5252;
    color: white;
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--white);
    font-weight: bold;
}

.search-container {
    padding: 0 20px 10px 20px;
}

.search-box {
    background-color: #F3F4F6;
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
}

.header-spacer {
    height: 140px;
}

/* --- Categories Stories --- */
.categories-section {
    margin-top: 15px;
    margin-bottom: 20px;
}

.categories-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 20px;
    scrollbar-width: none;
    /* Firefox */
}

.categories-scroll::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 60px;
    cursor: pointer;
}

.cat-icon {
    width: 60px;
    height: 60px;
    background-color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all 0.2s;
}

.category-item.active .cat-icon {
    border-color: var(--primary-yellow);
    background-color: rgba(255, 222, 32, 0.1);
}

.category-item span {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

/* --- Hero Section --- */
.hero-section {
    padding: 0 20px;
    margin-bottom: 25px;
}

.hero-card {
    background: linear-gradient(135deg, var(--primary-yellow), #FFB74D);
    border-radius: var(--radius-xl);
    padding: 24px;
    position: relative;
    overflow: hidden;
    color: #4A3B00;
    box-shadow: 0 8px 16px -4px rgba(255, 222, 32, 0.4);
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-tag {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: inline-block;
}

.hero-card h1 {
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 8px;
}

.hero-card p {
    font-size: 0.95rem;
    margin-bottom: 20px;
    opacity: 0.9;
    font-weight: 600;
}

.hero-btn {
    background-color: var(--text-main);
    color: var(--white);
    border: none;
    padding: 10px 24px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --- Products Section --- */
.products-section {
    padding: 0 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.view-all {
    font-size: 0.85rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
}

.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.app-product-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.card-image {
    position: relative;
    padding-top: 110%;
    /* Taller aspect ratio */
    background-color: #f3f4f6;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.price-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.favorite-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    z-index: 2;
    color: #FF5252;
}

.card-details {
    padding: 12px;
}

.card-title {
    font-size: 0.9rem;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    margin-bottom: 10px;
    color: #FBBC05;
}

.card-rating .reviews {
    color: var(--text-muted);
}

.add-btn {
    width: 100%;
    background-color: var(--text-main);
    color: var(--white);
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s;
}

.add-btn:hover {
    background-color: #374151;
}

/* --- Bottom Nav --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    height: 70px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: var(--shadow-nav);
    z-index: 1000;
    padding-bottom: 10px;
    /* Safe area for modern phones */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    position: relative;
    width: 60px;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5px;
}

.nav-item.active {
    color: var(--primary-blue);
}

.nav-cart-badge {
    position: absolute;
    top: -5px;
    right: 12px;
    background-color: #EE4D2D;
    color: white;
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* --- Floating Whatsapp --- */
.fab-whatsapp {
    position: fixed;
    bottom: 85px;
    /* Above nav bar */
    right: 20px;
    width: 55px;
    height: 55px;
    background-color: var(--success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.4);
    z-index: 900;
    animation: pulse 3s infinite;
}

.fab-whatsapp svg {
    width: 32px;
    height: 32px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

@media (min-width: 768px) {

    /* Tablet/Desktop Tweaks just in case */
    .app-header,
    .bottom-nav {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-xl);
        bottom: 20px;
        /* Float nav on desktop */
    }

    .app-header {
        top: 20px;
        bottom: auto;
    }

    body {
        max-width: 500px;
        margin: 0 auto;
        border-left: 1px solid #eee;
        border-right: 1px solid #eee;
        min-height: 100vh;
        background-color: #fff;
    }

    .fab-whatsapp {
        right: calc(50% - 230px);
    }
}