/* =========================================================
   MATERIAIS — estilos complementares
   Usa a mesma paleta do style.css principal:
   teal #2c7a7b | verde #4CAF50 | teal claro #e0f2f1 | cinza #f9f9f9
   Anexe este arquivo DEPOIS do style.css.
========================================================= */

/* ---------- HERO ---------- */
.mat-hero {
    position: relative;
    padding: 150px 0 90px;
    background: linear-gradient(120deg, #2c7a7b, #4CAF50);
    color: #fff;
    text-align: center;
    overflow: hidden;
}

.mat-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(0, 150, 170, 0.35),
        rgba(0, 180, 160, 0.15)
    );
}

.mat-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.mat-hero .tag-date {
    display: inline-block;
    padding: 6px 18px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 30px;
    font-size: .85rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.mat-hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    max-width: 700px;
    text-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.mat-hero-sub {
    font-size: 1.05rem;
    max-width: 600px;
    opacity: .95;
    line-height: 1.6;
}

.mat-hero + .wave {
    margin-top: -60px;
}

.mat-hero + .wave .wave-path {
    fill: #fff;
}

/* ---------- LISTA / FILTROS ---------- */
.materiais-lista {
    padding: 30px 0 90px;
    background: #fff;
    position: relative;
    z-index: 2;
}

.filtros {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.filtro-btn {
    background: #e0f2f1;
    color: #2c7a7b;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.filtro-btn:hover {
    background: #c9e8e7;
}

.filtro-btn.active {
    background: #2c7a7b;
    color: #fff;
}

.materiais-contagem {
    text-align: center;
    font-size: .85rem;
    color: #888;
    margin: 10px 0 30px;
}

.materiais-vazio {
    text-align: center;
    color: #888;
    padding: 40px 0;
}

/* ---------- GRID DE CARDS ---------- */
.materiais-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.mat-card {
    position: relative;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    transition: transform .3s ease, box-shadow .3s ease;
    display: flex;
    flex-direction: column;
}

.mat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.12);
}

.mat-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    background: #2c7a7b;
    color: #fff;
    font-size: .7rem;
    font-weight: bold;
    letter-spacing: .03em;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 20px;
}

.badge-tecnico {
    background: #7e57c2;
}

.badge-relatorio {
    background: #4CAF50;
}

.badge-institucional {
    background: #e58a1a;
}

.mat-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f2f2f2;
    overflow: hidden;
}

.mat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}

.mat-card:hover .mat-thumb img {
    transform: scale(1.06);
}

