/* Proteção contra conflitos do Bootstrap */
.custom-styles * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* Reset específico para manter estilos customizados */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* Força estilos customizados sobre Bootstrap */
.navbar:not(.navbar-expand) {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%) !important;
    padding: 10px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    position: sticky !important;
    z-index: 1000 !important;
    top: 0 !important;
    gap: 30px;
}

body {
    margin: 0;
    background-color: #f4f4f4;
    visibility: hidden;
}

body.loaded {
    visibility: visible;
}

.navbar {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    z-index: 1000;
    top: 0;
}

.navbar-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.navbar-brand h1 {
    color: white;
    margin: 0;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.navbar-brand img {
    width: 100px;
}

.navbar-menu {
    position: relative;
}

.navbar-desktop {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dropdown {
    position: relative;
    display: none;
}

.dropdown-btn {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    width: auto;
    margin: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-content {
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1001;
    overflow: hidden;
    margin-top: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown-content a span {
    font-size: 16px;
}

.dropdown.active .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Sub-menu mobile */
.mobile-submenu {
    position: relative;
}

.submenu-toggle {
    cursor: pointer;
}

.submenu-content {
    max-height: 0;
    overflow: hidden;
    padding-left: 20px;
    background-color: #f8f9fa;
    border-left: 3px solid #007cba;
    opacity: 0;
    transition: all 0.3s ease;
}

.submenu-content.active {
    max-height: 200px;
    opacity: 1;
}

.submenu-content a {
    padding: 8px 16px;
    font-size: 14px;
    color: #555;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.submenu-content.active a {
    transform: translateX(0);
}

.submenu-content a:hover {
    background-color: #e9ecef;
    transform: translateX(5px);
}

.navbar-desktop .dropdown {
    position: relative;
    display: inline-block;
}

.navbar-desktop .dropdown .nav-link {
    cursor: pointer;
}

.navbar-desktop .dropdown .dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 180px;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1001;
    overflow: hidden;
    margin-top: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.navbar-desktop .dropdown.active .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#app-content {
    margin: 30px;
}

#app-content h1 {
    font-size: 52px;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 {
    margin-bottom: 20px;
}

.anime {
    border: 1px solid #ddd;
    padding: 10px;
    margin: 14px 0;
    border-radius: 5px;
    display: flex;
    align-items: stretch;
    box-shadow: 1px 1px 3px black;
    transition: transform 0.3s ease;
}

.anime:hover {
    transform: scale(1.01);
}

.anime-ativo {
    border-color: #007cba !important;
    background-color: #f0f8ff !important;
}

.anime-image {
    width: 120px;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
    flex-shrink: 0;
}

.anime-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.anime-content p {
    font-size: 14px;
    line-height: 1.4;
}

.anime-content p img.emoji,
.anime-content p span {
    font-size: 14px !important;
    vertical-align: baseline;
}

.botoes-anime {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

#loginStatus .danger {
    margin-bottom: 0;
    margin-left: 5px;
}

.btn-visualizar {
    background: #28a745 !important;
    font-size: 12px !important;
    padding: 5px 10px !important;
    width: 80px !important;
    margin: 0 !important;
}

.btn-visualizar:hover {
    background: #1e7e34 !important;
}

.btn-alterar {
    background: #007bff !important;
    font-size: 12px !important;
    padding: 5px 10px !important;
    width: 80px !important;
    margin: 0 !important;
}

.btn-alterar:hover {
    background: #0056b3 !important;
}

#divAnimes {
    margin-top: 20px;
    margin-left: 5px;
}

.form-container {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    box-shadow: 1px 1px 8px black;
}

input,
select {
    padding: 8px;
    margin: 5px;
    width: 600px;
    font-size: 12px;
    border-radius: 5px;
    border: 1px black solid;
}

#opcoes {
    margin-left: 5px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

#opcoesVincular{
    margin-bottom: 10px;
}

#opcoes input,
#opcoesVincular input {
    width: fit-content;
}

#divOpcoes {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 7px;
    margin-bottom: 10px;
}

#divOpcoes div {
    display: flex;
    flex-direction: column;
}

#animeVinculado {
    margin-left: 5px;
}

#animeExistente {
    padding: 7.2px;
    width: 600px;
    margin-left: 0;
    margin-top: 0 !important;
}

select[multiple] {
    height: 120px;
}

#generoApi {
    margin-left: 5px;
    width: 100%;
    gap: 5px;
}

#generoJikan {
    margin-left: 5px;
    width: 100%
}

