:root {
    /* Premium Color Palette */
    --bg-base: #030014; /* Deep space black */
    --bg-gradient-start: #1e1b4b; /* Indigo darkest */
    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.5);
    --accent: #f43f5e; /* Rose */
    --accent-glow: rgba(244, 63, 94, 0.4);
    --success: #10b981;
    --danger: #ef4444;
    
    /* Advanced Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    /* Geometry */
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 15% 0%, var(--bg-gradient-start) 0%, transparent 40%),
        radial-gradient(circle at 85% 100%, #312e81 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden; /* App-like feel */
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    height: 100dvh;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Header & Tabs */
header {
    padding: 24px 24px 12px 24px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-top h1 { 
    font-size: 1.4rem; 
    font-weight: 600; 
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.user-avatar { 
    width: 40px; height: 40px; 
    border-radius: 50%; 
    background: linear-gradient(135deg, var(--primary), #818cf8); 
    display: flex; align-items: center; justify-content: center; 
    font-weight: 700; color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.top-tabs {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 100px;
    padding: 6px;
    gap: 8px;
    border: 1px solid var(--glass-border);
}

.top-tabs .tab {
    flex: 1; text-align: center;
    padding: 10px 0;
    font-size: 0.95rem; font-weight: 500;
    color: var(--text-muted);
    border-radius: 100px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.top-tabs .tab.active {
    background: var(--glass-highlight);
    color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Scrollable Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 120px 24px; /* Space for add-item floating and bottom nav */
}
.content-area::-webkit-scrollbar { display: none; }

.category-group { margin-bottom: 28px; }
.category-title {
    font-size: 0.9rem; font-weight: 600; color: var(--primary-light);
    margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
    text-transform: uppercase; letter-spacing: 1px;
}

/* Item Cards */
.item-card {
    display: flex; align-items: center;
    padding: 16px; border-radius: var(--radius-lg);
    margin-bottom: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.item-card::before {
    content: ''; position: absolute; top:0; left:0; width:4px; height:0%;
    background: var(--primary); transition: height 0.3s ease;
    border-radius: 4px 0 0 4px;
}
.item-card:hover { border-color: var(--glass-highlight); transform: translateY(-2px); }

.checkbox {
    width: 26px; height: 26px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    margin-right: 16px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s ease;
    flex-shrink: 0;
}
.checkbox i { display: none; font-size: 14px; color: var(--bg-base); font-weight: bold; }

.item-card.checked { opacity: 0.45; animation: checkPop 0.4s ease forwards; border-color: transparent; }
.item-card.checked::before { height: 100%; background: var(--success); }
.item-card.checked .checkbox { background: var(--success); border-color: var(--success); }
.item-card.checked .checkbox i { display: block; }
.item-card.checked .item-name { text-decoration: line-through; }

@keyframes checkPop {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.item-image-thumb {
    width: 44px; height: 44px;
    border-radius: var(--radius-sm); object-fit: cover;
    margin-right: 16px; border: 1px solid var(--glass-border);
}

.item-details { flex: 1; }
.item-name { font-size: 1.05rem; font-weight: 500; margin-bottom: 6px; }
.item-meta { display: flex; justify-content: space-between; align-items: center; }

/* Quantities */
.qty-control {
    display: flex; align-items: center;
    background: rgba(0,0,0,0.4); border-radius: 100px;
    padding: 4px; border: 1px solid var(--glass-border);
}
.qty-btn {
    width: 28px; height: 28px; border-radius: 50%;
    border: none; background: transparent; color: var(--text-muted);
    font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
.qty-btn:hover { background: var(--glass-highlight); color: var(--text-main); }
.qty-btn:active { transform: scale(0.85); background: var(--primary); color: #fff; }
.qty-text { margin: 0 12px; font-size: 0.9rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.item-price { font-size: 0.95rem; color: var(--text-muted); font-weight: 500; }

/* Floating Add Item Widget */
.add-item-container {
    position: absolute; bottom: 110px; left: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px; z-index: 10;
}

.add-input-wrapper {
    display: flex; align-items: center;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 100px; padding: 6px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}
.add-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 16px 40px var(--primary-glow);
}

.add-input-wrapper input {
    flex: 1; background: transparent; border: none;
    padding: 12px 16px; color: var(--text-main);
    font-size: 1.05rem; outline: none;
}
.add-input-wrapper input::placeholder { color: var(--text-dim); }

.action-btn {
    width: 44px; height: 44px; border-radius: 50%;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; transition: all 0.2s; flex-shrink: 0;
}
.voice-btn { background: transparent; color: var(--text-muted); margin-right: 4px; }
.voice-btn.active-mic { color: var(--accent); animation: pulse 1.5s infinite; }
.camera-btn { background: transparent; color: var(--text-muted); position: relative; overflow: hidden; }
.camera-btn input { position: absolute; top:0; left:0; width:100%; height:100%; opacity:0; cursor:pointer;}
.submit-btn { 
    background: linear-gradient(135deg, var(--primary), #818cf8); 
    color: #fff; box-shadow: 0 4px 12px var(--primary-glow);
}
.submit-btn:hover { transform: scale(1.05); }
.submit-btn:active { transform: scale(0.95); }

/* Image Preview */
.image-preview-container {
    display: flex; align-items: center;
    background: var(--glass-bg); padding: 8px 16px; border-radius: 100px;
    align-self: flex-start; border: 1px solid var(--glass-border);
}
.image-preview-container img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; margin-right: 12px;}
.image-preview-container button { background:transparent; border:none; color:var(--danger); font-size:1.2rem; cursor:pointer;}

/* Bottom Nav - Floating Pill */
.bottom-nav {
    position: absolute; bottom: 20px; left: 24px; right: 24px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; justify-content: space-around;
    padding: 12px; border-radius: 100px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}
.nav-item {
    color: var(--text-muted); display: flex; flex-direction: column; align-items: center;
    font-size: 0.75rem; text-decoration: none; cursor: pointer;
    transition: all 0.3s; width: 60px;
}
.nav-item i { font-size: 1.5rem; margin-bottom: 4px; transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.nav-item.active { color: var(--primary-light); }
.nav-item.active i { transform: translateY(-4px) scale(1.1); color: var(--primary); }

/* Overlays (Auth/Onboarding) */
.full-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-base);
    background-image: radial-gradient(circle at 50% -20%, var(--bg-gradient-start) 0%, transparent 60%);
    z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 32px;
}

.auth-header { text-align: center; margin-bottom: 40px; }
.auth-logo { width: 80px; height: 80px; background: linear-gradient(135deg, var(--primary), #818cf8); border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; color: #fff; margin: 0 auto 24px auto; box-shadow: 0 10px 30px var(--primary-glow); transform: rotate(-10deg);}
.auth-header h1 { font-size: 1.8rem; margin-bottom: 8px; }
.auth-header p { color: var(--text-muted); font-size: 1rem; }

.form-group { margin-bottom: 20px; width: 100%; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; text-transform:uppercase; letter-spacing:1px; }
.form-control {
    width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border);
    padding: 14px 16px; border-radius: var(--radius-md); color: var(--text-main);
    font-size: 1.05rem; outline: none; transition: all 0.3s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); }

.btn-primary {
    width: 100%; padding: 16px; border-radius: var(--radius-md);
    border: none; background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff; font-size: 1.05rem; font-weight: 600;
    cursor: pointer; transition: all 0.3s; box-shadow: 0 8px 20px var(--primary-glow);
    margin-top: 10px;
}
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
    width: 100%; padding: 16px; border-radius: var(--radius-md);
    border: 1px solid var(--glass-border); background: transparent;
    color: var(--text-main); font-size: 1.05rem; font-weight: 500;
    cursor: pointer; transition: all 0.3s;
}
.btn-outline:hover { background: var(--glass-bg); }

/* Members & Settings */
.user-greeting { margin-bottom: 32px; }
.user-greeting h2 { font-size:1.8rem; font-weight:700; background:linear-gradient(135deg, #fff 0%, #cbd5e1 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
.user-greeting p { color:var(--text-muted); font-size:0.95rem; margin-top:4px;}

.info-card {
    padding: 24px; border-radius: var(--radius-lg); margin-bottom: 24px;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border); position: relative; overflow: hidden;
}
.info-card::after {
    content:''; position:absolute; top:0; right:0; width:150px; height:150px;
    background:radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity:0.3; transform:translate(30%, -30%);
}
.info-card h3 { font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; display:flex; align-items:center; gap:8px;}
.info-card h3 i { color:var(--primary-light);}

.invite-code-display {
    text-align: center; margin: 16px 0;
}
.invite-code-display h2 { font-size: 2.8rem; letter-spacing: 6px; font-weight: 700; color: #e2e8f0; text-shadow: 0 4px 12px rgba(0,0,0,0.5);}

.member-card {
    display: flex; align-items: center; padding: 16px; border-bottom: 1px solid var(--glass-border);
}
.member-card:last-child { border-bottom: none; }
.member-avatar {
    width: 44px; height: 44px; border-radius: 50%; background: var(--glass-highlight);
    display: flex; align-items: center; justify-content: center; font-weight: bold; margin-right: 16px;
}
.member-info { flex: 1; }
.member-name { font-weight: 600; margin-bottom: 4px; display:flex; align-items:center; gap:8px;}
.member-email { font-size: 0.85rem; color: var(--text-muted); }
.badge { font-size: 0.65rem; padding: 4px 8px; border-radius: 100px; text-transform: uppercase; letter-spacing: 0.5px;}
.badge.admin { background: rgba(244, 63, 94, 0.2); color: var(--accent); border: 1px solid rgba(244, 63, 94, 0.3);}
.badge.member { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3);}

/* Budget Bar */
.budget-bar-bg {
    width: 100%; height: 12px; background: rgba(0,0,0,0.4);
    border-radius: 100px; overflow: hidden; position: relative; margin-top: 16px;
    border: 1px inset rgba(255,255,255,0.05);
}
.budget-bar-fill {
    height: 100%; border-radius: 100px; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; overflow: hidden;
}
.budget-bar-fill::after {
    content:''; position:absolute; top:0; left:0; width:100%; height:100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite linear;
}
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(1.1); } 100% { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
