/* --- Variáveis Globais (Design System) --- */
:root {
    --color-primary: #f08418;
    --color-primary-dark: #d6730f;
    --color-background: #f5f5f5;
    --color-surface: #ffffff;
    --color-text-primary: #222222;
    --color-text-secondary: #70727c;
    --color-text-light: #c1c1c1;
    --color-surface-accent: #fff5eb;
    --font-family-main: 'Poppins', Arial, sans-serif;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius-main: 15px;
    --border-radius-small: 8px;
}

/* --- Estilos para Modo Escuro (Dark Mode) --- */
body.dark-mode {
    --color-background: #121212;
    --color-surface: #1e1e1e;
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #a0a0a0;
    --color-surface-accent: #2a2a2a;
    --box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* --- Reset e Padrões Globais --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-main);
    background: var(--color-background);
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s ease, color 0.3s ease;
    font-weight: 400;
    opacity: 0;
}

/* --- ANIMAÇÕES DE TRANSIÇÃO DE PÁGINA --- */
@keyframes fadeInPage {
    to { opacity: 1; }
}

@keyframes fadeOutPage {
    from { opacity: 1; }
    to { opacity: 0; }
}

body.fade-in {
    animation: fadeInPage 0.4s ease-out forwards;
}

body.fade-out {
    animation: fadeOutPage 0.4s ease-out forwards;
}

.container {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    background-color: var(--color-surface);
    padding: 15px 0;
    box-shadow: var(--box-shadow);
    height: 80px;
    display: flex;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.3s ease, height 0.3s ease;
    width: auto;
    max-width: none;
    margin: 0;
}
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}
.logo img { height: 40px; display: block; }
.main-nav { position: relative; display: flex; gap: 25px; align-items: center; }
.main-nav a {
    color: var(--color-text-secondary); text-decoration: none; font-weight: 700;
    font-size: 1.1rem; padding-bottom: 7px; position: relative; transition: color 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-primary);
}

.menu-indicator {
    position: absolute;
    bottom: -10px;
    height: 4px;
    background-color: var(--color-primary);
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
    will-change: left, width;
    pointer-events: none;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--color-primary);
    color: white !important;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem !important;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-left: 15px;
}
.login-btn:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.header-action-placeholder {
    display: none;
    width: 44px; 
}

/* --- Seção de Filtros --- */
.filter-section {
    padding: 20px;
    background-color: var(--color-surface);
    border-radius: var(--border-radius-main);
    margin: 30px auto;
    box-shadow: var(--box-shadow);
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 150px;
}

.filter-group.search-group {
    flex-grow: 2;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.filter-group input,
.filter-group select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    background-color: var(--color-background);
    border: 1px solid transparent;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius-small);
    color: var(--color-text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 2px var(--color-primary);
}

.view-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.view-controls .view-btn {
    width: 38px;
    height: 38px;
    background-color: var(--color-background);
    border: 1px solid var(--color-text-light);
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-small);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.view-controls .view-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.view-controls .view-btn.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary-dark);
    color: white;
}

/* --- Base do Contêiner dos Mangás --- */
.manga-grid {
    margin-bottom: 30px;
    min-height: 300px;
}

.manga-grid.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.manga-grid.grid-view .manga-card {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-main);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    cursor: pointer;
}

.manga-grid.grid-view .manga-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.manga-grid.grid-view .manga-card:hover .image-box img {
    transform: scale(1.05);
}

.manga-grid.grid-view .image-box {
    background-color: transparent;
    border-radius: 0;
    overflow: visible;
}

.manga-grid.grid-view .image-box img {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.manga-grid.grid-view .chapter-badge {
    display: none;
}

.manga-grid.grid-view .card-info {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    padding: 30px 15px 15px;
}

.manga-grid.grid-view .title-box {
    background: none;
    border: none;
    height: auto;
    padding: 0;
}

.manga-grid.grid-view .title-box .title {
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: left;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.7);
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
    width: 100%;
}
        
.manga-grid.grid-view .card-info .synopsis-preview {
    display: none;
}

