/**
 * Bio Experts PWA - Neumorphic Green Design
 * Modern, gamified UI with soft shadows and nature-inspired palette
 */

/* ==================== CSS Variables ==================== */

:root {
    /* Primary Green Palette */
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --primary-light: #86efac;
    --primary-soft: #dcfce7;
    --primary-ultra-soft: #f0fdf4;
    
    /* Accent Colors */
    --accent: #10b981;
    --accent-warm: #84cc16;
    --accent-teal: #14b8a6;
    
    /* Success/Warning/Danger */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Neutral Colors */
    --dark: #1e293b;
    --dark-soft: #334155;
    --gray: #64748b;
    --gray-light: #cbd5e1;
    --gray-ultra-light: #e2e8f0;
    
    /* Neumorphic Backgrounds */
    --bg-main: #e8f5e9;
    --bg-card: #f0fdf4;
    --bg-white: #ffffff;
    --bg-elevated: #f8fdf9;
    
    /* Neumorphic Shadows */
    --shadow-light: rgba(255, 255, 255, 0.9);
    --shadow-dark: rgba(0, 80, 40, 0.12);
    --shadow-dark-strong: rgba(0, 80, 40, 0.18);
    --shadow-green: rgba(34, 197, 94, 0.25);
    --shadow-green-glow: rgba(34, 197, 94, 0.4);
    
    /* Neumorphic Box Shadows */
    --neu-shadow-sm: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
    --neu-shadow: 6px 6px 16px var(--shadow-dark), -6px -6px 16px var(--shadow-light);
    --neu-shadow-lg: 10px 10px 24px var(--shadow-dark), -10px -10px 24px var(--shadow-light);
    --neu-inset: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
    --neu-inset-sm: inset 2px 2px 6px var(--shadow-dark), inset -2px -2px 6px var(--shadow-light);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    --gradient-success: linear-gradient(135deg, var(--accent-teal) 0%, var(--primary) 100%);
    --gradient-warm: linear-gradient(135deg, var(--accent-warm) 0%, var(--primary) 100%);
    --gradient-soft: linear-gradient(135deg, var(--primary-soft) 0%, var(--bg-card) 100%);
    
    /* Border Radius */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 50%;
    
    /* Spacing */
    --nav-height: 64px;
    --bottom-nav-height: 76px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ==================== Base Reset ==================== */

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

html {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: var(--bottom-nav-height);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

body.loading {
    overflow: hidden;
}

/* ==================== Keyframe Animations ==================== */

/* Ripple Effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.6;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Success Pulse */
@keyframes success-pulse {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1.1); }
    75% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Sparkle/Confetti */
@keyframes sparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0;
    }
}

/* Fire Flicker for Streak */
@keyframes fire-flicker {
    0%, 100% { 
        transform: scale(1) rotate(-3deg);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.15) rotate(3deg);
        filter: brightness(1.2);
    }
}

/* Gradient Shift for Progress */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Slide In */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Up */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Glow Pulse */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--shadow-green),
                    0 0 10px var(--shadow-green);
    }
    50% {
        box-shadow: 0 0 15px var(--shadow-green-glow),
                    0 0 25px var(--shadow-green-glow);
    }
}

/* Scale In */
@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Checkmark Draw */
@keyframes checkmark-draw {
    0% {
        stroke-dashoffset: 24;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* ==================== Header ==================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-white);
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 1000;
    box-shadow: 0 4px 20px var(--shadow-dark);
}

.header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary-dark);
    transition: opacity 0.15s ease;
}

.header .header-logo {
    width: 60px;
    height: 60px;
    margin-right: 8px;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    transition: transform var(--transition-fast);
    padding: 0;
    background: transparent;
    object-fit: contain;
}

.header .header-logo:hover {
    transform: scale(1.05);
}

.header .header-logo:active {
    transform: scale(0.95);
}

.header .d-flex {
    display: flex;
    align-items: center;
}

