/* VARIÁVEIS DE COR E ESTILOS GERAIS */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;900&display=swap');
:root {
    --purple-primary: #8A19D6;     
    --purple-dark: #6900B8;        
    --purple-light: #FDF9FF;       
    --text-main: #6E6875;          
    --text-muted: #A098A8;     
    --background-color: #FFF7FD;
    --background-sidebar: #F6EAF9;
    --background-main-content: #FCF0FF;  
    --border-color: #EFEAF4;     
    --border-bottom: #D0C2D7;  
    --poppins-font: "Poppins", sans-serif;
    --font-color-subtitle-sidebar: #4D4354;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    background-color: #F8F6FC; 
    min-height: 100vh;
    font-family: var(--poppins-font);
}

/* POPPINS FONTS */
.poppins-thin { font-weight: 100; font-style: normal; }
.poppins-extralight { font-weight: 200; font-style: normal; }
.poppins-light { font-weight: 300; font-style: normal; }
.poppins-regular { font-weight: 400; font-style: normal; }
.poppins-medium { font-weight: 500; font-style: normal; }
.poppins-semibold { font-weight: 600; font-style: normal; }
.poppins-bold { font-weight: 700; font-style: normal; }
.poppins-extrabold { font-weight: 800; font-style: normal; }
.poppins-black { font-weight: 900; font-style: normal; }

/* Conteúdo Principal (Ajustado sem o Sidebar) */
.main-content {
    margin-left: 0; /* Removido o 260px do aside */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #FFF7FD;
}

.logo-link { text-decoration: none; }

/* Top Bar - Header */
.topbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--background-main-content);
    padding: 24px 40px;
    height: 70px;
    border-bottom: 1px solid var(--border-color);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.topbar-title { color: var(--purple-dark); font-size: 24px; }

.topbar-tabs {
    display: flex;
    gap: 24px;
}

.tab-item {
    text-decoration: none;
    font-size: 14px;
    color: var(--text-muted); 
    position: relative;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.tab-item:hover { color: var(--text-main); }
.tab-item.active { color: var(--purple-primary); }
.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--purple-primary);
    border-radius: 2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px; 
}