/* --- Estilos para a Visualização em Lista --- */
.manga-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.manga-grid.list-view .manga-card {
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    transition: transform 0.3s ease;
    text-decoration: none;
    background-color: var(--color-surface);
    border-radius: var(--border-radius-small);
    padding: 15px;
    border: 1px solid var(--color-background);
}

.manga-grid.list-view .image-box {
    position: relative;
    border-radius: var(--border-radius-small);
    overflow: hidden;
    background-color: var(--color-surface);
    flex: 0 0 100px;
    height: 150px;
}

.manga-grid.list-view .image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease-out;
}

.manga-grid.list-view .manga-card:hover {
    transform: translateY(0);
    border-color: var(--color-primary);
}

.manga-grid.list-view .manga-card:hover .image-box img {
    transform: scale(1.05);
}

.manga-grid.list-view .chapter-badge {
    display: none;
}

.manga-grid.list-view .title-box {
    background: none;
    border: none;
    height: auto;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0;
}

.manga-grid.list-view .title-box .title {
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--color-text-primary);
    text-align: left;
    width: 100%;
    line-height: 1.3;
    overflow: visible;
    display: block;
    -webkit-line-clamp: unset;
}

.manga-grid.list-view .card-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
}

.manga-grid.list-view .card-info .synopsis-preview {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* --- Paginação --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 25px 0;
    margin-bottom: 40px;
}

.pagination-container button,
.pagination-container span {
    border: none;
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
    font-family: var(--font-family-main);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--border-radius-small);
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--box-shadow);
}

.pagination-container span.ellipsis {
    background-color: transparent;
    box-shadow: none;
    cursor: default;
}

.pagination-container button:not(:disabled):hover {
    background-color: var(--color-surface-accent);
    color: var(--color-primary);
}

.pagination-container button.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary-dark);
}

.pagination-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--color-background);
}

/* --- Rodapé --- */
.site-footer {
    background-color: var(--color-surface);
    border-top: 2px solid var(--color-background);
    padding: 40px 0 20px;
    font-size: 0.9rem;
    margin-top: auto;
}

.footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-logo img {
    height: 40px;
    width: auto;
}

.footer-links a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.3s;
    margin: 0 10px;
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-social {
    display: flex;
    gap: 20px;
    margin: 10px 0;
}

.footer-social a,
.footer-social a:visited { 
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 24px;
    transition: color 0.3s ease, transform 0.3s ease;
}

.footer-social a:hover {
    color: var(--color-primary);
    transform: scale(1.2);
}

/* --- Floating Buttons --- */
.back-to-top, .dark-mode-toggle {
    position: fixed;
    right: 30px;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    z-index: 1999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dark-mode-toggle {
    bottom: 90px;
    background-color: transparent;
    box-shadow: none;
}

.dark-mode-toggle:hover {
    background-color: rgba(150, 150, 150, 0.15);
}

.back-to-top {
    bottom: 30px;
    font-size: 1.3rem;
    background-color: #333333;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* --- Responsividade --- */
@media (max-width: 992px) {
    .site-header {
        height: auto;
        padding: 10px 0;
    }
    .header-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .site-header {
        height: 80px;
        align-items: center;
    }
    .header-container {
        display: flex;
        justify-content: space-between;
        padding: 0 10px;
        height: 100%;
    }
    .header-container .main-nav {
        display: none;
    }
    .manga-grid.grid-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .footer-links {
        display: none;
    }
}

/* --- ESTILOS DO NOVO MENU ADICIONADOS ABAIXO --- */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--color-surface);
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}
body.dark-mode .mobile-bottom-nav {
    border-top-color: rgba(128, 128, 128, 0.15);
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.2);
}
.bottom-nav-list {
    display: flex;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    width: 100%;
    height: 100%;
    padding: 0 5px;
    margin: 0;
}
.bottom-nav-item {
    flex: 1;
}
.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 0.7rem;
    font-weight: 500;
    height: 100%;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav-link i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}
.bottom-nav-link.active,
.bottom-nav-link:hover {
    color: var(--color-primary);
}