.header-actions button {
    background: var(--bg-card);
    border: none;
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: var(--neu-shadow-sm);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.header-actions button:hover {
    transform: translateY(-2px);
    box-shadow: var(--neu-shadow);
}

.header-actions button:active {
    transform: scale(0.95);
    box-shadow: var(--neu-inset-sm);
}

/* ==================== Main Content ==================== */

.main-content {
    padding-top: calc(var(--nav-height) + 24px);
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 24px;
    max-width: 600px;
    margin: 0 auto;
}

/* ==================== Bottom Navigation ==================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -6px 24px var(--shadow-dark);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--gray);
    padding: 10px 18px;
    border-radius: var(--radius);
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    background: transparent;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 50px;
    height: 50px;
    background: var(--primary-soft);
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
    z-index: -1;
}

.nav-item:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active::before {
    transform: translate(-50%, -50%) scale(1);
    background: var(--primary-soft);
}

.nav-item.active .icon {
    animation: bounce 0.5s ease;
}

/* SVG Navigation Icons */
.nav-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 5px;
    transition: var(--transition-bounce);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.nav-item.active .nav-icon {
    animation: bounce 0.5s ease;
    stroke-width: 2.5;
}

.nav-item span:last-child {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ==================== Cards (Neumorphic) ==================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--neu-shadow);
    transition: var(--transition-normal);
}

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

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

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
}

/* ==================== Progress Card ==================== */

.progress-card {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px var(--shadow-green);
    position: relative;
    overflow: hidden;
}

.progress-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.progress-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.progress-card .date {
    opacity: 0.85;
    font-size: 0.9rem;
    margin-bottom: 24px;
    font-weight: 500;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.25);
    height: 14px;
    border-radius: 7px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    background: linear-gradient(90deg, #ffffff 0%, #dcfce7 100%);
    height: 100%;
    border-radius: 7px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 10px rgba(255,255,255,0.3);
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 200% 100%;
    animation: gradient-shift 2s ease infinite;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
}

.progress-stat {
    text-align: center;
}

.progress-stat .value {
    font-size: 1.6rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.progress-stat .label {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Fire Emoji Animation */
.progress-stat .value:has(span) {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ==================== Streak Badge ==================== */

.streak-badge {
    display: inline-flex;
    align-items: center;
    background: var(--gradient-warm);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius-xl);
    font-weight: 700;
    box-shadow: 0 4px 15px var(--shadow-green);
}

.streak-badge .fire {
    margin-right: 8px;
    animation: fire-flicker 0.8s ease-in-out infinite;
    display: inline-block;
}

/* ==================== Habit List ==================== */

.habit-list {
    list-style: none;
}

.habit-item {
    display: flex;
    align-items: center;
    padding: 18px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    box-shadow: var(--neu-shadow);
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.habit-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition-normal);
}

.habit-item:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--neu-shadow-lg);
}

.habit-item:hover::before {
    opacity: 1;
}

.habit-item:active {
    transform: scale(0.98);
    box-shadow: var(--neu-inset);
}

.habit-item.completed {
    background: var(--primary-ultra-soft);
}

.habit-item.completed::before {
    opacity: 1;
    background: var(--success);
}

.habit-item.completed .habit-title {
    text-decoration: line-through;
    color: var(--gray);
}

/* Habit item - Already in plan (disabled) */
.habit-item.in-plan.disabled {
    opacity: 0.5;
    background: var(--gray-ultra-light);
    cursor: default;
    pointer-events: none;
}

.habit-item.in-plan.disabled .habit-icon {
    filter: grayscale(100%);
}

.habit-item.in-plan.disabled .habit-title {
    color: var(--gray);
}

.habit-item.in-plan.disabled .habit-badge {
    opacity: 0.6;
}

.habit-item.in-plan.disabled .btn {
    pointer-events: auto;
    cursor: default;
}