.btn-confirm-donation {
    background-color: var(--purple-primary);
    color: #FFFFFF;
    border: none;
    padding: 10px 24px;
    border-radius: 20px; 
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-confirm-donation:hover {
    background-color: var(--purple-dark);
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.profile-avatar:hover {
    border-color: var(--purple-primary);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Container da Vitrine */
.vitrine-container {
    flex-grow: 1;
    padding: 32px 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.vitrine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.text-purple-dark { color: var(--purple-dark); }

.vitrine-titles h2 {
    font-size: 26px;
    margin-bottom: 4px;
}

.vitrine-titles p { font-size: 14px; }

.vitrine-search {
    display: flex;
    align-items: center;
    background-color: #F6EAF9;
    border: 1px solid var(--border-bottom);
    border-radius: 8px;
    padding: 10px 16px;
    width: 320px;
    gap: 12px;
}

.search-icon {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

.vitrine-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
    font-size: 14px;
}

.vitrine-search input::placeholder { color: var(--text-muted); }

.vitrine-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.pill {
    background-color: #EFEAF4;
    color: var(--text-main);
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill:hover { background-color: #DCD0E6; }
.pill.active {
    background-color: var(--purple-primary);
    color: #FFFFFF;
}

/* Grid de Produtos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

/* Cards */
.card {
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid transparent; 
}

.card-border-blue { border-left: 4px solid #005BCA; }
.card-border-red { border-left: 4px solid #C92020; }

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 160px;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    color: #FFFFFF;
    font-size: 11px;
    z-index: 2;
}

.badge-blue { background-color: #005BCA; }
.badge-red { background-color: #C92020; }

.overlay-dark::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.45);
    z-index: 1;
}

.badge-centered {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--purple-primary);
    color: #FFFFFF;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    z-index: 2;
    white-space: nowrap;
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    color: #1A1323;
    font-size: 18px;
    margin-bottom: 6px;
}

.card-content p {
    font-size: 13px;
    min-height: 40px; 
    margin-bottom: 24px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 8px;
}

.garfo-colher-icon {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
    stroke: #A57C43;
}

.text-purple-primary { color: var(--purple-primary); }
.text-gold { color: #A57C43; }
.text-red { color: #C92020; }

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #EFEAF4;
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
}

.fill-blue { background-color: #005BCA; }
.fill-gold { background-color: #A57C43; }
.fill-red { background-color: #C92020; }

.btn-card {
    width: 100%;
    background-color: var(--purple-primary);
    color: #FFFFFF;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: auto;
}

.btn-card:hover:not(.btn-disabled) { background-color: var(--purple-dark); }
.btn-disabled {
    background-color: #9E96A6;
    color: #EFEAF4;
    cursor: not-allowed;
}

/* Footer e FAB */
.main-footer {
    background-color: #EBE2F0; 
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
}

.footer-left h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

.footer-left p { font-size: 12px; }

.footer-right {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.footer-right a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-right a:hover { color: var(--purple-primary); }

.fab-button {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--purple-primary);
    border: none;
    box-shadow: 0 4px 12px rgba(138, 25, 214, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.3s;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}
.fab-button.visible { opacity: 1; pointer-events: auto; }
.fab-button:hover { transform: scale(1.05); background-color: var(--purple-dark); }
.arrow-top { width: 30px; height: 30px; display: block; }

/* ==================== MODAL PIX - CSS ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 19, 35, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* TRAVAR O SCROLL DO BODY QUANDO MODAL ABERTO */
body.modal-open {
    overflow: hidden;
    padding-right: var(--scrollbar-width, 0px); /* evita salto de layout (opcional) */
}

/* MODAL CONTAINER - SCROLL INTERNO */
.modal-container {
    background-color: #FFFFFF;
    border-radius: 20px;
    width: 90%;
    max-width: 680px;
    max-height: 85vh;          /* altura máxima */
    overflow-y: auto;          /* scroll vertical interno */
    position: relative;
    box-shadow: 0 24px 64px rgba(105, 0, 184, 0.25);
    transform: translateY(20px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* Remove as propriedades problemáticas */
    padding-right: 0;
    scrollbar-gutter: auto;
}

/* ESTILIZAÇÃO DA BARRA DE ROLAGEM (DENTRO DO MODAL) */
.modal-container::-webkit-scrollbar {
    width: 8px;
}

.modal-container::-webkit-scrollbar-track {
    background: #EFEAF4;
    border-radius: 10px;
    margin-block: 8px;        /* espaço no topo/fundo */
}

.modal-container::-webkit-scrollbar-thumb {
    background: #8A19D6;
    border-radius: 10px;
}

.modal-container::-webkit-scrollbar-thumb:hover {
    background: #6900B8;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

.modal-close {
    position: sticky;
    top: 16px;
    left: 100%;
    transform: translateX(-16px);
    margin-bottom: -56px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #F6EAF9;
    color: #6900B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background-color: #EFE4F4;
    transform: translateX(-16px) rotate(90deg); 
}

.modal-close svg {
    width: 18px;
    height: 18px;
    display: block;
}

.modal-header {
    text-align: center;
    padding: 40px 32px 8px;
}

.modal-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8A19D6, #6900B8);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-icon-circle svg {
    width: 28px;
    height: 28px;
    display: block;
}

.modal-header h2 {
    font-size: 24px;
    color: #1A1323;
    margin-bottom: 8px;
}

.modal-header p {
    font-size: 14px;
    color: #6E6875;
    max-width: 420px;
    margin: 0 auto;
}

.modal-body {
    display: flex;
    gap: 32px;
    padding: 24px 32px;
}

.modal-qr-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.qr-wrapper {
    position: relative;
    background-color: #FFF7FD;
    border: 3px solid #EFEAF4;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.92);
    color: #6900B8;
    font-size: 18px;
    padding: 6px 14px;
    border-radius: 6px;
    letter-spacing: 2px;
    pointer-events: none;
}

.qr-wrapper img {
    width: 180px;
    height: 180px;
    display: block;
}

.qr-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #F6EAF9;
    color: #6900B8;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
}

.qr-badge-icon {
    width: 14px;
    height: 14px;
    display: block;
    flex-shrink: 0;
}

.modal-info-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-info-section h3 {
    font-size: 16px;
    color: #1A1323;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section-icon {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

.copy-box {
    background-color: #FCF0FF;
    border: 1px solid #EFEAF4;
    border-radius: 12px;
    padding: 16px;
    position: relative;
}

.copy-label-row {
    margin-bottom: 6px;
}

.copy-label {
    font-size: 11px;
    color: #A098A8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-value-row {
    margin-bottom: 12px;
}

.copy-value {
    font-size: 18px;
    color: #1A1323;
    word-break: break-all;
}

.btn-copy-pix {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #8A19D6;
    color: #FFFFFF;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-copy-pix:hover {
    background-color: #6900B8;
}

.btn-copy-icon {
    width: 16px;
    height: 16px;
    display: block;
}

.copy-feedback {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    color: #16A34A;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

.copy-feedback.show {
    opacity: 1;
}

.institution-info {
    font-size: 12px;
    color: #A098A8;
    line-height: 1.6;
    padding-top: 8px;
    border-top: 1px solid #EFEAF4;
}

.institution-info strong {
    color: #6E6875;
}

.security-seal {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #16A34A;
    background-color: #F0FDF4;
    padding: 10px 14px;
    border-radius: 8px;
}

.security-icon {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}

.modal-footer {
    padding: 16px 32px 28px;
    text-align: center;
    border-top: 1px solid #EFEAF4;
}

.modal-footer p {
    font-size: 12px;
    color: #A098A8;
}

/* ==================== BOTÃO DOAR ITENS NO MODAL ==================== */
.modal-donate-items {
    margin: 0 32px 28px;
    text-align: center;
}

.divider-modal {
    height: 1px;
    background-color: #EFEAF4;
    margin: 0 0 20px 0;
}

.donate-items-text {
    font-size: 14px;
    color: #4D4354;
    margin-bottom: 16px;
}

.btn-donate-items {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #FFFFFF;
    color: #6900B8;
    border: 2px solid #6900B8;
    padding: 12px 28px;
    border-radius: 40px;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.25s ease;
    cursor: pointer;
}

.btn-donate-items:hover {
    background-color: #F6EAF9;
    border-color: #8A19D6;
    color: #8A19D6;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(138, 25, 214, 0.15);
}

.btn-donate-icon {
    width: 18px;
    height: 18px;
    display: block;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 640px) {
    .modal-body {
        flex-direction: column;
        align-items: center;
        padding: 16px 24px;
        gap: 24px;
    }

    .modal-header {
        padding: 32px 20px 8px;
    }

    .modal-header h2 {
        font-size: 20px;
    }

    .modal-container {
        max-width: 95%;
        border-radius: 16px;
    }

    .copy-value {
        font-size: 15px;
    }

    .qr-wrapper img {
        width: 140px;
        height: 140px;
    }
}

/* ==================== SEÇÃO PONTO DE COLETA NO MODAL ==================== */
.modal-collection-point {
    margin: 0 32px 20px;
    padding: 20px;
    background-color: #FDF9FF;
    border: 1px solid #EFEAF4;
    border-radius: 12px;
    text-align: center;
}

.collection-icon {
    margin-bottom: 12px;
}

.collection-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    margin: 0 auto;
}

.collection-text {
    font-size: 14px;
    color: #4D4354;
    margin-bottom: 8px;
    line-height: 1.5;
}

.collection-address {
    font-size: 16px;
    color: #1A1323;
    background-color: #FFFFFF;
    display: inline-block;
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid #D0C2D7;
}

/* ========== BARRA DE NAVEGAÇÃO MOBILE (BOTTOM) ========== */
.mobile-bottom-nav {
    display: none; /* escondido em desktop */
}

@media (max-width: 768px) {
    /* Oculta navegação do topo e botão Doar do header */
    .topbar-tabs,
    .btn-confirm-donation {
        display: none;
    }

    .topbar {
        padding: 16px 20px;
        height: auto;
    }

    .topbar-title {
        font-size: 20px;
    }

    /* Exibe a barra inferior fixa */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: #ffffff;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        z-index: 999;
        justify-content: space-around;
        align-items: center;
        padding: 10px 0;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        height: 70px;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 13px;
        font-weight: 500;
        background: none;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
        padding: 6px 12px;
        border-radius: 12px;
        min-width: 72px;
    }

    .mobile-nav-item.active {
        background-color: var(--purple-dark); /* #6900B8 */
        color: #FFFFFF;
        font-weight: 600;
    }

    /* Estado ativo temporário do botão Doar (modal aberto) */
    .mobile-doar-btn.doar-active {
        background-color: var(--purple-dark);
        color: #FFFFFF;
    }
    .mobile-doar-btn.doar-active .nav-label {
        color: #FFFFFF;
    }

    .nav-icon {
        width: 28px;
        height: 28px;
        display: block;
    }

    .nav-label {
        font-size: 13px;
        font-weight: 500;
        line-height: 1;
    }

    /* Espaço para a barra fixa */
    body {
        padding-bottom: 70px;
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .vitrine-container {
        padding-bottom: 24px;
    }

    .main-footer {
        padding: 24px 20px;
    }

    /* FAB reposicionado */
    .fab-button {
        bottom: 90px;
        bottom: calc(90px + env(safe-area-inset-bottom));
        right: 24px;
    }

    /* ===== AJUSTES RESPONSIVOS DA VITRINE ===== */
    .vitrine-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .vitrine-search {
        width: 100%;
    }

    .vitrine-filters {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pill {
        font-size: 12px;
        padding: 6px 12px;
    }

    .products-grid {
        grid-template-columns: 1fr; /* cards em coluna única */
        gap: 16px;
    }

    .card-image-wrapper {
        height: 180px; /* ligeiramente maior para mobile */
    }

    .main-footer {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}