/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores do site antigo (convertidas de OKLCH) */
    --primary: #A67C52; /* oklch(0.55 0.15 35) - tom dourado/marrom quente */
    --primary-dark: #8B6F47;
    --primary-light: #C49A6F;
    --primary-foreground: #FFFFFF;
    
    --background: #FFFFFF; /* oklch(1 0 0) */
    --foreground: #252525; /* oklch(0.145 0 0) */
    
    --card: #FFFFFF;
    --card-foreground: #252525;
    
    --secondary: #F7F7F7; /* oklch(0.97 0 0) */
    --secondary-foreground: #252525;
    
    --muted: #F7F7F7; /* oklch(0.97 0 0) */
    --muted-foreground: #8E8E8E; /* oklch(0.556 0 0) */
    
    --accent: #F7F7F7;
    --accent-foreground: #252525;
    
    --destructive: #DC2626; /* oklch(0.577 0.245 27.325) */
    --destructive-foreground: #FFFFFF;
    
    --border: #EBEBEB; /* oklch(0.922 0 0) */
    --input: #EBEBEB;
    --ring: #B5B5B5; /* oklch(0.708 0 0) */
    
    --radius: 0.625rem; /* 10px - do site antigo */
    --radius-lg: 0.75rem; /* 12px */
    
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Fontes */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* PWA Standalone Mode - Android: scroll dentro de #app (document scroll falha) */
html.pwa-standalone,
html.android-pwa {
    height: 100%;
    overflow: hidden;
}

html.pwa-standalone body,
html.android-pwa body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
    touch-action: none;
    /* Android: deixar os toques passarem para #app para o scroll funcionar */
    pointer-events: none;
}

html.pwa-standalone body > *,
html.android-pwa body > * {
    pointer-events: auto;
}

/* Quando modal está aberto, body mantém position fixed; em PWA travar scroll do #app */
html.pwa-standalone body.modal-open,
html.android-pwa body.modal-open {
    overflow: hidden;
}

html.pwa-standalone body.modal-open #app,
html.android-pwa body.modal-open #app {
    overflow: hidden;
}

/* #app é o contentedor de scroll no PWA Android */
html.pwa-standalone #app,
html.android-pwa #app {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
    /* Nota: evitar `transform` aqui porque quebra `position: fixed` dos modais no Android
       (o fixed passa a ser relativo ao contentor e pode "saltar" para o topo). */
    /* Folga no fundo: evita último card ficar “cortado” no Android */
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

/* Android/PWA: ao abrir modal, garantir que `position: fixed` fica relativo ao viewport */
html.pwa-standalone body.modal-open #app,
html.android-pwa body.modal-open #app {
    transform: none !important;
    -webkit-transform: none !important;
}

html.pwa-standalone body *,
html.android-pwa body * {
    -webkit-tap-highlight-color: transparent;
}

html.pwa-standalone .week-planner,
html.android-pwa .week-planner {
    min-height: auto;
    overflow: visible;
}

/* Prevenir zoom em modo standalone - mesmo esquema: scroll em #app */
@media (display-mode: standalone) {
    html {
        height: 100%;
        overflow: hidden;
    }
    
    body {
        height: 100%;
        overflow: hidden;
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
        touch-action: none;
        pointer-events: none;
    }
    
    body > * {
        pointer-events: auto;
    }
    
    /* #app como contentedor de scroll */
    #app {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
        overscroll-behavior-y: contain;
        /* Evitar `transform` aqui (quebra modais fixed em Android) */
        padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    }
    
    .week-planner {
        min-height: auto;
        overflow: visible;
    }
    
    input, textarea, [contenteditable], select {
        -webkit-user-select: text;
        user-select: text;
        touch-action: auto;
    }
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 1rem;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

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

.login-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-button {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    transition: all 0.2s;
    margin-bottom: -2px;
}

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

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--background);
    color: var(--foreground);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(166, 124, 82, 0.1);
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Buttons - Estilo do site antigo */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
    white-space: nowrap;
    line-height: 1.5;
    height: 2.25rem; /* h-9 */
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 3px rgba(166, 124, 82, 0.2);
}

.btn-outline {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--foreground);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    border-color: var(--input);
}