#animeApi {
    width: 600px;
}

#animeJikan {
    width: 600px;
}

#imagemSelect {
    width: 600px;
}

#generoApiVincular {
    width: 100%;
    gap: 5px;
}

#animeApiVincular {
    width: 600px;
}

#animeJikanVincular {
    width: 600px;
}

#imagemSelectVincular {
    width: 600px;
}

.select2-container--default .select2-selection--single {
    height: auto !important;
    padding: 8px !important;
    border: 1px black solid !important;
    border-radius: 5px !important;
    font-size: 12px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    font-size: 12px !important;
    height: auto !important;
    padding: 0 !important;
    line-height: normal !important;
}

.select2-container {
    height: 36px;
}

.select2-results__option {
    font-size: 12px;
}

.select2-search__field {
    margin: 0 !important;
    padding: 4px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.select2-dropdown {
    font-size: 12px;
    border: 1px black solid !important;
    border-radius: 5px !important;
    padding: 2px 5px;
}

small {
    color: #666;
    font-size: 12px;
    margin-left: 5px;
    margin-bottom: 5px;
}

button:not(.select2-selection__clear, .nav-link) {
    padding: 10px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 5px;
    margin-top: 10px;
    font-size: 13px;
    width: 200px;
}

button:not(.select2-selection__clear):hover {
    background: #005a87;
}

.select2-selection__clear {
    opacity: 0;
}

#toggleComentarios {
    text-decoration: none;
    padding: 10px 20px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 0;
    margin-left: 5px;
    font-size: 13px;
    width: 180px;
    text-align: center;
}

#toggleComentarios:hover {
    background: #005a87;
}

#adicionar {
    margin-top: 0 !important;
    width: 180px !important;
}

#reset {
    background: #6c757d !important;
}

#reset:hover {
    background: #545b62 !important;
}

.botoes-topo {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.botoes-esquerda {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filtros-direita {
    display: flex;
    gap: 10px;
    align-items: center;
    position: relative;
}

.pesquisa-container {
    display: flex;
    align-items: center;
}

#pesquisaAnime {
    width: 200px !important;
    height: 33px;
    margin: 0 !important;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
    font-size: 13px;
}

#toggleFiltros {
    width: 40px !important;
    height: 33px !important;
    border-bottom-left-radius: 0;
    border-top-left-radius: 0;
    margin: 0 !important;
    font-size: 16px;
    padding: 0 !important;
    background: #6848a3 !important;
    border: 1px solid black;
    border-left: 0;
}

#toggleFiltros:hover {
    background: #5a32a3 !important;
}

#filtrosAvancados {
    display: flex;
    gap: 10px;
    align-items: center;
    position: absolute;
    right: 0;
    top: 45px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1 !important;
}

#filtroGenero {
    width: 150px !important;
    margin: 0 !important;
}

#filtroNota {
    width: 120px !important;
    margin: 0 !important;
}

#filtroOrdem {
    width: 150px !important;
    margin: 0 !important;
}

#limparFiltros {
    width: 40px !important;
    height: 34px !important;
    margin: 0 !important;
    font-size: 16px;
    padding: 0 !important;
    background: #dc3545 !important;
}

#limparFiltros:hover {
    background: #c82333 !important;
}

#amarelo {
    color: #ffc107;
}

.loading {
    margin-top: 30px;
    text-align: center;
    color: #666;
}

.success {
    background: #e6ffe6;
    border: 1px solid #99ff99;
    color: #2e7d32;
    padding: 10px;
    margin-top: 10px;
    margin-left: 5px;
    border-radius: 5px;
}

.danger {
    background: #ffe6e6;
    border: 1px solid #ff9999;
    color: #d32f2f;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
}

.google-btn {
    background: #db4437 !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.google-btn:hover {
    background: #c23321 !important;
}

#outros_topo {
    justify-content: start;
}

.btn-outros {
    background: #6f42c1 !important;
    margin-right: 10px !important;
}

.btn-outros:hover {
    background: #5a32a3 !important;
}

#btnOutros {
    margin: 0;
}

.logout-btn {
    background: #dc3545 !important;
}