/* Muted button style */
.btn-muted {
    background: var(--gray-light);
    color: var(--gray);
    cursor: default;
    box-shadow: none;
}

.btn-muted:hover {
    transform: none;
    background: var(--gray-light);
}

/* Habit Checkbox - Neumorphic */
.habit-checkbox {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-normal);
    flex-shrink: 0;
    background: var(--bg-main);
    box-shadow: var(--neu-inset-sm);
    color: transparent;
    font-size: 1rem;
}

.habit-checkbox:hover {
    background: var(--primary-soft);
    box-shadow: var(--neu-shadow-sm);
}

.habit-checkbox.checked {
    background: var(--gradient-primary);
    box-shadow: 0 4px 15px var(--shadow-green);
    color: white;
    animation: success-pulse 0.4s ease;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Sparkle effect on check */
.habit-checkbox.just-checked {
    animation: success-pulse 0.4s ease, glow-pulse 0.6s ease;
}

.habit-icon {
    font-size: 2rem;
    margin-right: 16px;
    flex-shrink: 0;
}

.habit-info {
    flex: 1;
    min-width: 0;
}

.habit-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.habit-description {
    font-size: 0.95rem;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.habit-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: var(--radius-xl);
    font-weight: 700;
    margin-left: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-easy {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.badge-medium {
    background: #fef3c7;
    color: #b45309;
}

.badge-hard {
    background: #fee2e2;
    color: #dc2626;
}

.habit-action {
    color: var(--primary);
    background: var(--bg-main);
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-full);
    box-shadow: var(--neu-shadow-sm);
    transition: var(--transition-normal);
}

.habit-action:hover {
    transform: scale(1.1);
    box-shadow: var(--neu-shadow);
}

.habit-action:active {
    transform: scale(0.95);
    box-shadow: var(--neu-inset-sm);
}

/* ==================== Category Section ==================== */

.category-section {
    margin-bottom: 28px;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--neu-shadow-sm);
    transition: var(--transition-normal);
    margin-bottom: 14px;
}

.category-header:hover {
    transform: translateX(4px);
    box-shadow: var(--neu-shadow);
}

.category-header:active {
    transform: scale(0.99);
}

.category-icon {
    font-size: 1.6rem;
    margin-right: 12px;
}

.category-name {
    flex: 1;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--dark);
}

.category-toggle {
    color: var(--primary);
    font-size: 1.3rem;
    transition: var(--transition-normal);
    font-weight: bold;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category-habits {
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 8px;
}

.category-habits.collapsed {
    max-height: 0;
}

/* ==================== Buttons (Neumorphic + Gamified) ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition-normal);
    border: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

/* Ripple effect container */
.btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.4) 10%, transparent 10%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
}

.btn:active::after {
    transform: scale(0, 0);
    opacity: 0.4;
    transition: 0s;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 20px var(--shadow-green);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--shadow-green-glow);
}

.btn-primary:active {
    transform: translateY(0) scale(0.97);
    box-shadow: 0 4px 12px var(--shadow-green);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--dark);
    box-shadow: var(--neu-shadow-sm);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: var(--neu-shadow);
}

.btn-secondary:active {
    transform: scale(0.97);
    box-shadow: var(--neu-inset-sm);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 6px 20px var(--shadow-green);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--shadow-green-glow);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: var(--primary-soft);
    transform: translateY(-2px);
}

.btn-outline:active {
    transform: scale(0.97);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: 10px 18px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 18px 36px;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* ==================== Forms (Neumorphic) ==================== */

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

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    transition: var(--transition-normal);
    background: var(--bg-main);
    box-shadow: var(--neu-inset);
    color: var(--dark);
}