.btn-outline:focus-visible {
    box-shadow: 0 0 0 3px rgba(166, 124, 82, 0.1);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-secondary:hover {
    background: var(--secondary);
    opacity: 0.8;
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-destructive:hover {
    background: var(--destructive);
    opacity: 0.9;
}

.btn-sm {
    height: 2rem; /* h-8 */
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius);
    gap: 0.375rem;
}

.btn-lg {
    height: 2.5rem; /* h-10 */
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius);
}

.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    transition: all 0.2s;
    cursor: pointer;
}

.btn-icon:active,
.btn-icon:focus {
    background: var(--accent);
    outline: none;
    border-color: var(--primary);
}

.btn-icon:hover {
    background: var(--accent);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-icon-sm {
    width: 2rem;
    height: 2rem;
}

.btn-icon-lg {
    width: 2.5rem;
    height: 2.5rem;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert-error {
    background: #FEF2F2;
    color: #991B1B;
    border-color: #FECACA;
}

.alert-success {
    background: #F0FDF4;
    color: #166534;
    border-color: #BBF7D0;
}

.alert-info {
    background: #EFF6FF;
    color: #1E40AF;
    border-color: #DBEAFE;
}

/* Week Planner */
.week-planner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 768px) {
    .week-planner {
        padding: 2rem;
    }
}

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

.planner-header .header-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .planner-header .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.planner-header .header-left h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

@media (min-width: 768px) {
    .planner-header .header-left h1 {
        font-size: 2.5rem;
    }
}

.planner-header .user-greeting {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .planner-header .user-greeting {
        font-size: 1rem;
    }
}

.planner-header .user-email {
    color: var(--foreground);
    font-weight: 500;
}

.planner-header .header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

@media (min-width: 640px) {
    .week-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .week-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .week-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Day Card - Estilo do site antigo */
.day-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.day-card:hover {
    box-shadow: var(--shadow-md);
}

.day-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.meal-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meal-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.meal-button {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: auto;
    height: auto;
}

.meal-button:hover {
    border-color: var(--primary);
    background: rgba(166, 124, 82, 0.05);
}

.meal-button .recipe-name {
    flex: 1;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meal-button .recipe-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.meal-observations {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    font-style: italic;
    margin-top: 0.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meal-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.btn-icon-small {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--muted-foreground);
}

.btn-icon-small:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    border-color: var(--input);
}

.btn-generate {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.btn-generate:hover {
    background: var(--accent);
    border-color: var(--primary);
    color: var(--primary);
}

/* Swap Mode Indicator - Modern Design */
.swap-mode-indicator {
    background: var(--card);
    border: 1.5px solid var(--primary);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    box-shadow: 0 2px 8px rgba(166, 124, 82, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    animation: slideDownFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    will-change: transform, opacity; /* Otimização de rendering */
    transform: translateZ(0); /* Force GPU acceleration */
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.swap-mode-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.swap-mode-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, rgba(166, 124, 82, 0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(166, 124, 82, 0.2);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 2px 6px rgba(166, 124, 82, 0.2);
    }
    50% {
        box-shadow: 0 2px 12px rgba(166, 124, 82, 0.4), 0 0 0 4px rgba(166, 124, 82, 0.1);
    }
}

.swap-icon {
    color: white;
    width: 20px;
    height: 20px;
    animation: iconRotate 3s ease-in-out infinite;
}

@keyframes iconRotate {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(5deg);
    }
}

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

.swap-mode-title {
    margin: 0 0 0.125rem 0;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--foreground);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.swap-mode-description {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    line-height: 1.4;
    font-weight: 400;
}

.swap-cancel-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-foreground);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    padding: 0;
}

.swap-cancel-btn:hover {
    background: var(--accent);
    border-color: var(--input);
    color: var(--foreground);
    transform: scale(1.05);
}

.swap-cancel-btn:active {
    transform: scale(0.95);
}

.swap-cancel-btn svg {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .swap-mode-indicator {
        padding: 0.875rem 1rem;
        gap: 1rem;
        border-radius: 10px;
    }
    
    .swap-mode-badge {
        width: 36px;
        height: 36px;
    }
    
    .swap-icon {
        width: 18px;
        height: 18px;
    }
    
    .swap-mode-title {
        font-size: 0.875rem;
    }
    
    .swap-mode-description {
        font-size: 0.75rem;
    }
    
    .swap-cancel-btn {
        width: 32px;
        height: 32px;
    }
    
    .swap-cancel-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 50;
    display: none;
    padding: 0.25rem;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--foreground);
    text-decoration: none;
    font-size: 0.875rem;
    width: 100%;
    border: none;
    background: none;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--accent);
    color: var(--accent-foreground);
}

.dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* Prevenir scroll quando modal está aberto */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overscroll-behavior: none; /* Prevenir pull-to-refresh quando modal está aberto */
}

/* Modals - Design melhorado (otimizado) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* Oculto por padrão */
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem; /* Mais espaço nas laterais */
    z-index: 100;
    /* Sem backdrop-filter: blur — custo de composição muito alto ao abrir modais em mobile */
    animation: fadeIn 0.2s ease-out;
    overflow-y: auto; /* Permitir scroll apenas no modal */
    will-change: opacity; /* Otimização de rendering */
    overscroll-behavior-y: contain; /* Prevenir pull-to-refresh no Android */
    overscroll-behavior: contain; /* Prevenir pull-to-refresh em todos os eixos */
}

.modal.show {
    display: flex; /* Mostrar quando tiver classe 'show' */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.modal-content {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden; /* Mudado de auto para hidden para melhor controle */
    position: relative;
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--border);
    margin: auto; /* Centralizar melhor */
    display: flex;
    flex-direction: column;
    will-change: transform, opacity; /* Otimização de rendering */
    transform: translateZ(0); /* Force GPU acceleration */
    touch-action: pan-y; /* Permitir scroll vertical e swipe */
    overscroll-behavior-y: contain; /* Prevenir pull-to-refresh no Android */
    overscroll-behavior: contain; /* Prevenir pull-to-refresh em todos os eixos */
}

/* Handle bar para indicar swipe down (estilo iOS) */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--muted-foreground);
    border-radius: 2px;
    opacity: 0.3;
    z-index: 1;
    display: none;
}

.modal-large {
    max-width: 900px; /* Aumentado de 800px */
}

/* Scroll apenas no body do modal */
.modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
}

.modal-content > h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
    padding: 2rem 2rem 1.25rem 2rem; /* Muito mais espaço no topo e laterais */
    flex-shrink: 0; /* Não encolher */
    border-bottom: 1px solid var(--border);
}

.modal-content > .close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 20;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    background: var(--muted);
    border: 1px solid var(--border);
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted-foreground);
    padding: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

.modal-content > .close:hover {
    background: var(--accent);
    color: var(--foreground);
    border-color: var(--primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem 2rem 2rem 2rem; /* Muito mais espaço nas laterais e topo */
    flex: 1;
    overflow-y: auto;
}

/* Garantir que elementos dentro do modal-body tenham espaço */
.modal-body > * {
    margin-bottom: 1rem;
}

.modal-body > *:last-child {
    margin-bottom: 0;
}

/* Estilização para formulários dentro dos modais */
.modal-body form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-body textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(166, 124, 82, 0.1);
}

.modal-content > div:not(.close):not(.modal-header):not(.modal-body):not(.modal-footer) {
    padding: 0 2rem 2rem 2rem; /* Espaço para conteúdo direto no modal-content */
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Espaçamento para elementos dentro dos modais */
.modal-content .search-filters,
.modal-content .recipe-search-results,
.modal-content #shopping-list-content,
.modal-content #kitchen-timer-content,
.modal-content #meal-history-content,
.modal-content #notifications-content,
.modal-content #recipe-content {
    padding: 0 2rem 2rem 2rem;
}

.modal-content .search-filters {
    padding-top: 1rem;
    padding-bottom: 1.5rem;
}

.modal-content .recipe-search-results {
    padding-top: 0;
    max-height: 500px;
    overflow-y: auto;
}

/* Recipe Modal */
.recipe-modal-content {
    max-width: 600px;
}

.recipe-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.recipe-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
    flex: 1;
}

.recipe-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.recipe-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.recipe-section {
    margin-bottom: 1.5rem;
}

.recipe-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.75rem;
}

/* Ingredientes - Design Moderno */
.recipe-ingredients,
.ingredients-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: grid;
    gap: 0.75rem;
}

