@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/* GLOBAL SETTINGS */
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    font-family: 'Roboto', sans-serif;
    background-color: #fff1e9;
    color: #333;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0;
}
:root { --primary: #f05849; --primary-dark: #d64536; }

/* HEADER */
.glass-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding: 10px 0;
    flex-shrink: 0;
    z-index: 50;
    height: 70px;
}
.header-inner {
    width: 100%; max-width: 600px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center; padding: 0 20px;
}
.logo-img { height: 50px; width: auto; }

/* CART */
.cart-wrapper { position: relative; cursor: pointer; padding: 5px; }
.cart-badge {
    position: absolute; top: -2px; right: -2px;
    background: var(--primary); color: white;
    font-size: 10px; font-weight: bold;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white; opacity: 0; transition: opacity 0.2s;
}
.cart-badge.visible { opacity: 1; }

.cart-dropdown {
    position: absolute; top: 55px; right: 10px;
    background: white; width: 300px;
    border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 20px; display: none; z-index: 100;
    border: 1px solid #eee; animation: fadeIn 0.2s;
}
.cart-dropdown.show { display: block; }
.cart-items { max-height: 250px; overflow-y: auto; }
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f5f5f5; font-size: 0.85rem; }
.cart-total { margin-top: 15px; padding-top: 10px; border-top: 2px solid #eee; display: flex; justify-content: space-between; font-weight: bold; }

/* MAIN LAYOUT */
.content-wrapper {
    flex-grow: 1; display: flex; flex-direction: column;
    align-items: center; padding: 15px; /* Added global padding */
    overflow-y: auto;
}
.main-card {
    background: white; border-radius: 20px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    padding: 20px 25px; width: 100%; max-width: 500px;
    margin: 5px 0; display: flex; flex-direction: column; gap: 15px;
    flex-shrink: 0;
}

/* STEPPER */
.stepper-container { width: 100%; max-width: 450px; margin: 0 auto 10px auto; padding: 0 10px; }
.stepper-track { position: relative; height: 3px; background: #e5e7eb; margin-top: 10px; margin-bottom: 25px; border-radius: 10px; }
.stepper-fill { position: absolute; height: 100%; background: var(--primary); top: 0; left: 0; border-radius: 10px; }
.stepper-steps { display: flex; justify-content: space-between; position: relative; top: -14px; }
.step-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.step-circle {
    width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px; background: white; border: 2px solid #e5e7eb; color: #9ca3af; z-index: 10; transition: all 0.2s;
}
.step-circle.active { background-color: var(--primary); border-color: var(--primary); color: white; transform: scale(1.1); }
.step-label { font-size: 9px; font-weight: 700; color: #9ca3af; margin-top: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.step-label.active { color: #333; }

/* GRIDS */
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border-radius: 12px; overflow: hidden; height: 160px; width: 100%; flex-shrink: 0; }
.hero-grid img { width: 100%; height: 100%; object-fit: cover; }

.fund-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
    max-height: 25vh; overflow-y: auto; padding-right: 4px;
}
@media (min-width: 640px) { .fund-grid { grid-template-columns: repeat(3, 1fr); } }
.fund-grid::-webkit-scrollbar { width: 4px; }
.fund-grid::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 10px; }

/* ORPHAN LIST */
.product-list { display: flex; flex-direction: column; gap: 8px; max-height: 35vh; overflow-y: auto; }
.product-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background: #fff; border: 1px solid #eee; border-radius: 12px;
}
.product-info h4 { font-size: 0.8rem; font-weight: 700; color: #333; margin: 0; }
.product-info p { font-size: 0.7rem; color: #666; margin: 2px 0 0 0; }
.qty-input { width: 50px; padding: 8px; text-align: center; border: 1px solid #ddd; border-radius: 8px; font-weight: bold; outline: none; }

/* BUTTONS */
.btn-primary, .btn-outline, .fund-btn, .amt-btn, input { border-radius: 12px !important; }
.fund-btn {
    background: white; border: 1px solid #e5e7eb; color: #4b5563; font-weight: 500;
    padding: 10px; text-align: center; cursor: pointer; font-size: 0.75rem;
    min-height: 45px; display: flex; align-items: center; justify-content: center;
    line-height: 1.2; transition: all 0.2s;
}
.fund-btn:hover { border-color: var(--primary); color: var(--primary); background: #fff5f5; }
input:checked + .fund-btn { background-color: var(--primary); border-color: var(--primary); color: white; font-weight: 700; box-shadow: 0 4px 10px rgba(240, 88, 73, 0.2); }

.amt-btn { font-size: 0.9rem; padding: 12px 0; font-weight: 700; height: 100%; display: flex; align-items: center; justify-content: center;}

/* GREEN IMPACT BOX */
.impact-box {
    background: #f0fdf4; border-left: 4px solid #16a34a;
    padding: 12px; font-size: 0.8rem; color: #166534;
    border-radius: 6px; display: none; margin-top: 15px; line-height: 1.4;
}

/* FOOTER */
.main-footer { padding: 15px; text-align: center; color: #9ca3af; font-size: 0.7rem; flex-shrink: 0; }
.footer-link { color: var(--primary); font-weight: 600; text-decoration: none; }

/* TOAST */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: #333; color: white; padding: 10px 25px; border-radius: 30px;
    font-size: 0.8rem; font-weight: bold; opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 200;
}
.toast.show { opacity: 1; bottom: 50px; }

/* MOBILE OPTIMIZATIONS */
@media (max-width: 480px) {
    .glass-header { height: 60px; padding: 5px 0; }
    .logo-img { height: 40px; }
    
    /* Ensure card doesn't touch edges */
    .main-card { padding: 15px; margin: 0 10px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); width: auto; }
    
    .content-wrapper { padding: 10px 5px; } /* Prevent horizontal scroll */
    .stepper-container { margin-top: 5px; padding: 0 5px; }
    
    .fund-btn, .amt-btn { min-height: 50px; font-size: 0.85rem; }
    .hero-grid { height: 120px; border-radius: 10px; }
    .fund-grid { grid-template-columns: repeat(2, 1fr); max-height: 35vh; }
}