.form-input:focus {
    outline: none;
    box-shadow: var(--neu-inset), 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
    color: var(--gray);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

/* ==================== Auth Pages ==================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 20px;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}

.auth-container::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(0,0,0,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.auth-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 1;
    animation: scaleIn 0.4s ease;
}

.auth-logo {
    text-align: center;
    margin-bottom: 16px;
}

.auth-logo img {
    width: 140px;
    height: auto;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: transparent;
}

.auth-title {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 32px;
    color: var(--dark);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    color: var(--gray);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: var(--gray-ultra-light);
    border-radius: 1px;
}

.auth-divider span {
    padding: 0 18px;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-google {
    background: var(--bg-card);
    border: none;
    color: var(--dark);
    width: 100%;
    box-shadow: var(--neu-shadow-sm);
}

.btn-google:hover {
    transform: translateY(-2px);
    box-shadow: var(--neu-shadow);
}

.btn-google:active {
    transform: scale(0.98);
    box-shadow: var(--neu-inset-sm);
}

.btn-google img {
    width: 22px;
    margin-right: 12px;
}

.auth-link {
    text-align: center;
    margin-top: 24px;
    color: var(--gray);
    font-size: 0.95rem;
}

.auth-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition-fast);
}

.auth-link a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ==================== Resources ==================== */

.resource-tabs {
    display: flex;
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 6px;
    box-shadow: var(--neu-shadow);
}

.resource-tab {
    flex: 1;
    padding: 14px;
    text-align: center;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-weight: 700;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition-normal);
}

.resource-tab:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.resource-tab.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px var(--shadow-green);
}

.resource-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: var(--neu-shadow);
    transition: var(--transition-normal);
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--neu-shadow-lg);
}

.resource-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--gray-ultra-light);
}

.resource-body {
    padding: 18px;
}

.resource-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1.15rem;
    color: var(--dark);
}

