@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --bg: #f8fafc;

    /* Paleta Extraída da Referência e Logo */
    --primary-green: #5CB85C; /* Verde Principal (da logo) */
    --dark-text: #2c3e50;    /* Preto/Azul-petróleo escuro (do texto da logo) */
    --white-text: #eeeeee;

    --accent-orange: #EC6840; /* Laranja da Engrenagem */
    --accent-blue: #3EADE5;   /* Azul da Engrenagem */
    --bg-peach: #F5E5DC;     /* Fundo do gradiente central */
    --white: #ffffff;

    --orange-gradient: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    --green-educriando: #5cb85c;
    --dark-blue: #2c3e50;
}

* {
    font-family: 'Montserrat', sans-serif;
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: #334155; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links { list-style: none; display: flex; align-items: center; gap: 25px; }
.nav-links a { text-decoration: none; color: var(--primary); font-weight: 600; font-size: 0.95rem; }

.main-logo { height: 45px; transition: transform 0.3s; }
.main-logo:hover { transform: scale(1.05); }

.logo {
    font-size: 28px;
    font-weight: 700;
}

.footer-about .logo {
    color: #181818;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.footer-about .logo span {
    color: #5cb85c; /* Verde da logo */
}

/* Banner */
.catalog-banner {
    /* background: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.8)), url('assets/img/bg_materiais.jpg'); */
    background: url('../assets/img/bg_materiais.jpg');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 60px 0;
    text-align: center;
    margin-bottom: 40px;
    height: 150px;
    max-height: 160px;
}

/* Layout */
.catalog-layout { display: grid; grid-template-columns: 250px 1fr; gap: 30px; }

/* Sidebar */
.sidebar { background: white; padding: 20px; border-radius: 12px; height: fit-content; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.category-list { list-style: none; margin-top: 15px; }
.category-list li { 
    padding: 10px; cursor: pointer; border-radius: 6px; transition: 0.2s; 
    font-size: 0.95rem; color: #64748b;
}
.category-list li:hover { background: #f1f5f9; color: var(--accent); }
.category-list li.active { background: var(--accent); color: white; font-weight: 600; }

/* Toolbar */
.toolbar { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 25px; gap: 15px; flex-wrap: wrap; position: relative;
    z-index: 10; flex-wrap: nowrap; padding: 15px;
}
.search-box { 
    position: relative; flex-grow: 1; min-width: 150px;
}
.search-box input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box; /* Essencial para o padding não expulsar o elemento */
}
.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
    z-index: 1; /* Garante que o brilho do foco não cubra outros itens */
}
.search-box i { position: absolute; left: 15px; top: 12px; color: #94a3b8; }
.search-box input { 
    width: 100%; padding: 10px 15px 10px 45px; border-radius: 8px; border: 1px solid #e2e8f0; outline: none;
}

.controls { display: flex; gap: 10px; align-items: center; flex-shrink: 0;}
.view-toggle button { 
    background: white; border: 1px solid #e2e8f0; padding: 8px 12px; cursor: pointer; transition: 0.2s;
}
.view-toggle button.active { background: var(--primary); color: white; border-color: var(--primary); }

/* GRID vs LISTA */
#productGrid.view-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }

/* Estilo Lista */
#productGrid.view-list { display: flex; flex-direction: column; gap: 15px; }
#productGrid.view-list .product-card { 
    display: flex; flex-direction: row; align-items: center; padding: 15px 25px; height: 120px;
}
#productGrid.view-list .product-img { width: 100px; height: 100%; margin-bottom: 0; margin-right: 20px; }
#productGrid.view-list .product-info { flex-grow: 1; display: flex; justify-content: space-between; align-items: center; padding: 0; }

/* Card Padronizado */
.product-card { background: white; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: 0.3s; }
.product-card:hover { transform: translateY(-5px); }
.product-img { height: 180px; background: #eee; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-info { padding: 15px; }
.product-info h3 { font-size: 1.1rem; margin-bottom: 10px; color: var(--primary); }
.price { font-weight: 800; color: #1e293b; font-size: 1.2rem; }

.product-card .btn-buy {
    text-decoration: none;
    background: var(--accent);
    color: white;
    padding: 10px 20px; /* Tamanho fixo do botão */
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap; /* Não quebrar o texto do botão */
    
    /* Na lista, alinhar verticalmente no centro e na extrema direita */
    margin-left: 20px;
}

#sortOrder {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    background-color: #fff;
    cursor: pointer;
    min-width: 160px; /* Define um tamanho fixo para o select não variar com o texto */
}

/* ===================== */
/* O Segredo: Flexbox na vertical no card inteiro */
#productGrid.view-grid .product-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Alinha o conteúdo ao topo */
    height: 100%; /* Garante que todos os cards na mesma linha tenham a mesma altura */
}

#productGrid.view-grid .product-img {
    width: 100%;
    height: 180px; /* Altura fixa da imagem no grid */
    overflow: hidden;
}

#productGrid.view-grid .product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Preenche sem distorcer */
}

/* Informações internas no grid */
#productGrid.view-grid .product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Faz esta área crescer para empurrar o botão */
    box-sizing: border-box;
}

/* O título sempre começando no mesmo ponto */
#productGrid.view-grid .product-info h3 {
    font-size: 1.1rem;
    color: var(--primary);
    margin: 0 0 15px 0; /* Margem apenas na base */
    line-height: 1.3;
    /* Para garantir que títulos longos (combo) não quebrem o alinhamento, 
       podemos limitar a 2 linhas e alinhar tudo igual */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limita a 2 linhas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em; /* Altura de 2 linhas para alinhar títulos curtos */
}

/* Preço no grid */
#productGrid.view-grid .price {
    font-weight: 800;
    color: #1e293b;
    font-size: 1.3rem;
    margin-bottom: 20px; /* Espaço para o botão */
}

/* O SEGREDO PARA O BOTÃO NA BASE NO GRID */
#productGrid.view-grid .btn-buy {
    margin-top: auto; /* Empurra para a base */
    width: 100%;      /* Ocupa a largura disponível */
    box-sizing: border-box; /* Fundamental: impede que padding interno "estique" o botão para fora */
    display: block;
    text-align: center;
    padding: 12px;
    /* Se você tiver margens laterais no botão, remova-as ou use calc */
    margin-left: 0;
    margin-right: 0;
}

/* Perfil ========== */
/* Perfil do usuário */
/* Estilo do Perfil no Header */
/* Container do Menu */
.user-menu-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* Gatilho do Perfil (Avatar + Seta) */
.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 30px;
    transition: 0.3s;
}

.user-profile-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

/* Conteúdo do Dropdown */
.user-dropdown-content {
    display: none;
    position: absolute;
    top: 120%;
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 10px;
    overflow: hidden;
    z-index: 1000;
}

.user-dropdown-content.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.user-dropdown-content a, .user-dropdown-content button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: 0.2s;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.user-dropdown-content a:hover, .user-dropdown-content button:hover {
    background: #f8fafc;
    color: var(--accent);
}

.user-dropdown-content button {
    border-top: 1px solid #eee;
    color: #e74c3c;
}

/* Login professor */
.btn-professor {
    background: var(--green-educriando);
    color: white !important;
    padding: 10px 20px;
    border-radius: 8px;

    transition: 2ms;
}

.btn-professor:hover {
    box-shadow: 0px 3px 3px 2px rgb(193, 193, 193);
}

/* Perfil keyframe */

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .catalog-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; } /* Pode ser transformado em um menu dropdown no mobile */
}