:root {
    --app-bg: #121212;
    --app-card: #1E1E1E;
    --input-bg: #2C2C2C;
    --brand-color: #C5E01E;
    --text-main: #FFFFFF;
    --text-sec: #888888;
    
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    --nav-base-height: 70px;
    --nav-height: calc(var(--nav-base-height) + var(--safe-bottom));

    --header-home-base: 140px;
    --header-home-height: calc(var(--header-home-base) + var(--safe-top));

    --header-details-base: 80px;
    --header-details-height: calc(var(--header-details-base) + var(--safe-top));
}

html, body {
    margin: 0; padding: 0;
    background-color: var(--app-bg);
    color: var(--text-main);
    font-family: -apple-system, system-ui, sans-serif;
    overflow: hidden; height: 100%;
    padding-top: env(safe-area-inset-top); 
}

/* --- LOGO --- */
.splash-logo { display: flex; justify-content: center; align-items: center; }
.app-logo-img { width: 200px; height: auto; display: block; }
.auth-logo-footer { margin-top: 40px; text-align: center; opacity: 0.8; }
.app-logo-img-small { width: 100px; height: auto; display: block; margin: 0 auto; }

/* --- VIEWS --- */
.app-view { display: none !important; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--app-bg); z-index: 10; overflow: hidden; }
.active-view { display: flex !important; flex-direction: column; z-index: 20; }
#view-home.active-view, #view-ingredientes.active-view, #view-cozinha.active-view, #view-details.active-view, #view-nova-receita.active-view { display: block !important; }