.resource-description {
    font-size: 1rem;
    color: var(--gray);
    line-height: 1.5;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ==================== Profile ==================== */

.profile-header {
    text-align: center;
    padding: 36px 24px;
    background: var(--gradient-primary);
    color: white;
    margin: calc(-1 * var(--nav-height) - 24px) -20px 24px;
    padding-top: calc(var(--nav-height) + 36px);
    position: relative;
    overflow: hidden;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.profile-avatar {
    width: 110px;
    height: 110px;
    border-radius: var(--radius-full);
    border: 5px solid white;
    margin-bottom: 18px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.profile-name {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-email {
    opacity: 0.9;
    font-weight: 500;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-top: 24px;
}

.profile-stat {
    text-align: center;
}

.profile-stat .value {
    font-size: 1.6rem;
    font-weight: 800;
}

.profile-stat .label {
    font-size: 0.8rem;
    opacity: 0.9;
    font-weight: 500;
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 18px;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--neu-shadow-sm);
}

.settings-item:hover {
    transform: translateX(6px);
    box-shadow: var(--neu-shadow);
}

.settings-item:active {
    transform: scale(0.98);
}

.settings-icon {
    font-size: 1.4rem;
    margin-right: 16px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    border-radius: var(--radius-sm);
}

.settings-label {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.settings-arrow {
    color: var(--gray);
    font-size: 1.4rem;
    font-weight: bold;
}

/* ==================== Modals ==================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-white);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 28px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
}

.modal-close {
    background: var(--bg-main);
    border: none;
    font-size: 1.6rem;
    color: var(--gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    box-shadow: var(--neu-shadow-sm);
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

/* ==================== Utilities ==================== */

.text-center { text-align: center; }
.text-muted { color: var(--gray); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.hidden { display: none !important; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ==================== Page Sections ==================== */

.page-section {
    display: none;
    animation: slideUp 0.4s ease;
}

.page-section.active {
    display: block;
}

/* ==================== Loading ==================== */

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--primary-soft);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-ultra-light) 25%, var(--bg-card) 50%, var(--gray-ultra-light) 75%);
    background-size: 200% 100%;
    animation: gradient-shift 1.5s ease infinite;
    border-radius: var(--radius-sm);
}

/* ==================== Toast Notifications ==================== */

.toast-container {
    position: fixed;
    top: calc(var(--nav-height) + 16px);
    left: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 16px 22px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.4s ease;
    pointer-events: auto;
    font-weight: 500;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.success {
    background: var(--gradient-success);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ==================== Empty State ==================== */

.empty-state {
    text-align: center;
    padding: 50px 24px;
    color: var(--gray);
}

.empty-state .icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.4;
    filter: grayscale(0.5);
}

.empty-state h3 {
    margin-bottom: 12px;
    color: var(--dark);
    font-weight: 700;
    font-size: 1.3rem;
}

.empty-state p {
    font-size: 1.05rem;
    line-height: 1.6;
}

/* ==================== Install Prompt ==================== */

.install-prompt {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 20px);
    left: 20px;
    right: 20px;
    background: var(--bg-white);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    z-index: 1500;
}

.install-prompt.show {
    display: block;
    animation: slideUp 0.4s ease;
}

.install-prompt h4 {
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 1.1rem;
}

.install-prompt p {
    color: var(--gray);
    font-size: 0.95rem;
}

.install-prompt .buttons {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

/* ==================== Special Effects ==================== */

/* Confetti particles container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Glow effect on success actions */
.glow-success {
    animation: glow-pulse 0.6s ease;
}

/* ==================== Resource Actions ==================== */

.resource-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.resource-actions .btn {
    flex: 1;
    min-width: 120px;
}

.btn-print {
    background: var(--bg-card);
    color: var(--dark);
    box-shadow: var(--neu-shadow-sm);
}

.btn-print:hover {
    background: var(--gray-ultra-light);
    transform: translateY(-2px);
}

/* Resource Rating */
.resource-rating {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--gray-ultra-light);
}

.resource-viewed {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--gray);
    transition: color 0.2s ease;
}

.resource-viewed:hover {
    color: var(--primary);
}

.resource-viewed input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.resource-viewed.checked {
    color: var(--primary);
    font-weight: 600;
}

.resource-stars {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.resource-stars .star {
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    opacity: 0.3;
}

.resource-stars .star:hover {
    transform: scale(1.2);
}

.resource-stars .star.active {
    opacity: 1;
}

.resource-stars .star.filled {
    color: #fbbf24;
    opacity: 1;
}

/* ==================== Add More Habits Button ==================== */

.add-more-habits {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px dashed var(--gray-light);
}

.add-more-habits .btn-outline {
    font-size: 1rem;
    padding: 16px 24px;
    color: var(--primary);
    border-color: var(--primary);
    border-style: dashed;
}

.add-more-habits .btn-outline:hover {
    background: var(--primary-soft);
    border-style: solid;
}

.add-more-habits .btn-primary {
    font-size: 1.1rem;
    padding: 18px 24px;
    color: white !important;
}

/* ==================== Welcome Modal ==================== */

.welcome-content {
    max-width: 420px;
    padding: 36px 28px;
    text-align: center;
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, var(--bg-white) 0%, var(--primary-ultra-soft) 100%);
}

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

.welcome-logo {
    width: 110px;
    height: auto;
    margin-bottom: 8px;
}

.welcome-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 0;
}

.welcome-message {
    text-align: left;
    margin-bottom: 28px;
}

.welcome-message p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--dark-soft);
    margin-bottom: 16px;
}

.welcome-message p:last-child {
    margin-bottom: 0;
}

.welcome-message strong {
    color: var(--primary-dark);
    font-weight: 700;
}

.welcome-form {
    background: var(--bg-light);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px dashed var(--gray-light);
}

.welcome-form-intro {
    font-size: 0.9rem;
    color: var(--gray);
    margin-bottom: 12px;
    text-align: center;
}

.welcome-form .form-input {
    background: white;
    font-size: 0.95rem;
    padding: 12px 16px;
}

.welcome-cta {
    background: var(--primary-soft);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    margin-top: 20px;
}

.welcome-cta-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 18px !important;
    text-align: center;
}

