body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
}

/* --- Estilos dos Cards --- */
.card-livro {
    position: relative;
    transition: transform 0.2s;
    border: none;
    background: #1e1e1e;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
}

.card-livro:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.img-container {
    width: 100%;
    height: 220px;
    background-color: #252525;
    position: relative;
    overflow: hidden;
}

.capa-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    opacity: 0.95;
}

/* Capas Digitais CSS */
.capa-digital {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
    background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
    border-bottom: 3px solid #00d2ff;
}

.capa-v1 {
    background: linear-gradient(135deg, #141E30 0%, #243B55 100%);
    border-color: #243B55;
}

.capa-v2 {
    background: linear-gradient(135deg, #200122 0%, #6f0000 100%);
    border-color: #6f0000;
}

.capa-v3 {
    background: linear-gradient(135deg, #000428 0%, #004e92 100%);
    border-color: #004e92;
}

.capa-v4 {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-color: #11998e;
}

.titulo-digital {
    font-size: 0.9rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.img-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, rgba(30, 30, 30, 1), transparent);
}

.card-body {
    padding: 10px 12px;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #fff;
    min-height: 2.5em;
}

.autor-text {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-bottom: 5px;
    display: block;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 2px;
}

.progress {
    height: 3px;
    background-color: #333;
}

.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

/* --- Estilos do Gerenciador --- */
.btn-neon {
    border: 1px solid #00d2ff;
    color: #00d2ff;
    background: transparent;
}

.btn-neon:hover {
    background: #00d2ff;
    color: #000;
}

.btn-edit {
    border: 1px solid #ffc107;
    color: #ffc107;
    background: transparent;
}

.btn-edit:hover {
    background: #ffc107;
    color: #000;
}

.lista-gerenciador {
    max-height: 60vh;
    overflow-x: hidden !important;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 6px;
    padding-right: 5px;
}

/* Customização do Scroll Vertical (para ficar elegante no tema dark) */
.lista-gerenciador::-webkit-scrollbar {
    width: 6px;
}
.lista-gerenciador::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

.item-gerenciador {
    width: 100%;
    word-break: break-word; /* Quebra palavras longas se necessário */
}

.item-lista {
    padding: 10px;
    border-bottom: 1px solid #333;
    background: #1a1a1a;
}

.item-lista:hover {
    background: #252525;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #121212;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* =========================================
   LAYOUT, PAGINAÇÃO E SIDEBAR
   ========================================= */

/* Ajuste Fino para Altura Total */
html,
body {
    height: 100%;
    /* Garante que a base do site tenha altura */
}

/* Paginação */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(30, 30, 30, 0.4); /* Fundo semi-transparente */
    backdrop-filter: blur(10px);      /* Efeito de vidro (Glassmorphism) */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-top: auto;
    width: 100%;
    margin-bottom: 20px;
}

/* Lado Esquerdo: Info de Arquivos */
.pagination-info-files {
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #666;
}

.pagination-info-files b {
    color: #00d2ff;
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.4);
}

/* Centro: Navegação */
.pagination-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-page {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    min-width: auto; /* Remove o min-width de 100px antigo */
}

.btn-page:hover:not(.disabled) {
    background: rgba(0, 210, 255, 0.1);
    border-color: #00d2ff;
    color: #00d2ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.2);
}

.btn-page.disabled {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

/* Bolha Central de Página */
.page-current-display {
    text-align: center;
    min-width: 60px;
}

.page-num-main {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.page-total-sub {
    font-size: 0.6rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Lado Direito: Barra de Progresso */
.pagination-progress-status {
    text-align: right;
    min-width: 120px;
}

.pagination-progress-status .progress {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

/* Responsivo Paginação */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    .pagination-info-files, .pagination-progress-status {
        display: none !important; /* Esconde detalhes no mobile para focar nos botões */
    }
}

/* Garante que a linha principal ocupe uma altura mínima boa (Tela - Cabeçalho) */
.main-row {
    min-height: calc(100vh - 150px);
}

/* ESTILO DA MENSAGEM DE FEEDBACK (VAZIO/ERRO) */
.feedback-centro {
    flex-grow: 1;            /* Ocupa todo o espaço vazio disponível */
    display: none;           /* Começa oculto (o JS/PHP vai ativar) */
    flex-direction: column;  /* Coloca o ícone em cima do texto */
    justify-content: center; /* Centraliza VERTICALMENTE */
    align-items: center;     /* Centraliza HORIZONTALMENTE */
    text-align: center;
    min-height: 50vh;        /* Garante uma altura mínima de 50% da tela */
    color: #6c757d;          /* Cor cinza suave (text-muted) */
}

.feedback-centro i {
    opacity: 0.5;            /* Deixa o ícone um pouco transparente */
    margin-bottom: 20px;
}

/* Loader Global */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.9); /* Fundo escuro quase opaco */
    backdrop-filter: blur(5px);         /* Efeito de desfoque no fundo */
    z-index: 9999;                      /* Fica acima de tudo, inclusive modais */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s;
}

/* Animação de pulso no texto */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.animate-pulse {
    animation: pulse 1.5s infinite;
}

/* Classe para esconder suavemente */
.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* =========================================
   ÁREA DE BANNERS (HORIZONTAL E SIDEBAR)
   ========================================= */

/* Estilo do Banner Horizontal (Mobile/Tablet) */
.banner-h-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #888;
    transition: all 0.3s ease;
}

.banner-h-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 210, 255, 0.3);
}

/* Sidebar (Área de Imagem Vertical) */
.sidebar-column {
    display: none;
}

.sidebar-card {
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px dashed #333;
    /* O segredo da altura: 100% da altura do pai */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #555;
    text-align: center;
    padding: 15px;
}

/* Controle Responsivo dos Banners */
@media (max-width: 1199px) {
    .sidebar-column {
        display: none !important;
    }
}

@media (min-width: 1200px) {
    .banner-horizontal {
        display: none !important;
    }
    .sidebar-column {
        display: block !important;
    }
}

/* =========================================
   CORREÇÕES DE INTERFACE (CANVAS/MODAIS)
   ========================================= */

/* Centraliza a prévia do Canvas no Modal de Novo Livro */
#canvasPreview {
    margin: 0 auto !important;
    display: block;
}