:root {
    /* Colors from Landing Page */
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary: #3b82f6;
    --secondary-light: #dbeafe;
    --accent: #f59e0b;
    --dark: #0f172a;
    --dark-2: #1e293b;
    --dark-3: #334155;
    --light: #f8fafc;
    --light-2: #f1f5f9;
    --gray: #64748b;
    --white: #ffffff;
    
    /* Functional Colors */
    --danger: #ef4444;
    --success: #10b981;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Glassmorphism */
    --glass: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--light-2);
    color: var(--dark);
    min-height: 100vh;
    padding-bottom: 100px; /* Space for bottom nav on mobile */
}

/* Header */
.app-header {
    background: var(--white);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.app-title-header {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.btn-share-header {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-share-header:hover {
    background: var(--primary);
    color: white;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray);
}

.list-selector-container {
    flex: 1;
    min-width: 0;
}

#list-selector {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: var(--light);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

#list-selector:focus {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-settings-header {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.2s ease;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 700;
}

.logo-img-small {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* View Options & Toggle */
.view-options {
    flex-shrink: 0;
}

.grouping-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light-2);
    padding: 6px 14px;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grouping-toggle:hover {
    background: var(--primary-light);
}

.view-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--dark-2);
    white-space: nowrap;
}

.switch-small {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.switch-small input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-small {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray);
    transition: .3s;
    border-radius: 20px;
}

.slider-small:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider-small {
    background-color: var(--primary);
}

input:checked + .slider-small:before {
    transform: translateX(16px);
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    /* padding-bottom: 80px; Removed for no-bottom-nav layout */
}

/* Add Item Card */
.add-item-card {
    background: var(--white);
    padding: 16px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.main-row {
    align-items: center;
}

.details-row {
    flex-wrap: wrap;
}

#item-name {
    flex: 1;
    min-width: 0;
    border: 2px solid var(--light-2);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--light);
}

.input-group-qty {
    display: flex;
    gap: 4px;
}

.input-qty {
    width: 60px;
    padding: 0 8px;
    border: 2px solid var(--light-2);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--light);
    text-align: center;
}

.select-unit {
    width: 60px;
    padding: 0 4px;
    border: 2px solid var(--light-2);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--light);
    cursor: pointer;
}

#item-category {
    padding: 0 12px;
    border: 2px solid var(--light-2);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--light);
    cursor: pointer;
    flex: 1;
    min-width: 120px;
}

.input-tag {
    flex: 1.5;
    min-width: 140px;
    border: 2px solid var(--light-2);
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--light);
}

.item-qty {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 6px;
    white-space: nowrap;
}

.btn-add {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    flex-shrink: 0;
}

.btn-add:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Filters & View Options */
.filters-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    background: var(--white);
    padding: 12px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.filters {
    display: flex;
    gap: 8px;
    padding: 0;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
}

.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.filter-btn span {
    background: var(--light-2);
    color: var(--gray);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

.filter-btn.active span {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Items List */
.items-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Category Grouping */
.category-group {
    margin-bottom: 20px;
}

.category-header {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 12px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.item-card {
    background: var(--white);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.item-card:hover {
    box-shadow: var(--shadow-md);
}

.item-card.purchased {
    background: rgba(255, 255, 255, 0.6);
}

.item-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    cursor: pointer;
    appearance: none;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.item-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.item-checkbox:checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

.item-content {
    flex: 1;
}

.item-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--dark);
    transition: all 0.2s ease;
}

.item-category {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-pill {
    background: var(--secondary-light);
    color: var(--secondary);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}

.item-card.purchased .item-name {
    text-decoration: line-through;
    color: var(--gray);
}

.btn-delete {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--light);
    color: var(--gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.empty-state.show {
    display: block;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

/* Plan Warning Card */
.plan-info {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
    border-radius: 20px;
    padding: 24px;
    color: white;
    margin-top: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.2);
    text-align: center;
}

.plan-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 12px;
}

.plan-info p {
    font-size: 0.875rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.btn-upgrade {
    background: white;
    color: var(--primary);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Bottom Navigation/* Bottom Nav Removed */
/* .bottom-nav was here */

/* Pricing Plans */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.plan-card {
    border: 2px solid var(--light-2);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.plan-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.plan-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.plan-card.selected::before {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plan-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 8px;
}

.plan-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.plan-price span {
    font-size: 0.875rem;
    color: var(--gray);
    font-weight: 400;
}

.plan-features {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 12px;
    line-height: 1.4;
}

.btn-upgrade-full {
    background: var(--dark);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    width: 100%;
    margin-top: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-upgrade-full:hover {
    background: var(--dark-2);
    transform: scale(1.02);
}

/* Toggle Switch */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.setting-info {
    flex: 1;
    margin-right: 16px;
}

.setting-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
}

.setting-desc {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 2px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--light-2);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Responsive */
@media (max-width: 600px) {
    .filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .filters {
        justify-content: center;
    }

    .grouping-toggle {
        justify-content: center;
        width: 100%;
    }

    #item-category {
        display: block; /* Show category in two-row layout */
        flex: 1;
    }

    .input-tag {
        flex: 100%; /* Take full width on mobile if needed or stay row */
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* Item Main Container */
.item-main {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 12px;
    cursor: pointer;
    min-width: 0; /* Prevent flex overflow */
}

/* PWA Install Button (Floating) */
.pwa-install-btn {
    position: fixed;
    bottom: 80px; /* Above nav bar */
    right: 20px;
    background: var(--dark);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* iOS Modal Specifics */
.pwa-modal {
    max-width: 90%;
    margin: 0 auto;
}

.pwa-modal ol {
    margin-left: 20px;
    margin-top: 10px;
    line-height: 1.6;
}

.pwa-modal li {
    margin-bottom: 10px;
}
