/* ==================== CSS Variables ==================== */
:root {
    --neumorph-bg: #e0e5ec;
    --neumorph-light: #ffffff;
    --neumorph-dark: #a3b1c6;
    --neumorph-text: #4a5568;
    --neumorph-text-dark: #2d3748;
    --neumorph-primary: #6366f1;
    --neumorph-primary-light: #818cf8;
    --neumorph-success: #10b981;
    --neumorph-danger: #ef4444;
    --neumorph-warning: #f59e0b;
    
    /* Theme state (set by JS) */
    --theme-mode: light;
}

/* ==================== Dark Mode Variables ==================== */
[data-theme="dark"] {
    --neumorph-bg: #1a1d24;
    --neumorph-light: #252932;
    --neumorph-dark: #12141a;
    --neumorph-text: #a0aec0;
    --neumorph-text-dark: #e2e8f0;
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--neumorph-bg);
    color: var(--neumorph-text-dark);
    min-height: 100vh;
    line-height: 1.6;
}


.item-actions {
    display: none !important;
}

/* 2. Show item actions only when Edit Mode is active */
.edit-mode .item-actions {
    display: flex !important;
    animation: fadeIn 0.2s ease-in;
}

/* 3. Optional: Visual feedback for the toggle button when active */
#edit-mode-btn.active {
    background: var(--neumorph-primary);
    color: white;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.2);
}

/* 4. Ensure item cards look good when buttons appear */
.item-card {
    transition: all 0.3s ease;
}


/* ==================== Neumorphism Utilities ==================== */
.neu-flat {
    background: var(--neumorph-bg);
    box-shadow: 
        6px 6px 12px var(--neumorph-dark),
        -6px -6px 12px var(--neumorph-light);
    border-radius: 20px;
}

.neu-pressed {
    background: var(--neumorph-bg);
    box-shadow: 
        inset 4px 4px 8px var(--neumorph-dark),
        inset -4px -4px 8px var(--neumorph-light);
    border-radius: 12px;
}

.neu-convex {
    background: linear-gradient(145deg, var(--neumorph-light), var(--neumorph-bg));
    box-shadow: 
        6px 6px 12px var(--neumorph-dark),
        -6px -6px 12px var(--neumorph-light);
    border-radius: 14px;
}

/* ==================== Dark Mode Toggle & Settings ==================== */
.theme-toggle {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--neumorph-bg);
    box-shadow: 
        3px 3px 6px var(--neumorph-dark),
        -3px -3px 6px var(--neumorph-light);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--neumorph-text);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 
        4px 4px 8px var(--neumorph-dark),
        -4px -4px 8px var(--neumorph-light);
}

.theme-toggle:active,
.theme-toggle.active {
    transform: translateY(0);
    box-shadow: 
        inset 2px 2px 4px var(--neumorph-dark),
        inset -2px -2px 4px var(--neumorph-light);
}

/* Settings Modal */
.settings-modal .modal {
    max-width: 520px;
}

.settings-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--neumorph-dark);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--neumorph-text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-label {
    font-size: 0.9rem;
    color: var(--neumorph-text);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 56px;
    height: 30px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--neumorph-bg);
    box-shadow: 
        inset 3px 3px 6px var(--neumorph-dark),
        inset -3px -3px 6px var(--neumorph-light);
    border-radius: 30px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, var(--neumorph-primary), var(--neumorph-primary-light));
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 4px rgba(99, 102, 241, 0.3);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(26px);
}

/* Color Picker Grid */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 10px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 
        3px 3px 6px var(--neumorph-dark),
        -3px -3px 6px var(--neumorph-light);
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: var(--neumorph-text-dark);
    box-shadow: 
        0 0 0 2px var(--neumorph-bg),
        0 0 0 4px currentColor;
}

.custom-color-input {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--neumorph-bg);
    box-shadow: 
        inset 3px 3px 6px var(--neumorph-dark),
        inset -3px -3px 6px var(--neumorph-light);
}

.neu-icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--neumorph-bg);
    box-shadow: 
        3px 3px 6px var(--neumorph-dark),
        -3px -3px 6px var(--neumorph-light);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--neumorph-text);
    text-decoration: none;
}

.neu-icon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        4px 4px 8px var(--neumorph-dark),
        -4px -4px 8px var(--neumorph-light);
}

