/* 
 * Daily Basket - Modern Green Design System
 * Primary Color: #2e7d32
 */

:root {
    --primary: #2e7d32;
    --primary-light: #66bb6a;
    --primary-dark: #1b5e20;
    --secondary: #ff7043;
    --accent: #ffd600;
    --bg-light: #f1f8f1;
    --white: #ffffff;
    --text-dark: #1a1a1a;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 25px;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 70px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
}

.container {
    padding: 0 15px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

#splash-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.splash-logo {
    width: 150px;
    height: 150px;
    background: #ffffff;
    padding: 20px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulseLogo 2s infinite ease-in-out;
}

.splash-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.splash-spinner {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.spinner-dot {
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    animation: bounceSpinner 1.4s infinite ease-in-out both;
}

.spinner-dot:nth-child(1) { animation-delay: -0.32s; }
.spinner-dot:nth-child(2) { animation-delay: -0.16s; }

.splash-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-family: 'Nunito', sans-serif;
    margin: 0;
}

@keyframes pulseLogo {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); }
}

@keyframes bounceSpinner {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

body.loading {
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.3);
}

.btn-secondary {
    background-color: var(--secondary);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 15px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--primary);
    padding: 12px 0;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    background: #ffffff;
    border-radius: 10px;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}

.logo img {
    height: 38px;
    width: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: scale(1.05);
}

.search-bar {
    flex: 1;
    margin: 0 15px;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border-radius: var(--radius-xl);
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    font-size: 0.9rem;
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-bar i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-icon {
    position: relative;
    color: var(--white);
    font-size: 1.4rem;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--secondary);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: 700;
    border: 2px solid var(--primary);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: all 0.3s;
}

.nav-item i {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.nav-item.active {
    color: var(--primary);
}

/* Homepage */
.hero-slider {
    margin: 15px 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 180px !important;
    min-height: 180px !important;
}

@media (min-width: 768px) {
    .hero-slider {
        height: 250px !important;
        min-height: 250px !important;
    }
}

.hero-slider .swiper-wrapper,
.hero-slider .swiper-slide {
    height: 100% !important;
    display: block !important;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.category-icon {
    width: 60px;
    height: 60px;
    background: var(--white);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.category-item span {
    font-size: 0.8rem;
    font-weight: 600;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px;
}

.section-title h2 {
    font-size: 1.2rem;
}

.section-title a {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 12px;
    position: relative;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.product-card > a {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--secondary);
    color: var(--white);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 1;
}

.wishlist-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1;
}

.wishlist-btn.active {
    color: #ff4d4f;
}

.product-image {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 10px;
}

.product-info h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.product-price {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.current-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.old-price {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.add-btn {
    margin-top: auto;
    width: 100%;
    padding: 8px;
    border-radius: var(--radius-md);
}

/* Toast Notifications */
#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--text-dark);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    z-index: 2000;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Location Bar and Modal Styling */
.location-bar {
    background: var(--primary-dark);
    color: var(--white);
    padding: 8px 15px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.3s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.location-bar:hover {
    background: #144617;
}

.location-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.location-modal-overlay.show {
    display: flex;
}

.location-modal {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.location-modal h3 {
    margin-bottom: 8px;
    font-size: 1.3rem;
    color: var(--text-dark);
}

.location-modal p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.location-modal .btn-detect {
    background: linear-gradient(135deg, #1b5e20, #2e7d32);
    color: var(--white);
    width: 100%;
    margin-bottom: 15px;
}

.location-modal .divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 15px 0;
}

.location-modal .divider::before,
.location-modal .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.location-modal .divider:not(:empty)::before {
    margin-right: .25em;
}

.location-modal .divider:not(:empty)::after {
    margin-left: .25em;
}

.location-form {
    text-align: left;
}

.location-form .form-group {
    margin-bottom: 12px;
}

.location-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.location-form input {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.location-modal .btn-submit {
    width: 100%;
    margin-top: 15px;
}

.location-modal .modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
}

/* Horizontal scrolling for product lists on mobile view */
@media (max-width: 767px) {
    .product-horizontal-scroll {
        display: flex !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
        padding: 5px 5px 15px 5px;
        margin: 0 -5px;
        gap: 15px;
        -webkit-overflow-scrolling: touch;
    }
    .product-horizontal-scroll::-webkit-scrollbar {
        display: none; /* Hide scrollbar for clean app-like UI */
    }
    .product-horizontal-scroll .product-card {
        flex: 0 0 165px;
        scroll-snap-align: start;
        margin-bottom: 0;
    }
}

