:root {
    --primary: #ff6b6b;
    --primary-dark: #ee5253;
    --secondary: #48dbfb;
    --accent: #feca57;
    --bg-dark: #0f172a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-white: #f8fafc;
    --text-dim: #94a3b8;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: linear-gradient(rgba(10, 15, 35, 0.82), rgba(10, 15, 35, 0.88)), url('assets/ai_chef_background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
    transition: all 10s ease-in-out;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation: move 20s infinite alternate;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--secondary);
    bottom: -50px;
    left: -50px;
    animation: move 25s infinite alternate-reverse;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 40%;
    left: 40%;
    animation: move 30s infinite alternate;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 100px) scale(1.1);
    }
}

/* Container & Layout */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: -20px;
}

.btn-icon {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    border-color: var(--primary);
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo i {
    color: var(--primary);
    width: 48px;
    height: 48px;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo h1 span {
    color: var(--primary);
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.2rem;
    font-weight: 300;
}

/* Glassmorphism Classes */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Sections */
.input-section {
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

h2 {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

h2 i {
    color: var(--primary);
}

/* Inputs & Buttons */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

input[type="text"],
select {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

select option {
    background: white;
    color: #333;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 1.5rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    border-radius: 12px;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(72, 219, 251, 0.1);
    transform: translateY(-2px);
}

.btn-secondary.small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
}

.btn-generate {
    flex: 2;
    background: linear-gradient(135deg, var(--primary), #ff9f43);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 1.2rem;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-secondary.large {
    flex: 1;
    padding: 1.2rem;
    font-size: 1.1rem;
    border-width: 2px;
}

.btn-generate:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
}

/* Quick Toggles */
.quick-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.toggle-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

/* Pro Feature Indicators */
.pro-feature {
    position: relative;
    border-color: rgba(254, 202, 87, 0.3) !important;
}

.pro-feature::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    bottom: -1px;
    left: -1px;
    border-radius: inherit;
    border: 1px solid rgba(254, 202, 87, 0.2);
    pointer-events: none;
    box-shadow: 0 0 10px rgba(254, 202, 87, 0.05);
}

/* Hide locks for premium users */
body.is-premium .pro-lock-icon,
body.is-premium .pro-feature i[data-lucide="lock"],
body.is-premium .pro-feature .lucide-lock {
    display: none !important;
}

body.is-premium .pro-feature {
    border-color: var(--glass-border) !important;
}

body.is-premium #scan-fridge {
    border-color: var(--secondary) !important;
}

/* Tags */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    min-height: 40px;
}

.tag {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid var(--primary);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: scaleIn 0.3s ease;
}

.tag span {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
}

.tag span:hover {
    opacity: 1;
}

/* Preferences */
.preferences-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pref-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pref-box label {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.pref-group {
    background: rgba(255, 255, 255, 0.02);
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.radio-label {
    padding: 0.8rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.radio-label:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.radio-label:has(input:checked) {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
}

.radio-label input[type="radio"]:checked+div div:first-child {
    color: var(--primary);
}

/* Recipes Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.recipe-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    cursor: pointer;
}

.recipe-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.recipe-img {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.recipe-info {
    padding: 1.5rem;
}

.recipe-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent);
    color: black;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Shopping List */
.shopping-section {
    margin-top: 3rem;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.shopping-list {
    list-style: none;
    margin-top: 1rem;
}

.shopping-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.remove-item {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.remove-item:hover {
    opacity: 1;
}

.ing-check {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#confirm-modal {
    z-index: 2000;
}

.modal-content {
    max-width: 800px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content.wide {
    max-width: 1200px;
}

.modal-content.small {
    max-width: 400px;
}

.close-modal,
.close-settings,
.close-pro {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* Helper Classes */
.hidden {
    display: none !important;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid var(--glass);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
}

.loader.spin {
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.shopping-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cooking-mode-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: stretch;
}

.cooking-sidebar {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.8rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 55vh;
}

.cooking-sidebar h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.cooking-sidebar ul li {
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

.cooking-sidebar ul li:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(254, 202, 87, 0.2);
    transform: translateX(4px);
}

.cooking-main {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: left;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.cooking-instruction {
    font-size: 1.8rem;
    line-height: 1.6;
    font-weight: 300;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* Toast and Success View */
#auth-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--primary);
    padding: 1.2rem 2rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    z-index: 10000;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 107, 107, 0.2);
    text-align: center;
}

.auth-success-view {
    text-align: center;
    padding: 2.5rem 1.5rem;
    animation: scaleIn 0.5s ease-out;
}

.success-icon-wrapper {
    width: 80px;
    height: 80px;
    background: rgba(85, 239, 196, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #55efc4;
    border: 2px solid #55efc4;
}

.auth-success-view h2 {
    color: #55efc4;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.auth-success-view p {
    color: var(--text-white);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.auth-success-view .activation-notice {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.2rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: left;
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .glass-card {
        padding: 1.5rem;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 1rem;
    }

    .shopping-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-generate {
        font-size: 1.1rem;
    }

    .recipe-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .recipe-img {
        height: 150px;
    }

    .cooking-mode-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 1rem;
    }

    .cooking-sidebar {
        max-height: 150px;
        padding: 1rem;
    }

    .cooking-main {
        padding: 1.2rem;
    }

    .cooking-instruction {
        font-size: 1.25rem;
    }
}

/* Premium Modal Animations */
.modal:not(.hidden) .modal-content {
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Tooltip Enhancement (Basic Browser Tooltip) */
[title] {
    cursor: help;
}

/* Family Member List Item Hover */
#family-members-list>div {
    transition: all 0.2s ease;
}

#family-members-list>div:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateX(4px);
}

/* Enhanced Family Section */
.family-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid var(--glass-border);
}

.family-member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.family-member-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.auth-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), transparent);
    margin: 1.5rem 0;
}

.invite-box,
.join-box {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}