.mat-body {
    padding: 18px 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.mat-body h3 {
    font-size: .95rem;
    line-height: 1.4;
    color: #222;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mat-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-download,
.btn-ver,
.btn-instrucoes {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    padding: 10px 16px;
    border: none;
    border-radius: 25px;
    text-decoration: none;
    font-family: inherit;
    font-size: .85rem;
    font-weight: bold;
    line-height: 1.2;
    cursor: pointer;
    transition: 0.3s;
}

/* Baixar PDF — vermelho suave */
.btn-download {
    background: #c94f48;
}

.btn-download:hover {
    background: #b3413b;
}

/* Ver digital — teal (cor que era do Baixar PDF) */
.abrir-cartilha.btn-ver {
    background: #2c7a7b;
    color: #fff;
    padding: 10px 16px;
    font-size: .85rem;
    text-decoration: none;
}

.abrir-cartilha.btn-ver:hover {
    background: #1b5e5e;
    color: #fff;
}

/* Instruções — laranja */
.btn-instrucoes {
    background: #cc6f08;
}

.btn-instrucoes:hover {
    background: #a95a04;
}

/* Baixar PDF + Instruções lado a lado */
.mat-actions-linha {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mat-actions-linha .btn-download,
.mat-actions-linha .btn-instrucoes {
    flex: 1 1 100px;
    padding: 10px 8px;
    font-size: .82rem;
    white-space: nowrap;
}

.mat-link {
    text-align: center;
    color: #2c7a7b;
    font-size: .8rem;
    text-decoration: underline;
}

.mat-link:hover {
    color: #1b5e20;
}

/* ---------- MODAL CARTILHA ---------- */
.modal-cartilha{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    backdrop-filter:blur(5px);
    display:none;
    justify-content:center;
    align-items:center;
    z-index:999999;

}

.modal-cartilha.show{
    display:flex;

}

.modal-content{
    width:85%;
    height:90%;
    background:#fff;
    border-radius:20px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
    box-shadow:
    0 20px 60px rgba(0,0,0,.25);

}

.modal-header{
    background:#3aa6a6;
    color:#fff;
    padding:18px 25px;
    display:flex;
    justify-content:space-between;
    align-items:center;

}

.modal-header h3{
    margin:0;
    font-size:22px;
    font-weight:700;
    line-height:1.3;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;

}

.modal-header small{
    display:block;
    opacity:.9;

}

.modal-header > div{
    min-width:0;
}

.modal-header button{
    background:none;
    border:none;
    color:#fff;
    font-size:30px;
    cursor:pointer;
    flex-shrink:0;
    margin-left:16px;

}

.toolbar{
    height:70px;
    background:#f8f8f8;
    border-bottom:1px solid #e5e5e5;
    display:flex;
    justify-content:center;
    align-items:center;
    gap:15px;

}

.toolbar button{
    height:45px;
    min-width:45px;
    border:none;
    background:#fff;
    border-radius:10px;
    cursor:pointer;
    font-size:18px;
    box-shadow:
    0 2px 8px rgba(0,0,0,.08);
    transition:.2s;

}

.toolbar button:hover{
    transform:translateY(-2px);
    background:#3aa6a6;
    color:#fff;

}

/* botão "Baixar PDF" do modal */
.toolbar .btn-baixar{
    height:45px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    padding:0 20px;
    background:#4CAF50;
    color:#fff;
    border-radius:10px;
    font-size:15px;
    font-weight:700;
    text-decoration:none;
    box-shadow:
    0 2px 8px rgba(0,0,0,.08);
    transition:.2s;
    white-space:nowrap;

}

.toolbar .btn-baixar:hover{
    background:#3d9341;
    transform:translateY(-2px);

}

.pdf-erro{
    align-self:center;
    max-width:420px;
    text-align:center;
    color:#555;
    line-height:1.6;
    padding:30px;

}

.pdf-erro[hidden]{
    display:none;

}

body.modal-aberto{
    overflow:hidden;

}

#paginaInfo{
    font-size:18px;
    font-weight:600;
    color:#3aa6a6;
    min-width:140px;
    text-align:center;

}

.pdf-container{
    flex:1;
    overflow:auto;
    background:#ececec;
    display:flex;
    justify-content:center;
    align-items:flex-start;
    padding:15px;

}

#pdfCanvas{
	max-width:100%;
    height:auto;
    background:#fff;
    border-radius:8px;
    box-shadow:
    0 5px 25px rgba(0,0,0,.18);

}

.abrir-cartilha{
    background:none;
    border:none;
    padding:0;
    color:#2f7f80;
    font-size:14px;
    text-decoration:underline;
    cursor:pointer;
    transition:.2s;
}

.abrir-cartilha:hover{
    color:#3aa6a6;
}

.abrir-cartilha:focus{
    outline:none;
}

@media(max-width:768px){
    .modal-content{
        width:100%;
        height:100%;
        border-radius:0;

    }

    .modal-header{
        padding:12px 15px;

    }

    .modal-header h3{
        font-size:18px;

    }

    .toolbar{
        flex-wrap:wrap;
        gap:8px;
        padding:10px;
        height:auto;

    }

    .toolbar button{
        min-width:40px;
        height:40px;

    }

    #paginaInfo{
        width:100%;
        order:-1;
        margin-bottom:5px;

    }

    .toolbar .btn-baixar{
        width:100%;
        order:99;
        height:40px;

    }

}

/* ---------- RESPONSIVO ---------- */
@media (max-width: 768px) {

    .mat-hero {
        padding: 120px 0 70px;
    }

    .mat-hero h1 {
        font-size: 1.7rem;
    }

    .filtros {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }

    .filtro-btn {
        flex-shrink: 0;
    }

    .materiais-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }

    .mat-body {
        padding: 14px 14px 18px;
    }
}
