/* Reset and Base Styles */
:root {
    --bg-color: #F8F5E6; /* Pale yellow from image */
    --card-bg: #FFFFFF;
    --text-main: #2D2D2A;
    --text-muted: #7A7A75;
    --primary-orange: #E67E22;
    --primary-dark: #D35400;
    --gradient-orange: linear-gradient(135deg, #F39C12, #D35400);
    --border-radius: 20px;
    --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 25px rgba(211, 84, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 80px; /* Space for fixed header */
}

/* Utilities */
.text-center { text-align: center; }
.hidden { display: none !important; }
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.gradient-orange {
    background: var(--gradient-orange);
    color: white;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.brand-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.btn-favorites {
    background: transparent;
    border: 2px solid var(--primary-orange);
    color: var(--primary-orange);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-favorites:hover {
    background: var(--primary-orange);
    color: white;
}

.btn-save-recipe {
    background: white;
    border: 2px solid white;
    color: var(--primary-orange);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-save-recipe:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.02);
}

.btn-save-recipe.active {
    background: transparent;
    color: white;
    border-color: white;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Hero Section */
.hero-section {
    margin-bottom: 30px;
}

.badge {
    display: inline-block;
    background: rgba(230, 126, 34, 0.15);
    color: var(--primary-dark);
    padding: 6px 16px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.main-title {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
    color: #2c2d28;
}

.slogan {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Input Section */
.input-section {
    margin-bottom: 30px;
}

.input-section h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.suggestions-section {
    margin-bottom: 30px;
}

.btn-suggestions {
    background: transparent;
    border: 2px solid var(--primary-orange);
    color: var(--primary-orange);
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-suggestions:hover {
    background: var(--primary-orange);
    color: white;
}

.suggestions-cloud {
    margin-top: 30px;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-tag {
    background-color: #F2F2F2;
    color: #666;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: calc(0.9rem - 2px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.suggestion-tag:hover {
    background-color: #e2e2e2;
}

.suggestion-tag.selected {
    background-color: rgba(230, 126, 34, 0.15);
    color: var(--primary-dark);
    border: 1px solid rgba(230, 126, 34, 0.3);
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 20px;
}

textarea {
    width: 100%;
    border: 2px solid #EBE9DF;
    border-radius: 15px;
    padding: 15px;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: border-color 0.3s ease;
    background-color: #FAFAFA;
    overflow-y: hidden;
    min-height: 110px;
}

textarea:focus {
    border-color: var(--primary-orange);
    background-color: #FFF;
}

.btn-primary {
    width: 100%;
    background: var(--gradient-orange);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.btn-primary:hover {
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Microphone Button */
.btn-mic, #btn-voz {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--bg-color);
    color: var(--primary-orange);
    border: 1px solid #EBE9DF;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.btn-mic:hover, #btn-voz:hover {
    background: var(--primary-orange);
    color: white;
    transform: scale(1.05);
}

.btn-mic.recording, .btn-mic.gravando, #btn-voz.recording, #btn-voz.gravando {
    background: #E74C3C;
    color: white;
    border-color: #E74C3C;
    animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Loading State */
.loading-section {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(230, 126, 34, 0.2);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-section p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.loading-subtext {
    font-size: 0.9rem;
    font-weight: 400 !important;
    color: var(--text-muted) !important;
    margin-top: 5px;
}

/* Result Section */
.recipe-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
}

.recipe-header {
    padding: 25px 25px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.recipe-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
}

.actions-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.share-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    right: -10px;
    background-color: #0CB7D6;
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(12, 183, 214, 0.3);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.share-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.share-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 52px;
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #0CB7D6 transparent transparent transparent;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.share-copy { background: rgba(255, 255, 255, 0.9); color: #333; }
.share-whatsapp { background: #25D366; color: white; }
.save-favorite { background: rgba(255, 255, 255, 0.9); color: #333; }
.save-favorite.active { color: #E74C3C; }

.recipe-content {
    padding: 25px;
}

/* Markdown styling within recipe */
.recipe-content h1, .recipe-content h2, .recipe-content h3 {
    color: var(--primary-dark);
    margin: 25px 0 15px;
    position: relative;
    padding-bottom: 5px;
}

.recipe-content h1 { font-size: 1.8rem; margin-top: 0; }
.recipe-content h2 { font-size: 1.3rem; border-bottom: 2px solid #f0f0f0; display: inline-block; padding-bottom: 5px; }

.recipe-content p {
    margin-bottom: 15px;
}

.recipe-content ul, .recipe-content ol {
    margin: 0 0 20px 20px;
}

.recipe-content li {
    margin-bottom: 10px;
}

.recipe-content strong {
    color: #444;
}

/* Format specifically lists or blockquotes generated in the markdown */
.recipe-content ol {
    list-style-type: none;
    counter-reset: step-counter;
    margin-left: 0;
}

.recipe-content ol li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 45px;
    margin-bottom: 20px;
    min-height: 30px;
}

.recipe-content ol li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: -2px;
    width: 30px;
    height: 30px;
    background-color: var(--primary-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 3px 8px rgba(230, 126, 34, 0.3);
}

/* Recipe Footer & Back Button */
.recipe-footer {
    padding: 0 25px 25px;
    text-align: center;
}

.btn-outline {
    background: transparent;
    color: var(--primary-dark);
    border: 2px solid var(--primary-orange);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.btn-outline:hover {
    background: rgba(230, 126, 34, 0.1);
}

/* Dynamic HTML elements from Gemini API */
.rendimento-card {
    background-color: #FDFBF0;
    border: 1px solid #F0ECE1;
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rendimento-info {
    flex: 1;
}

.rendimento-label {
    display: block;
    color: #CBA052;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.rendimento-texto {
    font-size: 1.2rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 0 !important;
}

.ingredientes-rodape {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 10px;
}

.ingredientes-label {
    color: #A0A09C;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 15px !important;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.tag {
    background-color: #F2F2F2;
    color: #666;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: flex-end; /* Slide from right */
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(3px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    height: 100%;
    background: var(--bg-color);
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease forwards;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.modal.hidden .modal-content {
    animation: slideOut 0.3s ease forwards;
}

.modal-header {
    padding: 20px;
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ebebeb;
}

.modal-header h2 {
    font-size: 1.2rem;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.favorite-item {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.favorite-title {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
    font-size: 1.1rem;
    padding-right: 30px;
}

.favorite-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.btn-delete-fav {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

.btn-delete-fav:hover {
    color: #e74c3c;
}

.btn-view-fav {
    width: 100%;
    background: rgba(230, 126, 34, 0.1);
    color: var(--primary-dark);
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-view-fav:hover {
    background: rgba(230, 126, 34, 0.2);
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
}

.empty-state i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
}

/* ── PWA BANNER (Carnes Capellari Style) ── */
#pwa-banner {
    position: fixed;
    bottom: -160px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 420px;
    background: var(--card-bg, #FFFFFF);
    border: 1px solid #EBE9DF;
    border-radius: var(--border-radius, 20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(230, 126, 34, 0.15);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 400;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#pwa-banner.show {
    bottom: 24px;
}

.pwa-icone {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #EBE9DF;
}

.pwa-texto {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text-muted, #7A7A75);
    line-height: 1.35;
    font-family: 'Outfit', sans-serif;
}

.pwa-texto strong {
    display: block;
    font-size: 0.98rem;
    color: var(--text-main, #2D2D2A);
    margin-bottom: 3px;
    font-weight: 700;
}

.pwa-acoes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.btn-pwa-instalar {
    background: var(--gradient-orange, linear-gradient(135deg, #F39C12, #D35400));
    color: #FFFFFF;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 10px rgba(211, 84, 0, 0.25);
    transition: all 0.2s;
    text-align: center;
}

.btn-pwa-instalar:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 15px rgba(211, 84, 0, 0.35);
}

.btn-pwa-instalar:active {
    transform: scale(0.98);
}

.btn-pwa-fechar {
    background: transparent;
    color: var(--text-muted, #7A7A75);
    border: none;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
    font-family: 'Outfit', sans-serif;
    transition: color 0.2s;
    text-align: center;
}

.btn-pwa-fechar:hover {
    color: var(--text-main, #2D2D2A);
}

/* Accordion Sugestões */
.category-header {
    background-color: #f9f9f9;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    border: 1px solid #eee;
}
.category-header:hover {
    background-color: #f0f0f0;
}
.category-header.active {
    background-color: #fff3e6;
    border-color: var(--primary-orange);
    color: var(--primary-dark);
}
.category-header i {
    transition: transform 0.3s;
}
.category-header.active i {
    transform: rotate(180deg);
}
.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 5px;
}
.category-content.expanded {
    max-height: 1000px; /* large enough to fit content */
    margin-bottom: 12px;
}
.suggestions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 5px 0 10px;
}
.suggestion-item {
    background: #fff;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.suggestion-item:hover {
    background: var(--primary-orange);
    color: white;
    border-color: var(--primary-orange);
}

/* --- Offers Carousel --- */
.offers-carousel-section {
    margin: 70px 0 40px 0;
    width: 100%;
}

.offers-title {
    margin-bottom: 20px;
    font-size: 1.05rem;
    color: var(--text-main);
    font-weight: 700;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
}

.carousel-btn {
    position: absolute;
    top: calc(50% - 7.5px);
    transform: translateY(-50%);
    background: var(--card-bg);
    border: 1px solid #ddd;
    color: var(--primary-orange);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: none; /* Hidden on mobile by default */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    z-index: 10;
}

.carousel-btn:hover {
    background: #f0f0f0;
}

.prev-btn {
    left: -15px;
}

.next-btn {
    right: -15px;
}

.carousel-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding-bottom: 15px;
    
    /* Esconder scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.carousel-container::-webkit-scrollbar {
    display: none;
}

.carousel-item {
    flex: 0 0 27%;
    scroll-snap-align: start;
	border-radius: 10px;
    text-decoration: none;
    display: block;
    position: relative;
    box-shadow: var(--shadow-soft);
    background: var(--card-bg);
    overflow: hidden;
    transition: transform 0.2s;
}

.carousel-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 9 / 16;
}

/* WhatsApp CTA Slide */
.cta-whatsapp {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #EBE9DF;
    background: #FAFAFA;
    aspect-ratio: 9 / 16;
}

.cta-whatsapp:hover {
    border-color: #25D366;
    background: #FFF;
}

.cta-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 5px;
}

.whatsapp-icon {
    font-size: 2.2rem;
    color: #25D366;
}

/* Desktop Responsiveness */
@media (min-width: 600px) {
    .carousel-item {
        flex: 0 0 14%;
    }
    .carousel-btn {
        display: flex;
    }
    .cta-content {
        font-size: 0.75rem;
    }
    .whatsapp-icon {
        font-size: 1.8rem;
    }
}
