:root {
    --cor-modal: #ffffff;
    --cor-modal-texto: #26640b;
    --cor-modal-card: #ecf8ea;
    --cor-modal-borda: #cccccc;
    --cor-modal-img-bg: #f3ffee;
    --cor-modal-perigo: #a32020;
}

body.modo-escuro {
    --cor-modal: #2c2c2c;
    --cor-modal-texto: #ffffff;
    --cor-modal-card: #3a3a3a;
    --cor-modal-borda: #555555;
    --cor-modal-img-bg: #1e1e1e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #eef6e9;
    color: #26640b;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 20px 80px 20px;
}

.blog-header {
    margin-bottom: 24px;
    width: 100%;
}

.search-bar {
    background-color: #26640b;
    border-radius: 30px;
    display: flex;
    align-items: center;
    padding: 5px 15px;
    margin-bottom: 16px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: white;
    padding: 12px 5px;
    font-size: 16px;
    width: 100%;
    outline: none;
}

.search-bar input::placeholder {
    color: #d4e8c9;
}

.search-bar button {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.tags-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
}

.tags-container::-webkit-scrollbar {
    display: none;
}

.tag {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.tag-reciclagem {
    background-color: #7dd23c;
    color: white;
}

.tag-upcycling {
    background-color: #e9c4f5;
    color: white;
}

.tag-educacao {
    background-color: #316d1a;
    color: white;
}

.tag-noticias {
    background-color: #d83434;
    color: white;
}

.blog-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
}

.card-image-wrapper img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 16px;
    display: block;
}

.heart-icon {
    position: absolute;
    top: 14px;
    left: 14px;
    color: #d83434;
    font-size: 22px;
    filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.5));
    cursor: pointer;
}

.card .card-image-wrapper img.heart-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 0;
}

.heart-icon:active {
    transform: scale(1.2);
}

.card-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 4px;
}

.card-info h2 {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.ellipsis-icon {
    font-size: 20px;
    color: #26640b;
    cursor: pointer;
    padding-left: 12px;
}

.card-grid-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.card-half .card-image-wrapper img {
    height: 160px;
}

.card-half .card-info h2 {
    font-size: 15px;
}

.menu-inferior {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    background-color: #f6fdf2;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 14px 0;
    z-index: 999;
}

.item-menu {
    display: block;
}

.item-menu img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Modal (igual ao perfil) */
@keyframes abrirModal {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

body.sem-rolagem {
    overflow: hidden;
}

.overlay-escondido {
    display: none !important;
}

#modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 9999;
}

.modal-caixa {
    background-color: var(--cor-modal);
    color: var(--cor-modal-texto);
    width: 100%;
    max-width: 540px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px;
    border-radius: 22px;
    border: 1px solid rgba(38, 100, 11, 0.15);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: abrirModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

body.modo-escuro .modal-caixa {
    border-color: rgba(255, 255, 255, 0.1);
}

.modal-caixa::-webkit-scrollbar {
    width: 6px;
}

.modal-caixa::-webkit-scrollbar-thumb {
    background-color: rgba(38, 100, 11, 0.3);
    border-radius: 10px;
}

.modal-caixa h2 {
    margin: 0 40px 16px 0;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--cor-modal-borda);
}

.modal-caixa img {
    width: 100%;
    max-height: 280px;
    height: auto;
    object-fit: cover;
    background-color: var(--cor-modal-img-bg);
    border-radius: 14px;
    margin: 12px 0 18px 0;
    display: block;
}

.modal-caixa p {
    font-size: 15px;
    line-height: 1.65;
    text-align: justify;
    white-space: pre-line;
    margin: 0;
}

#fechar-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: var(--cor-modal-card);
    color: var(--cor-modal-texto);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

#fechar-modal:hover {
    background-color: var(--cor-modal-perigo);
    color: #ffffff;
    transform: rotate(90deg);
}

/* Desktop / Tablet */
@media (min-width: 768px) {
    body {
        max-width: 900px;
        padding: 60px 20px 80px 20px;
        margin: 0 auto;
    }

    .blog-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 30px;
    }

    .search-bar {
        width: 100%;
        max-width: 600px;
        margin: 0 auto 20px auto;
    }

    .tags-container {
        justify-content: center;
        flex-wrap: wrap;
    }

    .blog-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .card-full {
        grid-column: span 2;
    }

    .card-full .card-image-wrapper img {
        height: 220px;
    }

    .card-grid-half {
        grid-column: span 2;
        gap: 24px;
    }

    .card-half .card-image-wrapper img {
        height: 220px;
    }

    .card-info h2 {
        font-size: 18px;
    }

    .card-half .card-info h2 {
        font-size: 16px;
    }
}