:root {
    --bg-color: #fcfaf8; /* Tom areia claro */
    --text-color: #2d3748;
    --primary-color: #bfa15f; /* Dourado Ananda Nilayam */
    --primary-hover: #a68a4d;
    --sidebar-bg: #1a202c;
    --sidebar-text: #edf2f7;
    --card-bg: #ffffff;
    --danger: #e53e3e;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', system-ui, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); display: flex; min-height: 100vh; }

/* Layout Base */
.app-container { display: flex; width: 100%; }
.sidebar { width: 250px; background: var(--sidebar-bg); color: var(--sidebar-text); padding: 2rem 1rem; display: flex; flex-direction: column; }
.sidebar-logo { width: 100%; max-width: 150px; margin-bottom: 2rem; align-self: center; }
.nav-link { color: var(--sidebar-text); text-decoration: none; padding: 0.75rem 1rem; margin-bottom: 0.5rem; border-radius: var(--border-radius); transition: 0.3s; }
.nav-link:hover { background: rgba(255,255,255,0.1); }
.main-content { flex: 1; padding: 2rem; overflow-y: auto; }

/* UI Elements */
.btn { background: var(--primary-color); color: #fff; border: none; padding: 0.75rem 1.5rem; border-radius: var(--border-radius); cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block; transition: 0.3s; text-align: center; }
.btn:hover { background: var(--primary-hover); }
.btn-block { display: block; width: 100%; }
.input-group { margin-bottom: 1rem; }
.input-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; }
.input-group input { width: 100%; padding: 0.75rem; border: 1px solid #cbd5e0; border-radius: var(--border-radius); outline: none; }

/* Auth Box */
.auth-wrapper { display: flex; width: 100vw; height: 100vh; align-items: center; justify-content: center; background: var(--bg-color); }
.auth-box { background: var(--card-bg); padding: 3rem; border-radius: var(--border-radius); box-shadow: var(--shadow); width: 100%; max-width: 400px; }

/* Cards Grid (Netflix/Hotmart style) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.card { background: var(--card-bg); border-radius: var(--border-radius); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.3s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-5px); }
.card-img { width: 100%; height: 140px; object-fit: cover; background: #e2e8f0; }
.card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.card-desc { font-size: 0.875rem; color: #718096; margin-bottom: 1rem; }

/* PDF Viewer */
#pdf-container { width: 100%; display: flex; flex-direction: column; align-items: center; background: #525659; padding: 2rem; overflow-y: auto; height: 80vh; position: relative; }
.pdf-page { margin-bottom: 1rem; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

/* Watermark */
.watermark-layer { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 9999; display: flex; flex-wrap: wrap; align-content: flex-start; overflow: hidden; opacity: 0.08; user-select: none; }
.watermark-text { font-size: 24px; font-weight: bold; color: #000; transform: rotate(-45deg); padding: 40px; white-space: nowrap; }

/* ==========================================
   RESPONSIVIDADE GERAL (CELULARES E TABLETS)
   ========================================== */
@media (max-width: 768px) {
    /* Estrutura principal */
    .app-container { flex-direction: column; }
    
    /* Menu Lateral vira Menu Superior no Celular */
    .sidebar { 
        width: 100%; 
        padding: 1rem; 
        flex-direction: row; 
        justify-content: center; 
        align-items: center; 
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .sidebar h2 { 
        width: 100%; 
        text-align: center; 
        margin-bottom: 0.5rem !important; 
        font-size: 1.4rem;
    }
    
    .nav-link { 
        margin: 0; 
        padding: 0.5rem 0.75rem; 
        font-size: 0.85rem; 
        text-align: center;
    }
    
    #btnLogout { margin-top: 0 !important; padding: 0.5rem 1rem; font-size: 0.85rem; }

    /* Área de Conteúdo */
    .main-content { padding: 1.25rem; }
    .main-content h1 { font-size: 1.5rem; margin-bottom: 1rem; text-align: center; }

    /* Barra de Pesquisa Adaptável */
    .main-content > div:first-child { 
        flex-direction: column; 
        align-items: stretch !important; 
        gap: 0.5rem;
    }
    
    .main-content > div:first-child > div { 
        width: 100%; 
        display: flex; 
        flex-direction: column; 
        gap: 0.5rem; 
    }
    
    #searchInput { width: 100%; min-width: unset; }
    #searchBtn, #clearBtn { width: 100%; }

    /* Cards Menores para caberem 2 na tela do celular */
    .grid { 
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); 
        gap: 1rem; 
    }
    
    .card-img { height: 110px; } /* Imagem menor no celular */
    .card-title { font-size: 1rem; }
    .card-desc { font-size: 0.8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } /* Trunca o texto grande */
    .card .btn-block { font-size: 0.85rem; padding: 0.6rem; }
}
}

/* ==========================================
   LOADER ANIMADO
   ========================================== */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    grid-column: 1 / -1;
    text-align: center;
}

.spinner {
    width: 45px;
    height: 45px;
    border: 5px solid rgba(191, 161, 95, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

/* ==========================================
   BOTÃO DE FAVORITO
   ========================================== */
.card { position: relative; } /* Garante que o coração fique preso ao card */

.fav-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    border-radius: 50%;
    width: 35px; 
    height: 35px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.fav-btn:hover {
    transform: scale(1.1);
}

//* ==========================================
   NOVA ESTÉTICA DE AUTENTICAÇÃO (COMPACTA)
   ========================================== */
.auth-wrapper {
    background-color: #f4ecdc;
    display: flex;
    width: 100vw;
    min-height: 100vh; /* Permite rolar a tela em celulares muito pequenos */
    align-items: center;
    justify-content: center;
    padding: 1.5rem; /* Evita que a caixa encoste nas bordas do celular */
}

.auth-box {
    background: #ffffff;
    padding: 2.5rem 2rem; /* Reduzimos o respiro interno para ficar mais elegante */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08); /* Sombra mais suave */
    width: 100%;
    max-width: 380px; /* Reduzimos a largura máxima */
    text-align: center;
}

.auth-logo {
    max-width: 140px; /* Deixamos a logo mais delicada */
    max-height: 110px; /* Trava a altura para não empurrar o layout para baixo */
    object-fit: contain;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.auth-title {
    font-family: 'Georgia', 'Playfair Display', serif;
    font-size: 1.35rem; /* Fonte um pouco menor para caber em uma ou duas linhas bonitas */
    color: #142b1c;
    margin-bottom: 0.2rem;
    font-weight: 600;
    line-height: 1.3;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 2rem;
}

.auth-form { text-align: left; }
.auth-form .input-group { margin-bottom: 1.25rem; }

.auth-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    color: #8a8a8a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.auth-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    outline: none;
    font-size: 0.95rem;
    color: #2d3748;
    transition: border-color 0.3s;
}

.auth-form input:focus { border-color: #1a3322; }

.btn-auth {
    background-color: #1a3322;
    color: #ffffff;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    width: 100%;
    transition: background-color 0.3s;
    margin-top: 0.5rem;
}

.btn-auth:hover { background-color: #0f1f15; }