.more-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.more-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
}
.more-menu-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--color-surface);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 1501;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}
.more-menu-overlay.visible .more-menu-container {
    transform: translateY(0);
}
.more-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.more-menu-header h3 {
    font-size: 1.2rem;
    color: var(--color-text-primary);
}
.more-menu-close-btn {
    background: var(--color-surface-accent);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    color: var(--color-text-secondary);
    cursor: pointer;
}
.more-menu-links a {
    display: flex;
    align-items: center;
    padding: 15px;
    text-decoration: none;
    color: var(--color-text-primary);
    border-radius: var(--border-radius-small);
    font-weight: 500;
    transition: background-color 0.2s ease;
}
.more-menu-links a:hover {
    background-color: var(--color-surface-accent);
}
.more-menu-links a i {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
    margin-right: 15px;
    color: var(--color-primary);
}
body.more-menu-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }
    body {
        padding-bottom: 70px;
    }
}

@media (max-width: 768px) {
    .header-container {
        /* Torna este container a referência para o posicionamento absoluto da logo */
        position: relative;
    }

    .header-container .logo {
        /* Tira a logo do fluxo normal e a posiciona em relação ao .header-container */
        position: absolute;
        left: 50%;
        top: 50%;
        
        /* Puxa a logo para trás pela metade de sua própria largura e altura para uma centralização perfeita */
        transform: translate(-50%, -50%);
        
        /* Remove a margem que a empurrava para a esquerda no desktop */
        margin-right: 0; 
    }
}

/* --- ESTILOS DE NOTIFICAÇÃO (Geral) --- */

/* Estilo para o botão de sino na navegação (Desktop) */
#notification-bell-btn {
    position: relative;
    margin-left: 10px; 
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s ease;
}

#notification-bell-btn:hover {
    color: var(--color-primary);
}

/* Estilo para o distintivo de não lidas */
#notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--color-primary);
    color: var(--color-surface);
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    line-height: 1;
    pointer-events: none;
    z-index: 1; 
}

/* Painel lateral de Notificações */
.notification-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px; 
    max-width: 90%;
    height: 100%;
    background-color: var(--color-surface);
    box-shadow: var(--box-shadow);
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.notification-panel.open {
    transform: translateX(0);
}

.notification-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-surface-accent);
}

.notification-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--color-text-primary);
}

.notification-close-btn, .mark-all-read-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-secondary);
    cursor: pointer;
}

.mark-all-read-btn {
    font-size: 0.8rem;
    padding: 5px 10px;
    color: var(--color-primary);
    font-weight: 500;
}

.notification-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
    list-style: none;
}

.notification-item {
    display: block;
    padding: 15px;
    border-bottom: 1px solid var(--color-surface-accent);
    text-decoration: none;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.notification-item.unread {
    background-color: var(--color-surface-accent);
    border-left: 4px solid var(--color-primary);
}

.notification-item:hover {
    background-color: var(--color-surface-accent);
}
body.dark-mode .notification-item.unread:hover {
    background-color: #353535;
}


.notification-title {
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 5px;
}

.notification-body {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 5px;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--color-text-secondary);
}

/* FIM DOS ESTILOS DE NOTIFICAÇÃO (Geral) */

/* --- ESTILOS DO BOTÃO DE NOTIFICAÇÃO (Página de Detalhes) --- */
#notification-btn {
    position: absolute; /* CRÍTICO: Posição Flutuante */
    top: 20px; /* 20px do topo do .detail-banner */
    right: 20px; /* 20px da direita do .detail-banner */
    z-index: 10;
    
    /* Transforma o botão num círculo de sino */
    width: 44px; 
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.3rem; 
    display: flex; 
    align-items: center;
    justify-content: center;
    
    /* Cores padrão (Inativo: Sino cinza/branco) */
    border: 2px solid white; 
    background-color: transparent; color: #222;
    color: white; 
    transition: all 0.2s ease;
    cursor: pointer;
}

#notification-btn.is-subscribed {
    /* Estilo quando a inscrição está ativa */
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}
#notification-btn.is-subscribed:hover {
    background-color: var(--color-primary-dark) !important;
}

/* --- AJUSTES RESPONSIVOS (Painel) --- */

@media (max-width: 768px) {
    .notification-panel {
        width: 100%; 
        max-width: 350px; 
    }
}