.welcome-btn {
    font-size: 1.15rem;
    padding: 18px 32px;
    animation: glow-pulse 2s ease-in-out infinite;
}

/* ==================== Password Generator ==================== */

.password-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.password-input-wrapper .form-input {
    flex: 1;
}

.btn-generate-password {
    background: var(--bg-card);
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    box-shadow: var(--neu-shadow-sm);
    transition: var(--transition-normal);
    white-space: nowrap;
}

.btn-generate-password:hover {
    transform: translateY(-2px);
    box-shadow: var(--neu-shadow);
    background: var(--primary-soft);
}

.btn-generate-password:active {
    transform: scale(0.95);
    box-shadow: var(--neu-inset-sm);
}

.generated-password-box {
    margin-top: 12px;
    padding: 14px 18px;
    background: var(--primary-soft);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-align: center;
    letter-spacing: 1px;
    border: 2px dashed var(--primary);
    animation: scaleIn 0.3s ease;
}

.generated-password-box::before {
    content: '🔐 Вашата парола: ';
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 6px;
    letter-spacing: normal;
    color: var(--gray);
}

/* ==================== Remember Me Checkbox ==================== */

.remember-me {
    display: flex;
    align-items: center;
}

.remember-me label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--gray);
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: var(--primary);
    cursor: pointer;
}

.remember-me span {
    transition: color 0.2s ease;
}

.remember-me label:hover span {
    color: var(--dark);
}

/* ==================== Anonymous Auth Loading ==================== */

.auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-main);
    padding: 20px;
}

.auth-loading .loading-spinner {
    margin-bottom: 20px;
}

.auth-loading p {
    font-size: 1.1rem;
    color: var(--gray);
}

/* ==================== Auth Container (Recovery Form) ==================== */

.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-main);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    width: 140px;
    height: auto;
    margin-bottom: 8px;
}

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

.auth-card h2 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 8px;
    text-align: center;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--gray);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-ultra-light);
}

.auth-divider span {
    padding: 0 16px;
    font-size: 0.9rem;
}

/* ==================== Link Account Banner ==================== */

.link-account-banner {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 8px);
    left: 8px;
    right: 8px;
    background: linear-gradient(135deg, var(--primary-soft), var(--bg-white));
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 100;
    transform: translateY(150%);
    opacity: 0;
    transition: all var(--transition-normal);
    border: 1px solid var(--primary-light);
}

.link-account-banner.show {
    transform: translateY(0);
    opacity: 1;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.banner-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--primary);
}

.banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.banner-text strong {
    font-size: 0.9rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.banner-text span {
    font-size: 0.75rem;
    color: var(--gray);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--gray);
    padding: 4px 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.btn-ghost:hover {
    color: var(--dark);
}

/* ==================== Toggle Switch ==================== */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-light);
    transition: var(--transition-normal);
    border-radius: 28px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-normal);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

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

.settings-label-group {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.settings-sublabel {
    font-size: 0.75rem;
    color: var(--gray);
    margin-top: 2px;
}

/* ==================== Info Box ==================== */

.info-box {
    background: var(--primary-ultra-soft);
    border-left: 3px solid var(--primary);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
}

.info-box strong {
    display: block;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.info-box p {
    color: var(--gray);
    line-height: 1.4;
}

/* ==================== Media Queries ==================== */

@media (min-width: 768px) {
    .main-content {
        padding-left: 40px;
        padding-right: 40px;
    }
    
    .bottom-nav {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    
    .auth-card {
        padding: 48px 40px;
    }
    
    .modal-content {
        border-radius: var(--radius-xl);
        margin-bottom: 20px;
    }
}

@media (max-width: 380px) {
    .nav-item {
        padding: 8px 12px;
    }
    
    .nav-item span:last-child {
        font-size: 0.65rem;
    }
    
    .progress-stats {
        flex-direction: column;
        gap: 12px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Can be expanded later */
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