/* --- AUTH --- */
.auth-view { padding: 30px; box-sizing: border-box; justify-content: center; }
.auth-container { width: 100%; max-width: 400px; margin: 0 auto; }
.auth-title { color: var(--text-main); font-size: 24px; text-align: center; margin-bottom: 30px; font-weight: 700; }
.auth-input-group { position: relative; margin-bottom: 16px; background: #2C2C2C; border-radius: 12px; display: flex; align-items: center; padding: 0 15px; height: 56px; border: 1px solid transparent; transition: border-color 0.3s; }
.auth-input-group:focus-within { border-color: var(--brand-color); }
.auth-input-group input { background: transparent !important; border: none; color: white !important; font-size: 16px; width: 100%; height: 100%; outline: none; padding-left: 10px; box-shadow: none !important; }
.input-icon { color: white; font-size: 20px; }
.toggle-pass { color: #888; cursor: pointer; font-size: 20px; }
.btn-primary { width: 100%; height: 56px; background-color: var(--brand-color); color: #000; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 20px; }
.btn-outline { width: 100%; height: 56px; background: transparent; color: var(--brand-color); border: 1px solid var(--brand-color); border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 15px; }
.auth-footer { text-align: center; margin-top: 20px; }
.auth-link { color: white; text-decoration: underline; font-size: 14px; cursor: pointer; display: block; margin-bottom: 15px; }

/* --- HEADER --- */
.app-header { position: fixed; top: 0; left: 0; right: 0; background-color: rgba(18, 18, 18, 0.95); backdrop-filter: blur(15px); z-index: 100; border-bottom: 1px solid #222; padding-top: calc(10px + var(--safe-top)); padding-bottom: 10px; padding-left: 20px; padding-right: 20px; }
.home-header { height: var(--header-home-height); display: flex; flex-direction: column; justify-content: flex-end; box-sizing: border-box; }
.details-header { height: var(--header-details-height); display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; }
.header-search-area { position: absolute; top: calc(15px + var(--safe-top)); left: 20px; right: 20px; background-color: var(--input-bg); border-radius: 12px; display: flex; align-items: center; padding: 10px 15px; border: 1px solid transparent; }
.header-search-area:focus-within { border-color: var(--brand-color); }
.search-icon { color: var(--text-sec) !important; margin-right: 10px; font-size: 20px; }
#app-search-input, #app-ing-search-input, #app-pub-search-input { background: transparent; border: none; color: white; font-size: 16px; width: 100%; outline: none; }
.header-title-area { margin-top: auto; padding-bottom: 5px; }
.header-row-flex { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.header-left-group { display: flex; align-items: center; gap: 15px; }
.header-text-group { display: flex; flex-direction: column; }
.home-header h1 { margin: 0; font-size: 22px; color: var(--brand-color); font-weight: 700; line-height: 1.2; }
.header-counter { font-size: 13px; color: var(--text-sec); margin-top: 2px; }
.header-fav-trigger { background: transparent; border: none; width: 24px; height: 40px; padding: 0; color: var(--text-sec) !important; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-right: 5px; }
.header-fav-trigger span { font-size: 28px; line-height: 1; }
.header-fav-trigger.is-active { color: var(--brand-color) !important; }
.header-fav-trigger.is-active span { font-variation-settings: 'FILL' 1; }
.header-action-btn { background-color: var(--brand-color); color: #000; width: 40px; height: 40px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.header-action-btn span { font-size: 28px; font-weight: 700; line-height: 1; }
.icon-btn { background: none; border: none; color: var(--text-main); cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; }
#btn-detail-fav { color: var(--text-sec); transition: color 0.2s; }
#btn-detail-fav .material-symbols-rounded { font-size: 24px; }

/* --- CONTENT --- */
.app-content { position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: auto; padding: 20px; }
.app-content.has-bottom-nav { top: var(--header-home-height); padding-bottom: 120px; }
.app-content.no-bottom-nav { padding-top: calc(var(--header-details-height) + 20px); padding-bottom: 40px; }
.app-card-item { display: flex; align-items: center; padding: 18px 0; border-bottom: 1px solid #222; cursor: pointer; position: relative; gap: 15px; }
.app-card-left-icon { font-size: 24px; color: #444; display: flex; align-items: center; justify-content: center; min-width: 24px; }
.app-card-left-icon.edit-ing-trigger { color: var(--brand-color); }
.app-card-left-icon.app-card-fav-btn.is-active, .app-card-left-icon.pub-fav-trigger.is-active { color: var(--brand-color); font-variation-settings: 'FILL' 1, 'wght' 400; }
.app-card-body { flex-grow: 1; } 
.app-card-body h3 { margin: 0; font-size: 17px; font-weight: 400; color: var(--text-main); }
.app-card-right-icon { color: var(--brand-color); font-size: 24px; display: flex; align-items: center; justify-content: center; min-width: 24px; }
.app-loader-style { text-align: center; padding: 20px; font-size: 14px; color: var(--text-sec); }

/* --- NAV --- */
.app-bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-height); background: #161616; border-top: 1px solid #222; display: flex; z-index: 90; padding-bottom: calc(15px + env(safe-area-inset-bottom)); box-sizing: border-box; }
#view-splash.active-view ~ .app-bottom-nav, #view-login.active-view ~ .app-bottom-nav, #view-register.active-view ~ .app-bottom-nav, #view-recovery.active-view ~ .app-bottom-nav, #view-details.active-view ~ .app-bottom-nav, #view-nova-receita.active-view ~ .app-bottom-nav { display: none !important; }
.nav-item { background: transparent; border: none; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-sec); font-size: 11px; border-top: 3px solid transparent; transition: all 0.2s; }
.nav-item.active { color: var(--brand-color); border-top-color: var(--brand-color); }
.nav-item .material-symbols-rounded { font-size: 28px; margin-bottom: 4px; }

/* --- CALC & INGREDIENTES --- */
.calculadora-app { padding-bottom: 40px; }
.calc-input-group, .calc-summary, .calc-cost-card { background: var(--app-card); padding: 20px; border-radius: 16px; margin-bottom: 16px; border: 1px solid #2C2C2C; transition: border-color 0.3s ease; }
.calc-input-group:focus-within { border-color: var(--brand-color); }
.calc-input-group label { display: block; color: var(--text-sec); font-size: 11px; font-weight: 700; margin-bottom: 10px; letter-spacing: 0.5px; text-transform: uppercase; }
.input-wrapper { display: flex; align-items: baseline; gap: 10px; }
.base-input { background: transparent; border: none; color: var(--brand-color); font-size: 32px; font-weight: 700; width: 100%; outline: none; padding: 0; z-index: 10; position: relative; }
.input-wrapper span { color: var(--text-sec); font-size: 20px; font-weight: 500; }
.calc-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.calc-table th { text-align: left; color: var(--text-sec); font-size: 11px; padding: 10px 0; border-bottom: 1px solid #2C2C2C; }
.calc-table th.txt-right { text-align: right; }
.calc-table td { padding: 12px 0; border-bottom: 1px solid #222; }
.ing-check { width: 20px; height: 20px; border: 2px solid #555; border-radius: 4px; background: transparent; margin-right: 10px; appearance: none; -webkit-appearance: none; cursor: pointer; position: relative; }
.ing-check:checked { background-color: var(--brand-color); border-color: var(--brand-color); }
.ing-check:checked::after { content: '✔'; font-size: 14px; color: #000; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.ing-name { font-size: 16px; color: var(--text-main); }
.ing-item-price { font-size: 14px; color: var(--text-sec); margin-top: 4px; font-weight: 500; }
.txt-right { text-align: right; }
.peso-val { font-weight: 600; color: var(--text-main); font-size: 16px; }
.is-base .peso-val { color: var(--brand-color); }
.calc-summary { display: flex; justify-content: space-between; align-items: center; }
.summary-label, .cost-label { color: var(--text-sec); font-size: 14px; font-weight: 500; }
.summary-value, .cost-value { color: var(--brand-color); font-size: 24px; font-weight: 700; }
.cost-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cost-row:last-child { margin-bottom: 0; }
.calc-notes { background: #1A1A1A; padding: 20px; border-radius: 16px; border: 1px solid #2C2C2C; }
.calc-notes h3 { margin-top: 0; font-size: 13px; color: var(--brand-color); margin-bottom: 12px; }
.calc-notes p { margin: 0; font-size: 14px; line-height: 1.6; color: #CCC; }
.app-input-box { background: #2C2C2C; border: 1px solid #444; border-radius: 8px; color: var(--brand-color); font-weight: 700; font-size: 16px; width: 70px; text-align: center; padding: 6px 4px; outline: none; transition: all 0.2s ease; }
.app-input-box:focus { border-color: var(--brand-color); background: #222; }
.calc-grouped-card { background: var(--app-card); border: 1px solid #2C2C2C; border-radius: 16px; margin-top: 20px; overflow: hidden; }
.calc-row { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.calc-row:last-child { border-bottom: none; }
.calc-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: white; margin-right: 15px; }
.calc-icon span { font-size: 24px; }
.calc-info { flex-grow: 1; display: flex; flex-direction: column; }
.calc-label { font-size: 16px; color: #888; font-weight: 400; }
.calc-sub-value { font-size: 14px; color: white; font-weight: 700; margin-top: 4px; }
.calc-value-area { text-align: right; }
.calc-highlight-value { font-size: 20px; color: var(--brand-color); font-weight: 700; }
.calc-notes-card { background: var(--app-card); border: 1px solid #2C2C2C; border-radius: 16px; padding: 20px; margin-top: 15px; }
.calc-notes-text { font-size: 14px; color: #ccc; margin: 8px 0 0 0; line-height: 1.5; }

/* --- AJUSTES & PERFIL --- */
.settings-profile-card { background: var(--app-card); border-radius: 16px; padding: 20px; display: flex; align-items: center; margin-bottom: 30px; border: 1px solid #2C2C2C; }
.profile-avatar { width: 50px; height: 50px; background: #333; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 15px; color: var(--brand-color) !important; background-color: rgba(197, 224, 30, 0.1) !important; border: 1px solid rgba(197, 224, 30, 0.2); }
.profile-avatar span { font-size: 28px; }
.profile-info h3 { margin: 0; font-size: 18px; color: var(--brand-color) !important; font-weight: 600; }
.profile-info span { font-size: 14px; color: var(--text-sec); }
.settings-group { margin-top: 20px; }
.logout-btn { border-color: #ff4444 !important; color: #ff4444 !important; display: flex; align-items: center; justify-content: center; gap: 10px; }
.settings-menu { background: var(--app-card); border-radius: 16px; overflow: hidden; border: 1px solid #2C2C2C; }
.settings-item { width: 100%; background: transparent; border: none; border-bottom: 1px solid #2C2C2C; padding: 18px 20px; display: flex; align-items: center; cursor: pointer; text-align: left; transition: background 0.2s; color: var(--text-main); font-size: 16px; }
.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: rgba(255,255,255,0.05); }
.item-icon { font-size: 24px; color: var(--text-sec); margin-right: 15px; }
.item-label { flex-grow: 1; font-weight: 500; }
.item-arrow { color: #444; font-size: 20px; }
.settings-header { height: 80px; display: flex; align-items: center; justify-content: center; padding: 0 20px; box-sizing: border-box; }
.settings-header h1 { font-size: 18px; font-weight: 700; color: var(--text-main); margin: 0; }
.settings-logout-container { margin-top: 20px; background: var(--app-card); border-radius: 16px; border: 1px solid #2C2C2C; overflow: hidden; }
.btn-logout-block { width: 100%; background: transparent; border: none; padding: 18px; color: #ff4444; font-size: 16px; font-weight: 500; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: background 0.2s; }
.btn-logout-block:active { background: rgba(255, 68, 68, 0.1); }

/* --- MODAIS & OVERLAYS --- */
.app-modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.2); z-index: 2000; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.app-modal-card { background: #1E1E1E; width: 100%; max-width: 350px; padding: 25px; border-radius: 20px; border: 1px solid #333; box-shadow: 0 10px 30px rgba(0,0,0,0.8); animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- LISTA DE SELEÇÃO --- */
.select-ing-item { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid #333; cursor: pointer; gap: 15px; }
.select-ing-item:active { background: #333; }
.select-ing-item .material-symbols-rounded { color: #666; font-size: 24px; display: flex; align-items: center; justify-content: center; }
.select-ing-item h4 { margin: 0; color: white; font-weight: 400; font-size: 16px; line-height: 1.2; }

/* --- OUTROS --- */
.fab-btn { display: none !important; }
.swiping-left { transform: none !important; background-color: transparent !important; border-color: #222 !important; }

/* --- NOVA RECEITA (SPRINT 1.59: SESSÕES E UX) --- */
.new-rec-table-header { display: grid; grid-template-columns: 10% 25% 55% 10%; align-items: center; padding: 0 0 10px 0; border-bottom: 1px solid #333; margin-bottom: 10px; font-size: 11px; font-weight: 700; color: var(--text-sec); text-transform: uppercase; letter-spacing: 0.5px; }
.new-rec-ing-row { display: grid !important; grid-template-columns: 10% 25% 55% 10%; align-items: center; background: transparent !important; padding: 12px 0; border-bottom: 1px solid #222; margin-bottom: 0; }
.drag-handle { cursor: grab; color: #555; display: flex; justify-content: center; align-items: center; }
.drag-handle:active { cursor: grabbing; color: var(--brand-color); }
.ing-weight-box { background: #2C2C2C; border: 1px solid #444; border-radius: 8px; color: var(--brand-color); font-weight: 700; font-size: 16px; text-align: center; width: 90%; margin: 0 auto; outline: none; padding: 8px 0; display: block; }
.ing-weight-box:focus { border-color: var(--brand-color); }
.ing-name-wrapper { padding-left: 10px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.new-rec-ing-name-display { font-size: 16px; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-subtitle { font-size: 11px; color: var(--brand-color); margin-top: 2px; display: none; }
.new-rec-ing-row.is-first .ing-subtitle { display: block; }
.new-rec-ing-row.is-first .drag-handle { color: var(--brand-color); }
.btn-remove-ing { color: #ff4444; cursor: pointer; font-size: 20px; text-align: center; }
.clean-input-title { background: transparent; border: none; font-size: 28px; font-weight: 700; color: var(--brand-color); width: 100%; outline: none; padding: 0; }
.clean-input-title::placeholder { color: #444; }
.clean-textarea { background: #1A1A1A; border: 1px solid #333; border-radius: 12px; padding: 15px; font-size: 16px; color: #CCC; width: 100%; min-height: 120px; font-family: inherit; outline: none; box-sizing: border-box; }
.clean-textarea:focus { border-color: var(--brand-color); }
.sortable-ghost { opacity: 0.4; background-color: #333 !important; }
.btn-delete-danger { width: 100%; background-color: #D32F2F; color: white; border: none; border-radius: 12px; padding: 15px; font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 30px; cursor: pointer; transition: background 0.2s; }
.btn-delete-danger:active { background-color: #B71C1C; }
.btn-delete-danger .material-symbols-rounded { font-size: 20px; }

/* Botões de Ação Duplos (Sessão / Ingrediente) */
.btn-dark-action { flex: 1; background: #2C2C2C; color: white; border: 1px solid #444; border-radius: 12px; height: 50px; font-weight: 600; font-size: 16px; cursor: pointer; transition: background 0.2s; }
.btn-dark-action:active { background: #444; }
.btn-brand-action { flex: 1; background: var(--brand-color); color: black; border: none; border-radius: 12px; height: 50px; font-weight: 700; font-size: 16px; cursor: pointer; transition: opacity 0.2s; }
.btn-brand-action:active { opacity: 0.8; }

/* LINHA DE SESSÃO (EDITOR) */
.rec-section-row { 
    display: flex !important; 
    align-items: center; 
    gap: 10px; 
    background: #1A1A1A !important; 
    padding: 10px; 
    border-radius: 8px; 
    margin-bottom: 5px; 
    border: 1px solid #333; 
}
.section-input { 
    flex-grow: 1; 
    background: transparent; 
    border: none; 
    color: var(--brand-color); 
    font-weight: 700; 
    font-size: 16px; 
    text-align: center; 
    outline: none; 
}
.section-input::placeholder { color: #555; }

/* LINHA DE SESSÃO (CALCULADORA) */
.calc-section-header td { 
    text-align: center; 
    padding: 20px 0 10px 0 !important; 
    color: var(--brand-color); 
    font-weight: 700; 
    font-size: 16px; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    border-bottom: none !important; 
}

/* --- EMPTY STATES --- */
.empty-state-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    height: 60vh;
    width: 100%;
    box-sizing: border-box;
}

.empty-icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #2C2C2C;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Círculo com Destaque (Ex: Despensa Vazia) */
.empty-icon-circle.highlight {
    background-color: rgba(197, 224, 30, 0.1); 
    border: 1px solid rgba(197, 224, 30, 0.2);
}
.empty-icon-circle.highlight span {
    color: var(--brand-color);
}

/* Círculo com Borda da Marca (Ex: Tudo Pronto) */
.empty-icon-circle.brand {
    background-color: transparent;
    border: 2px solid var(--brand-color);
}
.empty-icon-circle.brand span {
    color: var(--brand-color);
}

.empty-icon-circle span {
    font-size: 40px;
    color: #666;
}

.empty-state-wrapper h3 {
    font-size: 20px;
    color: var(--text-main);
    margin: 0 0 10px 0;
    font-weight: 700;
}

.empty-state-wrapper p {
    font-size: 15px;
    color: var(--text-sec);
    line-height: 1.5;
    max-width: 280px;
    margin: 0 auto 25px auto;
}

/* Botão de Ação no Empty State */
.empty-action-btn {
    width: auto !important;
    padding: 0 30px !important;
    height: 48px !important;
    border-radius: 24px !important;
    font-size: 14px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: var(--brand-color);
    color: #000;
    border: none;
    font-weight: 700;
    cursor: pointer;
}

/* Seta Animada */
.arrow-hint-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-sec);
    margin-top: 30px;
    font-size: 12px;
}

.empty-state-wrapper .arrow-bounce {
    font-size: 24px;
    color: var(--brand-color);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* --- TOGGLE SWITCH --- */
.cz-toggle-card { background: #1A1A1A; border: 1px solid #333; border-radius: 12px; padding: 15px; display: flex; align-items: center; margin-top: 20px; justify-content: space-between; }
.cz-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.cz-switch input { opacity: 0; width: 0; height: 0; }
.cz-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .4s; }
.cz-slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .cz-slider { background-color: var(--brand-color); }
input:checked + .cz-slider:before { transform: translateX(22px); }
.cz-slider.round { border-radius: 34px; }
.cz-slider.round:before { border-radius: 50%; }