.neu-icon-btn:active,
.neu-icon-btn.active {
    transform: translateY(0);
    box-shadow: 
        inset 2px 2px 4px var(--neumorph-dark),
        inset -2px -2px 4px var(--neumorph-light);
}

.neu-input {
    width: 100%;
    padding: 14px 20px;
    background: var(--neumorph-bg);
    box-shadow: 
        inset 3px 3px 6px var(--neumorph-dark),
        inset -3px -3px 6px var(--neumorph-light);
    border-radius: 12px;
    border: none;
    outline: none;
    color: var(--neumorph-text-dark);
    font-size: 15px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.neu-input::placeholder {
    color: var(--neumorph-dark);
}

.neu-input:focus {
    box-shadow: 
        inset 4px 4px 8px var(--neumorph-dark),
        inset -4px -4px 8px var(--neumorph-light);
}

textarea.neu-input {
    resize: vertical;
    min-height: 80px;
}

select.neu-input {
    cursor: pointer;
    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='%234a5568' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.neu-btn {
    padding: 12px 28px;
    background: var(--neumorph-bg);
    box-shadow: 
        4px 4px 8px var(--neumorph-dark),
        -4px -4px 8px var(--neumorph-light);
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    color: var(--neumorph-primary);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    text-decoration: none;
}

.neu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        6px 6px 12px var(--neumorph-dark),
        -6px -6px 12px var(--neumorph-light);
}

.neu-btn:active {
    transform: translateY(0);
    box-shadow: 
        inset 2px 2px 4px var(--neumorph-dark),
        inset -2px -2px 4px var(--neumorph-light);
}

.neu-btn-primary {
    color: white;
    background: linear-gradient(145deg, var(--neumorph-primary), var(--neumorph-primary-light));
}

.neu-btn-success {
    color: white;
    background: linear-gradient(145deg, #10b981, #34d399);
}

.neu-btn-danger {
    color: white;
    background: linear-gradient(145deg, #ef4444, #f87171);
}

.w-full { width: 100%; }
.flex-1 { flex: 1; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }

/* ==================== Layout ==================== */
#app {
    min-height: 100vh;
    padding: 1rem;
}

.view {
    max-width: 1200px;
    margin: 0 auto;
}

.hidden { display: none !important; }

/* ==================== Loading Screen ==================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-container {
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--neumorph-dark);
    border-top-color: var(--neumorph-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== Auth View ==================== */
.auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 2rem);
    padding: 1rem;
}

.auth-card {
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neumorph-primary);
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--neumorph-text-dark);
    margin-bottom: 0.25rem;
}

.auth-header p {
    color: var(--neumorph-dark);
    font-size: 0.9rem;
}

.auth-toggle {
    display: flex;
    padding: 4px;
    margin-bottom: 1.5rem;
    border-radius: 14px;
}

.toggle-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--neumorph-text);
    transition: all 0.2s ease;
    font-family: inherit;
}

.toggle-btn.active {
    background: linear-gradient(145deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    box-shadow: 2px 2px 4px rgba(99, 102, 241, 0.3);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--neumorph-text);
    margin-bottom: 0.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.error-message, .success-message, .modal-error {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.error-message, .modal-error {
    background-color: #fef2f2;
    color: #dc2626;
    box-shadow: inset 2px 2px 4px rgba(220, 38, 38, 0.1);
}

.success-message {
    background-color: #ecfdf5;
    color: #059669;
    box-shadow: inset 2px 2px 4px rgba(5, 150, 105, 0.1);
}

/* ==================== Dashboard View ==================== */
.dashboard-view {
    animation: fadeIn 0.3s ease;
}

.header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left, .list-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right, .list-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-logo, .header-logo {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neumorph-primary);
}

.header-info, .list-header-info {
    display: flex;
    flex-direction: column;
}

.header-info h1, .list-header-info h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--neumorph-text-dark);
}

.header-info p {
    font-size: 0.875rem;
    color: var(--neumorph-dark);
}

.mobile-new-list {
    margin-bottom: 1.5rem;
}

.visible-sm {
    display: none;
}

@media (max-width: 768px) {
    .hidden-sm {
        display: none !important;
    }
    
    .visible-sm {
        display: inline-flex !important;
    }
}