.recipe-ingredients li,
.ingredients-list li {
    padding: 1rem 1.25rem;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--foreground);
    border: 1px solid rgba(166, 124, 82, 0.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.recipe-ingredients li::before,
.ingredients-list li::before {
    content: '🥘';
    font-size: 1.25rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.recipe-ingredients li:hover,
.ingredients-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(166, 124, 82, 0.15), 0 2px 4px rgba(0, 0, 0, 0.08);
    border-color: rgba(166, 124, 82, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #fff8f3 100%);
}

.recipe-ingredients li strong,
.ingredients-list li strong {
    color: var(--primary);
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Modo de Preparação - Design Moderno */
.recipe-steps,
.steps-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    counter-reset: step-counter;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recipe-steps li,
.steps-list li {
    counter-increment: step-counter;
    position: relative;
    padding: 1.25rem 1.25rem 1.25rem 4rem;
    margin: 0;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--foreground);
    border: 1px solid rgba(166, 124, 82, 0.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 3.5rem;
    display: flex;
    align-items: center;
}

.recipe-steps li::before,
.steps-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--primary-foreground);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(166, 124, 82, 0.25);
    flex-shrink: 0;
}

.recipe-steps li:hover,
.steps-list li:hover {
    transform: translateX(4px) translateY(-1px);
    box-shadow: 0 4px 16px rgba(166, 124, 82, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: rgba(166, 124, 82, 0.25);
    background: linear-gradient(135deg, #ffffff 0%, #fff8f3 100%);
}

.recipe-steps li:hover::before,
.steps-list li:hover::before {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(166, 124, 82, 0.35);
}

.recipe-ingredients li:last-child,
.recipe-steps li:last-child,
.ingredients-list li:last-child,
.steps-list li:last-child {
    margin-bottom: 0;
}

/* Títulos das seções */
#recipe-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    position: relative;
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#recipe-content h3:first-of-type {
    margin-top: 1.5rem;
}

#recipe-content h3::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, transparent 100%);
    border-radius: 2px;
}

/* Responsividade */
@media (max-width: 768px) {
    .recipe-ingredients li,
    .ingredients-list li,
    .recipe-steps li,
    .steps-list li {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
    
    .recipe-steps li,
    .steps-list li {
        padding-left: 3.5rem;
    }
    
    .recipe-steps li::before,
    .steps-list li::before {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
        left: 0.75rem;
    }
}

.recipe-nutrition {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.nutrition-item {
    text-align: center;
    padding: 0.5rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.nutrition-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary);
}

.nutrition-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
}

/* Rating Stars */
.rating {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.star {
    cursor: pointer;
    color: var(--muted-foreground);
    transition: color 0.2s;
    font-size: 1.25rem;
}

.star:hover,
.star.active {
    color: #FBBF24; /* Amarelo para estrelas */
}

.star.filled {
    color: #FBBF24;
}

/* Search */
.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.search-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filter-select {
    flex: 1;
    min-width: 150px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
}

.recipe-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.recipe-search-item {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.recipe-search-item:hover {
    background: var(--accent);
    border-color: var(--primary);
}

.recipe-search-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.recipe-search-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Shopping List */
.shopping-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.shopping-item:last-child {
    border-bottom: none;
}

.shopping-item input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary);
}

.shopping-item.checked span {
    text-decoration: line-through;
    color: var(--muted-foreground);
}

/* Kitchen Timer */
.kitchen-timer {
    text-align: center;
}

.timer-display {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

.timer-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.timer-controls input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.875rem;
}

.timer-presets {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--muted-foreground);
}

