/* Theme System */
:root {
    /* Default (Light) */
    --bg-image: none;
    --bg-primary: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --accent-blue: #3B82F6;
    --status-success: #10B981;
    --status-danger: #EF4444;

    --card-bg-opacity: rgba(255, 255, 255, 0.95);
    --backdrop-blur: 0px;

    --font-inter: 'Inter', sans-serif;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Cosmic Dusk */
[data-theme="cosmic"] {
    /* New Premium Liquid Purple Background */
    --bg-image: url('https://images.unsplash.com/photo-1614850523459-c2f4c699c52e?q=80&w=2670&auto=format&fit=crop');
    --bg-primary: #0F172A;
    --bg-secondary: rgba(30, 41, 59, 0.7);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --border-color: rgba(148, 163, 184, 0.2);
    --accent-blue: #22D3EE;
    --status-success: #4ADE80;
    --status-danger: #F87171;
    --card-bg-opacity: rgba(15, 23, 42, 0.6);
    --backdrop-blur: 12px;
}

/* Forest Serenity */
[data-theme="forest"] {
    --bg-image: url('https://images.unsplash.com/photo-1511497584788-876760111969?q=80&w=2664&auto=format&fit=crop');
    --bg-primary: #064E3B;
    --bg-secondary: rgba(236, 253, 245, 0.85);
    --text-primary: #022C22;
    --text-secondary: #374151;
    --border-color: rgba(167, 243, 208, 0.4);
    --accent-blue: #0D9488;
    --status-success: #15803D;
    --card-bg-opacity: rgba(255, 255, 255, 0.7);
    --backdrop-blur: 10px;
}

/* Ocean Breeze */
[data-theme="ocean"] {
    --bg-image: url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?q=80&w=2673&auto=format&fit=crop');
    --bg-primary: #ECFEFF;
    --bg-secondary: rgba(255, 255, 255, 0.6);
    --text-primary: #164E63;
    --text-secondary: #475569;
    --border-color: rgba(103, 232, 249, 0.3);
    --accent-blue: #0EA5E9;
    --card-bg-opacity: rgba(255, 255, 255, 0.5);
    --backdrop-blur: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-inter);
    background-color: var(--bg-primary);
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    /* Parallax-like feel */
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.5s ease-in-out, color 0.3s;
    min-height: 100vh;
}

/* Glass Components */
.sidebar,
.task-card,
.modal {
    background-color: var(--card-bg-opacity) !important;
    backdrop-filter: blur(var(--backdrop-blur));
    -webkit-backdrop-filter: blur(var(--backdrop-blur));
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px;
}

/* Header */
.app-header {
    padding: 24px 0 12px 0;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.5px;
}

.menu-btn {
    color: var(--text-primary);
}

/* Sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 90;
    opacity: 1;
    transition: opacity 0.3s;
}

.sidebar-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    /* background defined in glass util above */
    box-shadow: var(--shadow-md);
    z-index: 100;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.sidebar.hidden {
    transform: translateX(-100%);
}

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

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    background: none;
    border: none;
    text-align: left;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--bg-color);
    color: var(--accent-color);
    font-weight: 600;
}

.nav-item .icon {
    font-size: 18px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    position: relative;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 0;
    font-family: var(--font-inter);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px 2px 0 0;
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.task-card {
    background: var(--surface-color);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 4px solid var(--status-danger);
    /* Default to Not Done (Red) */
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.task-checkbox-wrapper {
    padding-top: 2px;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    appearance: none;
    display: grid;
    place-content: center;
    transition: all 0.2s ease;
}

.task-checkbox::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em white;
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    background-color: white;
}

.task-checkbox:checked {
    background-color: var(--status-success);
    border-color: var(--status-success);
}

.task-checkbox:checked::before {
    transform: scale(1);
    background-color: white;
    box-shadow: none;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.task-content {
    flex: 1;
}

.task-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    transition: color 0.2s;
}

.task-deadline {
    font-size: 12px;
    color: var(--text-secondary);
}

.task-card.completed {
    border-left-color: var(--status-success);
    opacity: 0.8;
}

.task-card.completed .task-title {
    text-decoration: line-through;
    color: var(--status-success);
}

.empty-state {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Shopping List */
#view-shopping.hidden {
    display: none;
}

#view-tasks.hidden {
    display: none;
}

.shopping-header {
    margin-bottom: 24px;
}

.shopping-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.quick-add {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.quick-add input {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-inter);
    outline: none;
    transition: border-color 0.2s;
}

.quick-add input:focus {
    border-color: var(--accent-color);
}

.icon-btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 16px;
    cursor: pointer;
    transition: transform 0.1s;
}

.icon-btn-primary:active {
    transform: scale(0.95);
}

.shopping-item.task-card {
    /* Shopping list items don't strictly need the left border indicator if we just want checkbox,
       but user requested similar behavior. Let's keep it consistent or simplify.
       User said: "Each item must have a checkbox... stay in relative position"
       Let's keep the card style but maybe neutral border or same.
    */
    border-left-color: var(--text-secondary);
    /* Neutral for shopping? Or remove border? Let's keep simple. */
    border-left: none;
    /* Let's simplify shopping items */
    align-items: center;
}

.shopping-item.task-card.completed {
    opacity: 0.6;
}

.shopping-item .task-title {
    margin-bottom: 0;
}


/* FAB */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    /* Default */
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

.fab:hover {
    transform: scale(1.1);
}

.fab:active {
    transform: scale(0.95);
}

@media (min-width: 640px) {
    .fab {
        right: calc(50% - 300px + 24px);
        /* Align with content on larger screens */
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: var(--surface-color);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.hidden .modal {
    transform: translateY(20px);
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--text-secondary);
    padding: 0 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-inter);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

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

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* Auth Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: var(--bg-color);
}

.auth-card {
    background: var(--surface-color);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
    font-size: 28px;
}

.auth-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.error-msg {
    color: var(--status-danger);
    font-size: 14px;
    text-align: center;
    margin-top: 16px;
    background-color: rgba(239, 68, 68, 0.1);
    padding: 8px;
    border-radius: 8px;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 10px;
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--font-inter);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.btn-google:hover {
    background-color: #F8FAFC;
    box-shadow: var(--shadow-sm);
}

.hidden {
    display: none !important;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background-color: var(--accent-color);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Members List in Sidebar */
.sidebar-subtitle {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin: 8px 16px;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-primary);
}

.member-avatar {
    width: 24px;
    height: 24px;
    background-color: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
}

/* Task Meta Styles */
.task-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.creator-badge {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    vertical-align: middle;
}

.completed-by-label {
    display: block;
    font-size: 11px;
    color: var(--status-success);
    margin-top: 2px;
    font-style: italic;
}

/* Share Modal Styles */
.share-link-box {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Theme Switcher */
.theme-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 8px 16px;
}

.theme-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    padding: 0;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.theme-btn[data-theme="cosmic"] {
    background: linear-gradient(135deg, #0F172A, #C084FC);
}

.theme-btn[data-theme="forest"] {
    background: linear-gradient(135deg, #064E3B, #4ADE80);
}

.theme-btn[data-theme="ocean"] {
    background: linear-gradient(135deg, #0891B2, #ECFEFF);
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-whatsapp {
    background-color: #25D366;
    color: white;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
}