/* Lists Grid */
.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding-bottom: 2rem;
}

.list-card {
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
    border: none;
    overflow: hidden;
}

/* List Card with Colored Background Tint */
.list-card.has-color-bg {
    position: relative;
    background: var(--neumorph-bg);
}

.list-card.has-color-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: var(--list-card-color, var(--neumorph-primary));
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

.list-card.has-color-bg > * {
    position: relative;
    z-index: 1;
}

.list-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        10px 10px 20px var(--neumorph-dark),
        -10px -10px 20px var(--neumorph-light);
}

.list-card:hover.has-color-bg::before {
    opacity: 0.2;
}

.list-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.list-card-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.permission-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.permission-badge.view {
    background-color: #f3f4f6;
    color: #6b7280;
}

.permission-badge.edit {
    background-color: #eef2ff;
    color: var(--neumorph-primary);
}

.list-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--neumorph-text-dark);
    margin-bottom: 0.5rem;
}

.list-card-desc {
    font-size: 0.875rem;
    color: var(--neumorph-dark);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--neumorph-dark);
}

.list-progress {
    margin-top: 1rem;
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--neumorph-bg);
    box-shadow: inset 2px 2px 4px var(--neumorph-dark), inset -2px -2px 4px var(--neumorph-light);
}

.list-progress-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.delete-list-btn {
    margin-top: 1rem;
    color: var(--neumorph-danger) !important;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neumorph-dark);
}

.empty-state h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--neumorph-text-dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--neumorph-dark);
    margin-bottom: 1.5rem;
}

/* ==================== List Detail View ==================== */
.list-view {
    animation: fadeIn 0.3s ease;
}

.list-header {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.list-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}

.list-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--neumorph-dark);
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.online-dot {
    width: 10px;
    height: 10px;
    background: var(--neumorph-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neumorph-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--neumorph-danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-toggle-btn {
    position: relative;
}

.list-content-wrapper {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.list-main {
    flex: 1;
    padding: 1.5rem;
    min-height: 400px;
}

.list-description {
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--neumorph-dark);
    color: var(--neumorph-text);
    opacity: 0.8;
}

.add-item-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-card {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    animation: slideIn 0.2s ease forwards;
}

.item-card.completed {
    opacity: 0.65;
}

.item-checkbox {
    width: 26px;
    height: 26px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--neumorph-bg);
    box-shadow: 
        3px 3px 6px var(--neumorph-dark),
        -3px -3px 6px var(--neumorph-light);
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.item-checkbox:checked {
    background: linear-gradient(145deg, var(--neumorph-success), #34d399);
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2), -1px -1px 3px var(--neumorph-light);
}

.item-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.item-checkbox.disabled {
    cursor: default;
}

.item-content {
    flex: 1;
    font-size: 1rem;
    word-break: break-word;
}

.item-content.completed {
    text-decoration: line-through;
    color: var(--neumorph-dark);
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.item-card:hover .item-actions {
    opacity: 1;
}

.item-edit-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.item-edit-input {
    flex: 1;
}

.no-items {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--neumorph-dark);
}

.no-items svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Shared With Section */
.shared-with-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--neumorph-dark);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--neumorph-text-dark);
}

.shared-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.shared-user-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
}

.shared-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.shared-user-perm {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.shared-user-perm.view {
    background: #f3f4f6;
    color: #6b7280;
}

.shared-user-perm.edit {
    background: #eef2ff;
    color: var(--neumorph-primary);
}

.remove-share-btn {
    color: var(--neumorph-danger);
    padding: 2px;
    margin-left: 0.25rem;
}

/* ==================== Note Preview for Cards ==================== */
.note-preview {
    font-size: 0.8rem;
    color: var(--neumorph-text);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== Grocery Items ==================== */
.grocery-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.grocery-item-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 0.5rem;
}

.grocery-checkbox {
    border-radius: 8px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--neumorph-bg);
    padding: 2px;
    border-radius: 8px;
    box-shadow: 
        inset 2px 2px 4px var(--neumorph-dark),
        inset -2px -2px 4px var(--neumorph-light);
}

.qty-btn {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--neumorph-bg);
    box-shadow: 
        2px 2px 4px var(--neumorph-dark),
        -2px -2px 4px var(--neumorph-light);
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--neumorph-primary);
    font-size: 14px;
    font-weight: 600;
}