/* Responsive Mobile */
@media (max-width: 768px) {
    /* Modal adaptações mobile */
    .modal {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        margin: 0;
        border-radius: 1rem 1rem 0 0;
        animation: slideUpMobile 0.3s ease-out;
    }
    
    /* Mostrar handle bar em mobile */
    .modal-content::before {
        display: block;
    }
    
    .modal-large {
        max-width: 100%;
    }
    
    .modal-content > h2 {
        padding: 1.25rem 1rem 0.75rem 1rem;
        font-size: 1.25rem;
    }
    
    .modal-content > .close {
        top: 1rem;
        right: 1rem;
        font-size: 1.75rem;
        width: 2.5rem;
        height: 2.5rem;
        z-index: 20;
        touch-action: none;
        pointer-events: auto;
    }
    
    .modal-content .modal-body {
        max-height: calc(90vh - 80px);
    }
    
    /* Espaçamento mobile para conteúdo dos modais */
    .modal-content .search-filters,
    .modal-content .recipe-search-results,
    .modal-content #shopping-list-content,
    .modal-content #kitchen-timer-content,
    .modal-content #meal-history-content,
    .modal-content #notifications-content,
    .modal-content #recipe-content {
        padding: 0 1rem 1.5rem 1rem;
    }
    
    /* Lista de Compras Mobile */
    #shopping-list-content {
        padding: 0 1rem 1.5rem 1rem !important;
    }
    
    #shopping-list-content > div:first-child {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    #shopping-list-content > div:first-child button {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    #shopping-list-content > div:nth-child(2) {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    #shopping-list-content > div:nth-child(2) input {
        width: 100% !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    #shopping-list-content > div:nth-child(2) button {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .shopping-item {
        padding: 1rem 0.75rem !important;
        gap: 0.75rem !important;
        flex-wrap: wrap;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius);
        margin-bottom: 0.5rem !important;
    }
    
    .shopping-item input[type="checkbox"] {
        width: 1.5rem !important;
        height: 1.5rem !important;
        flex-shrink: 0;
    }
    
    .shopping-item span:first-of-type {
        flex: 1;
        min-width: 0;
        word-break: break-word;
        font-size: 0.875rem;
    }
    
    .shopping-item span:last-of-type {
        font-size: 0.8125rem;
        color: var(--muted-foreground);
        flex-shrink: 0;
    }
    
    .shopping-item button {
        flex-shrink: 0;
        padding: 0.5rem !important;
        font-size: 1rem !important;
    }
    
    /* Receita Modal Mobile */
    .recipe-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .recipe-header h2 {
        font-size: 1.25rem !important;
        line-height: 1.3;
        word-break: break-word;
    }
    
    .recipe-actions {
        align-self: flex-end;
        margin-bottom: 0;
    }
    
    .recipe-info {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.8125rem;
        margin-bottom: 0.75rem;
    }
    
    .recipe-info span {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .recipe-rating-section,
    .recipe-portions-section,
    .recipe-notes-section {
        margin: 0.75rem 0 !important;
        padding: 0.75rem !important;
    }
    
    .recipe-rating-section label,
    .recipe-portions-section label,
    .recipe-notes-section label {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
    
    .star-rating {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .star-rating .star {
        font-size: 1.75rem !important;
    }
    
    .recipe-portions-section > div {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .recipe-portions-section > div > span:last-child {
        width: 100%;
        text-align: center;
        margin-left: 0 !important;
        margin-top: 0.25rem;
    }
    
    .recipe-notes-section textarea {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
    
    .recipe-notes-section > div {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .recipe-notes-section button {
        width: 100%;
    }
    
    .recipe-section h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .ingredients-list li,
    .recipe-ingredients li {
        padding: 0.875rem 0.75rem !important;
        font-size: 0.875rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .ingredients-list li span:first-child,
    .recipe-ingredients li span:first-child {
        font-weight: 500;
    }
    
    .ingredients-list li strong,
    .recipe-ingredients li strong {
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }
    
    .steps-list li,
    .recipe-steps li {
        padding: 0.875rem 0.75rem 0.875rem 3rem !important;
        font-size: 0.875rem;
        line-height: 1.6;
    }
    
    .steps-list li::before,
    .recipe-steps li::before {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
        left: 0.5rem;
    }
    
    /* Dropdown Menu Mobile */
    .dropdown-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 1rem 1rem 0 0;
        min-width: auto;
        max-height: 70vh;
        overflow-y: auto;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
        animation: slideUpMobile 0.3s ease-out;
        z-index: 1000;
        padding-top: 1rem;
        touch-action: pan-y;
        will-change: transform;
        transform: translateZ(0);
    }
    
    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: 0.5rem;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }
    
    .dropdown-item {
        padding: 1rem 1.25rem;
        font-size: 1rem;
        min-height: 48px;
        display: flex;
        align-items: center;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .dropdown-item:active {
        background: var(--accent);
    }
    
    .dropdown-separator {
        margin: 0.5rem 0;
    }
    
    /* Prevenir scroll quando dropdown está aberto em mobile */
    body.dropdown-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    /* Overlay para fechar dropdown em mobile */
    .dropdown-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        animation: fadeIn 0.2s ease-out;
        display: none;
    }
    
    .dropdown-overlay.show {
        display: block;
    }
}

@keyframes slideUpMobile {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .planner-header .header-content {
        flex-direction: column;
    }
    
    .planner-header .header-actions {
        width: 100%;
    }
    
    .week-grid {
        grid-template-columns: 1fr;
    }
    
    .recipe-nutrition {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