.logout-btn:hover {
    background: #c82333 !important;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

textarea {
    width: 600px;
    padding: 8px;
    margin: 5px;
    resize: vertical;
    max-height: 150px;
    min-height: 32.8px;
    font-size: 12px;
    border-radius: 5px;
    border: 1px black solid;
}

/* Estilos para página de detalhes */
.anime-detalhes-container {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    box-shadow: 1px 1px 8px black;
    position: relative;
}

.btn-alterar-detalhes {
    background: #007bff !important;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 12px;
    cursor: pointer;
    align-self: flex-end;
    max-width: 200px;
    width: 100% !important;
    height: fit-content;
    margin-right: 8px;
}

.btn-alterar-detalhes:hover {
    background: #0056b3 !important;
}

.btn-assistir-detalhes {
    background: #28a745 !important;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 12px;
    cursor: pointer;
    align-self: flex-end;
    max-width: 200px;
    width: 100% !important;
    height: fit-content;
    margin-right: 8px;
    position: absolute;
    top: 45px;
}

.btn-assistir-detalhes:hover {
    background: #218838 !important;
}

.divAlterar {
    width: 30%;
    position: relative;
}

.anime-image-detalhes {
    width: 400px;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

#anime-detalhes .danger {
    margin-left: 20px !important;
}

.anime-detalhes-content {
    flex: 1;
    padding: 5px 10px 0px 0px;
}

.anime-detalhes-content h2 {
    margin-bottom: 20px;
    color: #333;
}

.anime-detalhes-titulo {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.anime-detalhes-titulo div {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.detalhes-info p {
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.5;
}

.descricao-detalhes {
    margin-top: 20px;
}

.descricao-item {
    margin-top: 15px;
}

.descricao-item p {
    margin-top: 5px;
    padding: 15px;
    background: white;
    border-radius: 5px;
    border: 1px solid #ddd;
    line-height: 1.6;
    font-size: 16px;
}

.descricao-item p img.emoji,
.descricao-item p span {
    font-size: 16px !important;
    vertical-align: baseline;
}

.descricao-item strong {
    color: #007bff;
}

.detalhes_titulo {
    width: 80%;
    padding-top: 20px;
    padding-left: 20px;
}

#btn-visualizar_detalhes {
    width: auto !important;
}

.btn-principal {
    background: #007cba !important;
    width: auto !important;
}

.btn-principal:hover {
    background: #005a87 !important;
}

.btn-voltar {
    background: #6c757d !important;
}

.btn-voltar:hover {
    background: #545b62 !important;
}

#div-voltar .btn-voltar {
    width: 100px !important;
}

#temporadas-container h2 {
    margin-top: 30px;
}

/* Estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-ponta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-template-rows: repeat(auto-fit, minmax(104px, 45%));
    gap: 20px;
}

.stat-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 1px 1px 3px black;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    height: 100%;
}

.stat-card:hover {
    transform: scale(1.03);
}

.stat-card h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 14px;
    font-weight: normal;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #007cba;
    display: block;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.stat-text {
    font-size: 24px;
    font-weight: bold;
    color: #007cba;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.chart-container {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 1px 1px 3px black;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.chart-ordena {
    display: flex;
    justify-content: start;
    align-items: center;
    margin-bottom: 10px;
}

.chart-check {
    width: auto !important;
    margin-left: 10px;
}

@media (min-width: 768px) {
    .chart-wrapper {
        height: 400px;
        margin: 0 auto;
    }
}

/* Responsividade */
@media (min-width: 951px) {
    .dropdown {
        display: none;
    }

    .navbar-desktop {
        display: flex;
    }
}

@media (max-width: 950px) {
    .navbar-desktop {
        display: none;
    }

    .dropdown {
        display: inline-block;
    }

    .dropdown-btn {
        width: 100% !important;
        height: 50px;
        margin: 0 !important;
        padding: 30px 20px !important;
        text-align: center;
        font-size: 24px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
    }
}