.qty-btn:hover {
    transform: scale(1.05);
}

.qty-btn:active {
    transform: scale(0.95);
    box-shadow: inset 2px 2px 4px var(--neumorph-dark);
}

.qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--neumorph-text-dark);
}

.qty-display {
    font-size: 0.85rem;
    color: var(--neumorph-primary);
    font-weight: 500;
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ==================== Notes Editor ==================== */
.notes-editor {
    margin-top: 1.5rem;
}

.notes-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.notes-editor-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--neumorph-text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notes-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--neumorph-dark);
}

.notes-toolbar-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--neumorph-bg);
    box-shadow: 
        2px 2px 4px var(--neumorph-dark),
        -2px -2px 4px var(--neumorph-light);
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--neumorph-text);
    font-weight: 700;
    font-size: 14px;
}

.notes-toolbar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 
        3px 3px 6px var(--neumorph-dark),
        -3px -3px 6px var(--neumorph-light);
}

.notes-toolbar-btn.active {
    background: linear-gradient(145deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2);
}

.notes-textarea {
    width: 100%;
    min-height: 300px;
    padding: 1.25rem;
    background: var(--neumorph-bg);
    box-shadow: 
        inset 4px 4px 8px var(--neumorph-dark),
        inset -4px -4px 8px var(--neumorph-light);
    border-radius: 16px;
    border: none;
    outline: none;
    color: var(--neumorph-text-dark);
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s ease;
}

.notes-textarea:focus {
    box-shadow: 
        inset 6px 6px 12px var(--neumorph-dark),
        inset -6px -6px 12px var(--neumorph-light);
}

.notes-textarea::placeholder {
    color: var(--neumorph-dark);
}

/* Notes Preview */
.notes-preview {
    padding: 1.25rem;
    background: var(--neumorph-bg);
    box-shadow: 
        inset 4px 4px 8px var(--neumorph-dark),
        inset -4px -4px 8px var(--neumorph-light);
    border-radius: 16px;
    min-height: 200px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.notes-preview h1, .notes-preview h2, .notes-preview h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.notes-preview h1 { font-size: 1.75rem; }
.notes-preview h2 { font-size: 1.5rem; }
.notes-preview h3 { font-size: 1.25rem; }

.notes-preview strong {
    font-weight: 700;
    color: var(--neumorph-text-dark);
}

.notes-preview em {
    font-style: italic;
}

.notes-preview ul, .notes-preview ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.notes-preview li {
    margin-bottom: 0.25rem;
}

/* List Type Badge */
.list-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
}

.list-type-badge.note {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

/* ==================== Notifications ==================== */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--neumorph-bg);
    box-shadow: 
        8px 8px 16px var(--neumorph-dark),
        -8px -8px 16px var(--neumorph-light);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 9999;
    max-width: 380px;
    animation: slideInRight 0.3s ease forwards;
    border-left: 4px solid var(--neumorph-primary);
}

.notification-toast.hidden {
    display: none !important;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--neumorph-text-dark);
    margin-bottom: 0.15rem;
}

.notification-message {
    font-size: 0.85rem;
    color: var(--neumorph-text);
    opacity: 0.9;
}

.notification-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--neumorph-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: var(--neumorph-dark);
    color: var(--neumorph-text-dark);
}

/* Notification Permission Banner */
.notification-permission-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
    z-index: 10000;
    background: linear-gradient(135deg, var(--neumorph-success), #34d399);
    padding: 1rem 1.25rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    animation: slideInUp 0.3s ease forwards;
}

.notification-permission-banner.hidden {
    display: none !important;
}

.notification-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification-banner-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.notification-banner-text {
    flex: 1;
}

.notification-banner-text strong {
    color: white;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.2rem;
}

.notification-banner-text span {
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
}

.notification-banner-actions {
    display: flex;
    gap: 0.5rem;
}

.notification-banner-actions .neu-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ==================== Chat Panel ==================== */
.chat-panel {
    width: 380px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 180px);
    animation: slideInRight 0.3s ease;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--neumorph-dark);
}

.chat-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.chat-close-btn {
    display: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
}

.no-messages {
    text-align: center;
    color: var(--neumorph-dark);
    font-size: 0.9rem;
    padding: 2rem 1rem;
}

.chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    font-size: 0.9rem;
    animation: fadeIn 0.2s ease;
}

.chat-bubble-sent {
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
    box-shadow: 3px 3px 6px rgba(99, 102, 241, 0.3);
}

.chat-bubble-received {
    background: var(--neumorph-bg);
    color: var(--neumorph-text-dark);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 
        4px 4px 8px var(--neumorph-dark),
        -4px -4px 8px var(--neumorph-light);
}

.chat-bubble-author {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.chat-bubble-time {
    font-size: 0.7rem;
    margin-top: 0.35rem;
    opacity: 0.7;
    text-align: right;
}

.typing-indicator {
    font-size: 0.85rem;
    color: var(--neumorph-dark);
    font-style: italic;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.chat-form {
    display: flex;
    gap: 0.5rem;
}

/* ==================== Modals ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    padding: 1.75rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--neumorph-text-dark);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
}

.modal-actions .neu-btn {
    flex: 1;
}

.color-picker {
    width: 100%;
    height: 52px;
    padding: 4px;
    cursor: pointer;
    border: none;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

/* Permission Buttons */
.permission-buttons {
    display: flex;
    gap: 0.75rem;
}

.perm-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: var(--neumorph-bg);
    box-shadow: 
        3px 3px 6px var(--neumorph-dark),
        -3px -3px 6px var(--neumorph-light);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--neumorph-text);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.perm-btn.active {
    box-shadow: 
        inset 3px 3px 6px var(--neumorph-dark),
        inset -3px -3px 6px var(--neumorph-light);
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(-15px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes slideInRight {
    from { 
        opacity: 0; 
        transform: translateX(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neumorph-bg);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--neumorph-dark);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8a9ab3;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
    .chat-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 380px;
        z-index: 999;
        border-radius: 0;
        max-height: 100vh;
    }

    .chat-close-btn {
        display: flex !important;
    }

    .list-main.hidden-mobile-chat {
        display: none;
    }
}

@media (max-width: 640px) {
    #app {
        padding: 0.75rem;
    }

    .neu-flat {
        border-radius: 16px;
    }

    .auth-card {
        padding: 1.75rem;
    }

    .header, .list-header {
        padding: 1rem;
    }

    .list-main {
        padding: 1rem;
    }

    .lists-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .permission-buttons {
        flex-direction: column;
    }

    .item-actions {
        opacity: 1;
    }
}

/* ==================== PWA Install Banner ==================== */
.install-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-100%);
}

.install-banner.hidden {
    display: none !important;
}

.install-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.install-banner-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.install-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.install-banner-text strong {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.install-banner-text span {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
}

.install-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.install-banner .install-btn {
    background: white !important;
    color: var(--neumorph-primary) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    font-weight: 700 !important;
    padding: 10px 24px !important;
}

.install-banner .install-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.install-banner .dismiss-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: none !important;
    padding: 10px 18px !important;
}

.install-banner .dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

/* iOS Install Banner - Different Style */
#ios-install-banner {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

#ios-install-banner .dismiss-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

#ios-install-banner .dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
}

/* Adjust main content when banner is visible */
body.has-install-banner #app {
    padding-top: calc(1rem + 80px); /* Account for banner height */
}

/* Responsive Install Banner */
@media (max-width: 768px) {
    .install-banner {
        padding: 0.875rem 1rem;
    }
    
    .install-banner-content {
        gap: 0.75rem;
    }
    
    .install-banner-icon {
        width: 40px;
        height: 40px;
    }
    
    .install-banner-text strong {
        font-size: 0.9rem;
    }
    
    .install-banner-text span {
        font-size: 0.8rem;
    }
    
    .install-banner-actions {
        flex-direction: column;
        gap: 0.375rem;
    }
    
    .install-banner .install-btn,
    .install-banner .dismiss-btn {
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    .install-banner-content {
        flex-wrap: wrap;
    }
    
    .install-banner-text {
        flex-basis: calc(100% - 56px);
    }
    
    .install-banner-actions {
        flex-basis: 100%;
        justify-content: stretch;
    }
    
    .install-banner-actions .neu-btn {
        flex: 1;
    }
}

/* ==================== NOTEEY - NEW FEATURES ==================== */

/* Settings Modal Content */
.settings-modal-content {
    max-width: 520px;
}

.settings-modal-content .modal {
    max-height: 90vh;
    overflow-y: auto;
}

.type-description {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--neumorph-bg);
    border-radius: 12px;
    box-shadow: 
        inset 2px 2px 4px var(--neumorph-dark),
        inset -2px -2px 4px var(--neumorph-light);
}

