:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-main: #f8fafc;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.9);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: rgba(255, 255, 255, 0.3);
    --danger: #ef4444;
    --success: #10b981;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --glass-blur: 12px;
}

body.dark-theme {
    --bg-main: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.6);
    --bg-surface-hover: rgba(30, 41, 59, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Mesh Gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
}

/* --- Login Screen --- */
.login-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-main);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--primary) 0%, transparent 40%),
                radial-gradient(circle at 80% 20%, var(--secondary) 0%, transparent 30%);
    opacity: 0.1;
    filter: blur(80px);
    animation: rotate 20s linear infinite;
    z-index: 0;
}

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

.login-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 1;
    text-align: center;
}


.profiles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    z-index: 1;
}

.profile-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2.5rem 1.5rem;
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.profile-item:hover {
    transform: translateY(-10px) scale(1.05);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.profile-initial {
    width: 90px;
    height: 90px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

.profile-initial::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.2), transparent);
}

.profile-name {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* --- PIN Overlay --- */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.pin-name { font-size: 1.5rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.pin-instruction { color: var(--text-secondary); margin-bottom: 2rem; }

.pin-dots {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    transition: all 0.2s;
}

.pin-dot.filled {
    background: var(--primary);
    transform: scale(1.2);
}

.pin-keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 300px;
}

.pin-key {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-primary);
}

.pin-key:active {
    transform: scale(0.9);
    background: var(--primary);
    color: white;
}

/* --- App UI --- */
.app-ui {
    padding-top: 80px;
    padding-bottom: 100px;
    min-height: 100vh;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 90;
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
}

.header-title {
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.active-user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.active-user-profile .profile-initial {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
    border-radius: 10px;
}

.icon-button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background 0.2s;
    position: relative;
}

.icon-button:active {
    background: rgba(0,0,0,0.05);
}

.icon-button i {
    font-size: 1.8rem; /* Tamaño más grande para la campana y el refresco */
}

.icon-button .badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* --- Maintenance Overlay --- */
.maintenance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: white;
    transition: opacity 0.5s;
}

.maintenance-overlay i {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
    animation: pulse 2s infinite;
}

.maintenance-overlay.hidden {
    display: none;
    pointer-events: none;
}


.maintenance-overlay p {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 300px;
}

/* Admin Section in Settings */
.admin-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
}

.admin-section h3 {
    color: var(--danger);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 460px;
    height: 70px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 1rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s;
    min-width: 50px;
}

.nav-item i { font-size: 1.4rem; transition: transform 0.3s; }

.nav-item.active {
    color: white;
}

.nav-item.active i {
    transform: translateY(-5px);
    color: var(--primary);
}

/* --- Components --- */
.view-content {
    padding: 1.5rem;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.welcome-header {
    margin-bottom: 2rem;
}

.welcome-title { font-size: 2rem; font-weight: 700; }
.welcome-subtitle { color: var(--text-secondary); }

.summary-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.summary-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.summary-value { font-size: 1.5rem; font-weight: 700; }
.summary-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; }

.section-subtitle {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.dashboard-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.dashboard-action:active { transform: scale(0.95); }
.dashboard-action i { font-size: 2rem; color: var(--primary); }
.dashboard-action span { font-weight: 600; font-size: 0.9rem; }

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

.form-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus { border-color: var(--primary); }

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 0.8rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-tab {
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.btn-tab.active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* --- Items --- */
.shopping-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.shopping-item:last-child { border-bottom: none; }
.shopping-item.completed { opacity: 0.5; }
.shopping-item.completed .item-text { text-decoration: line-through; }

.item-info { flex: 1; cursor: pointer; }
.item-text { font-weight: 500; }
.item-meta { font-size: 0.75rem; color: var(--text-secondary); }

.note-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1rem;
    position: relative;
    margin-bottom: 1rem;
}

.note-author { font-size: 0.8rem; font-weight: 700; margin-bottom: 0.25rem; }
.delete-note { position: absolute; top: 0.5rem; right: 0.5rem; background: none; border: none; color: var(--danger); cursor: pointer; }

/* Utilities */
.hidden { display: none !important; }
.text-danger { color: var(--danger) !important; }

/* Pro Settings Styles */
.settings-card { background: var(--bg-surface); border-radius: 20px; padding: 1.2rem; margin-bottom: 1.5rem; }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); }
.settings-row:last-child { border-bottom: none; }
.settings-subtitle { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; margin-bottom: 1rem; }

.toggle-switch {
    appearance: none;
    width: 44px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: 0.3s;
}
.toggle-switch:checked { background: var(--primary); }
.toggle-switch::after { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: white; top: 2px; left: 2px; transition: 0.3s; }
.toggle-switch:checked::after { left: 22px; }

/* Action Sheets (Menu & Notif) */
.action-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
}

.action-sheet {
    width: 100%;
    background: var(--bg-main);
    border-radius: 30px 30px 0 0;
    padding: 2rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-sheet-overlay.active .action-sheet { transform: translateY(0); }

.sheet-btn {
    width: 100%;
    padding: 1.2rem;
    border: none;
    background: var(--bg-surface);
    border-radius: 18px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
}

.sheet-btn i { font-size: 1.5rem; }