@media (max-width: 768px) {

    .navbar {
        gap: 10px;
        padding: 15px;
    }

    .navbar-brand {
        gap: 10px;
    }

    .navbar-brand h1 {
        font-size: 24px;
    }

    .navbar-menu {
        display: flex;
        justify-content: center;
    }
    .dropdown-content {
        right: 0;
        width: 200px;
    }

    #app-content {
        margin: 10px;
    }

    #app-content h1 {
        font-size: 36px;
        margin: 30px 10px;
        text-align: center;
    }

    h2 {
        margin-left: 15px;
    }

    .anime {
        flex-direction: column;
        align-items: center;
        margin: 20px 10px;
        padding: 15px;
    }

    .anime-image {
        width: 100%;
        height: 250px;
        margin-right: 0;
        margin-bottom: 15px;
        border: 0.5px black solid;
    }

    .anime-content {
        width: 100%;
    }

    #loginForm h2 {
        margin-left: 1px !important;
    }

    #loginStatus .danger {
        margin-left: 0px;
    }

    input,
    select,
    textarea {
        width: 100%;
        max-width: 100%;
        margin: 5px 0;
    }

    .form-container {
        padding: 15px;
    }

    button:not(.select2-selection__clear) {
        width: 100%;
        margin: 5px 0;
    }

    .admin-header {
        flex-direction: column;
        gap: 10px;
    }

    .botoes-anime {
        justify-content: center;
    }

    .btn-visualizar {
        width: 90px !important;
    }

    .btn-alterar {
        width: 90px !important;
    }

    .botoes-topo {
        flex-direction: column;
        margin: 0 15px 20px 15px;
    }

    .botoes-esquerda {
        flex-direction: column;
        width: 100%;
    }

    .filtros-direita {
        flex-direction: column;
        width: 100%;
    }

    .pesquisa-container {
        width: 100%;
    }

    #pesquisaAnime {
        flex: 1 !important;
        width: auto !important;
    }

    #toggleFiltros {
        width: 50px !important;
        flex-shrink: 0;
    }

    #filtrosAvancados {
        position: static !important;
        flex-direction: column;
        width: 100%;
        box-shadow: none;
        border: none;
        padding: 0;
        background: transparent;
    }

    #filtroGenero {
        width: 100% !important;
    }

    #filtroNota {
        width: 100% !important;
    }

    #filtroOrdem {
        width: 100% !important;
    }

    #limparFiltros {
        width: 100% !important;
    }

    #toggleComentarios {
        margin: 0;
        width: 100% !important;
    }

    #adicionar {
        margin: 0;
        width: 100% !important;
    }

    #btnOutros {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .form-container {
        margin: 20px 10px;
    }

    .select2 {
        width: 100% !important;
    }

    #opcoes {
        margin-left: 1px;
    }

    #opcoesVincular {
        margin-left: 1px;
    }

    #animeExistente {
        width: 100% !important;
    }

    #generoApi {
        margin-left: 0;
        gap: 5px;
    }

    #generoJikan {
        margin-left: 0;
    }
    
    #imagemSelect {
        width: 100% !important;
    }

    #generoApiVincular {
        margin-left: 0;
        gap: 5px;
    }

    #animeApiVincular {
        width: 100% !important;
    }

    #animeJikanVincular {
        width: 100% !important;
    }

    #imagemSelectVincular {
        width: 100% !important;
    }

    #animeVinculado {
        margin-left: 0;
    }

    small {
        margin-left: 3px;
        display: block;
    }

    .google-btn {
        width: 100%;
        justify-content: center;
    }

    .btn-voltar {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    #div-voltar {
        padding: 0 10px;
    }

    .btn-outros {
        width: 100% !important;
        margin-right: 0 !important;
    }

    .logout-btn {
        width: 100% !important;
    }

    .admin-header {
        justify-content: center;
        align-items: center;
    }

    .admin-header div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0px !important;
    }

    .admin-header h2 {
        margin: 0 5px;
        font-size: 20px;
    }

    .admin-header div .logout-btn {
        order: -1;
    }

    .anime-detalhes-container {
        flex-direction: column;
        margin: 10px;
        padding: 15px;
    }

    .anime-detalhes-content h2 {
        margin-left: 1px;
    }

    #anime-detalhes .danger {
        margin: 10px !important;
    }

    .anime-image-detalhes {
        width: 100%;
        max-width: 500px;
        align-self: center;
    }

    .detalhes_titulo {
        font-size: 28px;
        margin: 15px 10px;
        padding: 0 15px;
        width: 100%;
        text-align: left;
    }

    .btn-voltar {
        width: 100% !important;
    }

    .btn-alterar-detalhes {
        width: 100% !important;
        padding: 10px 10% !important;
        margin-top: 0 !important;
    }

    .btn-assistir-detalhes {
        top: 35px !important;
        width: 100% !important;
        padding: 10px 10% !important;
    }

    .divAlterar {
        width: 50% !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-ponta {
        grid-template-rows: auto;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-number {
        font-size: 24px;
    }

    #estatisticas-content {
        margin: 20px;
    }

    .chart-container {
        margin-top: 20px;
        padding: 20px 10px;
        background: white;
        border-radius: 8px;
        box-shadow: 1px 1px 3px black;
    }

    .chart-titulo {
        text-align: center;
        margin: 5px 0 10px;
    }

    .chart-ordena {
        margin-left: 5px;
    }
}