.type-description p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--neumorph-text);
}

/* Notes View (Simple Text Area) */
.notes-view {
    margin-top: 1.5rem;
}

.notes-view .notes-textarea {
    min-height: 400px;
    font-size: 16px;
}

.notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--neumorph-text);
}

.notes-saved-indicator {
    transition: all 0.3s ease;
}

.notes-saved-indicator.saving {
    color: var(--neumorph-warning);
}

.notes-char-count {
    color: var(--neumorph-dark);
}

/* Grocery View */
.grocery-history {
    margin-bottom: 1.25rem;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--neumorph-text-dark);
    margin-bottom: 0.75rem;
}

.grocery-history-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-item-tag {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--neumorph-text);
}

.history-item-tag:hover {
    transform: translateY(-2px);
    color: var(--neumorph-primary);
}

.grocery-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.quantity-controls-inline {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--neumorph-bg);
    padding: 0.25rem;
    border-radius: 8px;
    box-shadow: 
        inset 2px 2px 4px var(--neumorph-dark),
        inset -2px -2px 4px var(--neumorph-light);
}

.qty-btn-small {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--neumorph-bg);
    box-shadow: 
        2px 2px 4px var(--neumorph-dark),
        -2px -2px 4px var(--neumorph-light);
    border-radius: 6px;
    border: none;
    cursor: pointer;
    color: var(--neumorph-primary);
    font-size: 16px;
    font-weight: 700;
    transition: all 0.15s ease;
}

.qty-btn-small:hover {
    transform: scale(1.05);
}

.qty-btn-small:active {
    transform: scale(0.95);
    box-shadow: inset 2px 2px 4px var(--neumorph-dark);
}

.qty-value-small {
    min-width: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--neumorph-text-dark);
}

/* Checklist Item Deadline */
.item-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 0.5rem;
}

.item-deadline {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    white-space: nowrap;
    background: linear-gradient(135deg, var(--neumorph-primary), var(--neumorph-primary-light));
    color: white;
    font-weight: 500;
}

.item-deadline.overdue {
    background: linear-gradient(135deg, var(--neumorph-danger), #f87171);
    animation: pulse-overdue 2s infinite;
}

@keyframes pulse-overdue {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.item-card.overdue {
    border-left: 3px solid var(--neumorph-danger);
}

.deadline-input {
    max-width: 180px;
    font-size: 0.85rem !important;
    color: var(--neumorph-primary) !important;
}

/* Deadline Toggle Button for Tasks */
.deadline-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.deadline-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap;
}

.deadline-toggle-btn svg {
    width: 14px;
    height: 14px;
}

/* Journal/Custom View */
#custom-view {
    margin-top: 1.5rem;
}

.journal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.journal-date-input {
    max-width: 180px;
    font-weight: 500;
}

.journal-entries {
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.no-journal-entries {
    text-align: center;
    color: var(--neumorph-dark);
    padding: 1rem;
    font-style: italic;
}

.journal-entry-preview {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: var(--neumorph-text-dark);
}

.journal-entry-preview:hover {
    transform: translateX(4px);
}

.journal-entry-date {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--neumorph-primary);
}

.journal-entry-preview-text {
    font-size: 0.85rem;
    color: var(--neumorph-text);
    margin-left: 0.5rem;
}

.journal-textarea {
    min-height: 300px;
}

/* List Type Badge Variants */
.list-type-badge.checklist {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.list-type-badge.grocery {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: white;
}

.list-type-badge.note {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
}

.list-type-badge.custom {
    background: linear-gradient(135deg, #ec4899, #f472b6);
    color: white;
}

/* Dark Mode Adjustments for New Features */
[data-theme="dark"] .item-deadline:not(.overdue) {
    opacity: 0.9;
}

[data-theme="dark"] .notes-textarea,
[data-theme="dark"] .journal-textarea {
    background: var(--neumorph-bg);
}

[data-theme="dark"] .history-item-tag {
    background: var(--neumorph-bg);
}
