:root {
    /* User's Oceanic Palette */
    --deep-twilight: #03045E;
    /* Primary Text / Headings */
    --bright-teal: #0077B6;
    /* Secondary Text / Icons */
    --turquoise: #00B4D8;
    /* Accents / Focus */
    --frosted-ice: #90E0EF;
    /* Borders / Subtle BGs */
    --pale-sky: #CAF0F8;
    /* Main Background */
    --pure-white: #FFFFFF;

    /* Modern 2025 Variables */
    --bg-app: var(--pale-sky);
    --glass-surface: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(3, 4, 94, 0.1);

    --card-surface: #FFFFFF;
    --card-shadow: 0 10px 20px -5px rgba(3, 4, 94, 0.08);
    --card-hover: 0 15px 30px -5px rgba(0, 119, 182, 0.15);

    --radius-soft: 20px;
    --radius-pill: 50px;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-app);
    color: var(--deep-twilight);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    /* Soft Background Gradient Mesh - optional, keeping it simple for now to strict colors */
    background-image: linear-gradient(135deg, #CAF0F8 0%, #E3F8FC 100%);
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 20px 100px 20px;
    /* Extra bottom padding for floating nav */
    position: relative;
    min-height: 100vh;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--bg-app);
    /* Or glass surface */
    padding-top: 10px;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Glass effect for sticky header if preferred */
.sticky-glass {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(202, 240, 248, 0.9);
    /* Matches bg-app lightly transparent */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin: -20px -20px 20px -20px;
    /* Negative margins to span full width */
    padding: 20px 20px 20px 20px;
    /* Restore padding */
    box-shadow: 0 4px 12px rgba(3, 4, 94, 0.05);
}

/* --- Floating Glass Header --- */
.search-container {
    position: sticky;
    top: 10px;
    z-index: 100;
    margin-bottom: 24px;
    border-radius: var(--radius-soft);

    /* Glassmorphism */
    background: var(--glass-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);

    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-input-wrapper {
    position: relative;
}

.search-input-wrapper i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--bright-teal);
    font-size: 20px;
}

.search-input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    /* Semi-transparent inner input */
    border-radius: var(--radius-pill);
    font-size: 16px;
    color: var(--deep-twilight);
    font-weight: 500;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    background: #FFF;
    box-shadow: 0 0 0 2px var(--turquoise);
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.filter-select {
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-soft);
    color: var(--deep-twilight);
    font-weight: 600;
    font-size: 13px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230077B6%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-select:focus {
    background: #FFF;
    outline: none;
    box-shadow: 0 0 0 2px var(--frosted-ice);
}

/* --- Modern Product Cards --- */
.product-grid {
    display: grid;
    /* Smart responsive columns: min 150px wide, filling space */
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 500px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }
}

.product-card {
    background: var(--card-surface);
    border-radius: 24px;
    /* Super rounded */
    padding: 12px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
}

.product-card:active {
    transform: scale(0.96);
}

.product-image-container {
    width: 100%;
    aspect-ratio: 1/1;
    background: radial-gradient(circle at center, #F0F8FF 0%, #FFFFFF 70%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.product-image-container img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
    /* Product lift */
}

.product-info {
    text-align: left;
}

.product-name {
    font-size: 15px;
    font-weight: 800;
    /* Bold heading */
    color: var(--deep-twilight);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--bright-teal);
    background: var(--pale-sky);
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
}

/* --- Floating Bottom Nav ("Island") --- */
.bottom-nav {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    height: 70px;

    background: rgba(3, 4, 94, 0.95);
    /* Deep Twilight Nav */
    backdrop-filter: blur(16px);
    border-radius: 35px;
    /* Pill shape */
    box-shadow: 0 12px 30px rgba(3, 4, 94, 0.3);

    display: flex;
    justify-content: space-evenly;
    align-items: center;
    z-index: 1000;
    padding-bottom: 0;
    /* Override safe area for floating */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
}

.nav-item i {
    font-size: 24px;
    margin-bottom: 4px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-item.active {
    color: #FFF;
}

.nav-item.active i {
    transform: translateY(-4px);
    color: var(--turquoise);
}

/* Little dot indicator for active state */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 4px;
    height: 4px;
    background: var(--turquoise);
    border-radius: 50%;
}

/* Empty State */
.no-results {
    text-align: center;
    padding: 20px;
    grid-column: 1 / -1;
    color: #999;
}

/* --- Modal Popup --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 4, 94, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: #FFF;
    width: 95%;
    /* Wider on default */
    max-width: 600px;
    /* Maximize for easier reading */
    max-height: 90vh;
    /* Prevent overflowing screen height */
    overflow-y: auto;
    /* Enable scrolling for long content */
    border-radius: 30px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

/* Full screen on mobile */
@media (max-width: 480px) {
    .modal-content {
        max-width: 100%;
        width: 100%;
        height: auto;
        max-height: 85vh;
        /* Leave room for bottom nav if needed, or 100vh */
        border-radius: 30px 30px 0 0;
        /* Bottom sheet style or fully rounded */
        position: absolute;
        bottom: 0;
        margin: 0;
        animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        /* Align to bottom for sheet effect */
    }
}

@keyframes slideUp {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--pale-sky);
    color: var(--deep-twilight);
    border: none;
    width: 36px;
    /* Larger touch target */
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: var(--bright-teal);
    color: white;
}

.modal-image {
    width: 100%;
    height: 250px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 20px;
    background: radial-gradient(circle at center, #F0F8FF 0%, #FFFFFF 70%);
    flex-shrink: 0;
    /* Don't squash image */
}

.modal-title {
    font-size: 22px;
    /* Larger title */
    font-weight: 800;
    color: var(--deep-twilight);
    margin-bottom: 8px;
    line-height: 1.3;
    word-wrap: break-word;
    /* Handle long words */
}

.modal-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    /* Align top for multi-line values */
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--pale-sky);
}

.modal-detail-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
    flex-shrink: 0;
    /* Label stays fixed width/size */
    margin-right: 15px;
}

.modal-value {
    font-size: 15px;
    /* Slightly larger text */
    font-weight: 700;
    color: var(--deep-twilight);
    text-align: right;
    word-break: break-word;
    /* Wrap long text */
    max-width: 70%;
    /* Limit width to force wrap */
}

.modal-price {
    font-size: 28px;
    /* Prominent price */
    font-weight: 800;
    color: var(--bright-teal);
    margin-top: 5px;
    margin-bottom: 20px;
}