/* styles.css */
:root{
    --bg: #f4f4f4;
    --panel: #f8f9fa;
    --text: #333333;
    --tab-text: #ffffff;
    --game-text: #555;
    --muted: #dddddd;
    --border: #333333;
    --accent: #007bff;
    --header-bg: #333333;
    --chat-bg: #252525;
    --chat-input-bg: #333333;
    --chat-button-bg: #f0c674;
    --model-bg: #666666;
    --container-bg: #f9f9f9;
    --character-bg: #f1f3f5;
    --form-bg: #ffffff;
    --separator: repeating-linear-gradient(to right, #666 0 5px, #666 2px 12px);
    --transition: 200ms ease;
}

[data-theme="dark"]{
    --bg: #0b0f14; /* fundo bem escuro */
    --panel: #0f151a; /* painel levemente mais claro que o fundo */
    --text: #e6eef8; /* texto claro para contraste */
    --tab-text: #ffffff; /* texto em abas / cabeçalho claro */
    --game-text: #a9bac6; /* texto secundário com tom azulado */
    --muted: #6f7c85; /* tons atenuados para elementos secundários */
    --border: #22303a; /* bordas discretas, visíveis no escuro */
    --accent: #4da3ff; /* destaque azul para ações */
    --header-bg: #071018; /* cabeçalho um pouco distinto do fundo */
    --chat-bg: #0e1418; /* área do chat escura, porém diferente do fundo */
    --chat-input-bg: #0b1216; /* input do chat ligeiramente contrastante */
    --chat-button-bg: #e5b762; /* botão do chat em tom quente para chamar atenção */
    --model-bg: #24303a; /* fundo do modal mais fechado para contraste */
    --container-bg: #0b1216; /* container com tom levemente diferente do painel */
    --character-bg: #0c1418; /* fundo de personagens com leve variação */
    --form-bg: #0b1216;
    --separator: repeating-linear-gradient(to right, #37444d 0 5px, #37444d 2px 12px); /* separador adaptado ao tema escuro */
    --transition: 200ms ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}
main {
    flex: 1;
}
header {
    background: var(--header-bg);
    color: var(--tab-text);
    padding: 15px 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#login {
    background-image: url(../imagens/site_copy.png);
    background-repeat: no-repeat;
    background-size: cover; 
    background-position: center;
    padding: 0;
}

#login img{
    padding-right: 10%;
    width: 45%;
    object-fit: contain;
    max-width: 100%;
    height: auto;
}

#login .auth-section {
    background: none;
    width: 50%;
    padding-top: 5px;
}
#login form {
    height: 50%;
    width: 50%;
    padding: 5px;
}
#login input {
    width: 100%;
    box-sizing: border-box;
}
#login a, #login form input, #login form input, #login form button, #login form label{
    font-size: 16px;
}

.btn-jogos {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
}
.btn-jogos:hover {
    background-color: #0056b3;
}
h1, h2 {
    text-align: center;
}
header .logo {
    font-size: 24px;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav-links li {
    margin-left: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

.auth-buttons .btn {
    background-color: #444;
    color: white;
    padding: 8px 15px;
    margin-left: 10px;
    border-radius: 4px;
    text-decoration: none;
}

.auth-buttons .btn:hover {
    background-color: #555;
}

.hero {
    background-color: #007BFF;
    color: white;
    padding: 100px 0;
    text-align: center;
}

.hero h2 {
    font-size: 36px;
}

.hero p {
    font-size: 18px;
    margin: 20px 0;
}

.btn-primary {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
}

.btn-secondary {
    background-color: #17a2b8;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    margin-left: 10px;
}
.btn-secondary:hover {
    background-color: #0056b3;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
}

.btn-danger:hover {
    background-color: #c82333;
}

.features {
    padding: 50px 0;
    background-color: #fff;
}

.features h2 {
    text-align: center;
    margin-bottom: 30px;
}

.feature-list {
    display: flex;
    justify-content: space-around;
}

.feature {
    width: 30%;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 4px;
}

.feature h3 {
    font-size: 24px;
    margin-bottom: 15px;
}

.feature p {
    font-size: 16px;
}

.contact {
    background-color: #eee;
    padding: 50px 0;
}

  /* Estilos para as mensagens de erro pro usuario */
.message {
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
    font-size: 14px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

  /* Estilos para pagina do jogo */
.game-page {
    display: flex;
    height: 100vh;
}
.game-page .left-panel {
    flex: 2;
    display: flex;
    flex-direction: column; /* Alinhar itens em coluna */
    padding: 10px;
    border-right: 2px solid var(--border);
}

.left-panel .top-buttons {
    display: flex;
    gap: 10px; /* Espaçamento entre botões */
    margin-bottom: 20px; /* Espaço abaixo dos botões */
}
.top-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 10px; /* Espaçamento entre os botões */
    padding: 10px;
    background: var(--panel); /* Fundo adaptável */
    border-bottom: 2px solid var(--muted);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    color: #fff;
    background-color: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-icon:hover {
    background-color: #0056b3;
    transform: scale(1.1); /* Efeito de zoom ao passar o mouse */
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

a.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #fff;
    width: 40px;
    height: 40px;
    background-color: #6c757d;
    border-radius: 50%;
    font-size: 1.2rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

a.btn-icon:hover {
    background-color: #5a6268;
    transform: scale(1.1);
}
#manageRelations{
    background-color: #28a745;
}
#createCharacter{
    background-color:rgb(223, 205, 42);
}

.left-panel .container {
    margin-bottom: 20px; /* Espaço abaixo do conteúdo */
}

#characterContainer {
    flex-grow: 1; /* Faz a lista ocupar o restante do espaço */
    overflow-y: auto; /* Adiciona rolagem se necessário */
    background: var(--container-bg); /* Adapta ao tema */
    color: var(--text);
    padding: 10px;
    border-radius: 5px;
}
.character-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--character-bg);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transition: filter 0.18s ease, box-shadow 0.18s ease;
}

.character-item:hover {
    filter: brightness(0.98);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.character-button {
    display: inline-block;
    padding: 10px 15px;
    font-size: 1rem;
    color: var(--text);
    background: var(--character-bg);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.3s ease;
}

/*.character-button:hover {
    background-color: #0056b3;
}*/
.character-name {
    margin: 0;
    margin-right: 10px; /* Espaçamento entre o nome e o botão */
}
.delete-character {
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 10px 12px;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.delete-character:hover {
    background-color: #c82333;
}


.game-page .right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--border);
    width: 33%;
}
.game-page .chat-log {
    flex: 1;
    height: 400px;
    padding: 10px;
    overflow-y: auto;
    /* Chat log deve permanecer com aparência escura fixa */
    background-color: #252525;
    color: #ffffff;
}
.game-page .chat-message {
    margin-bottom: 10px;
}
.game-page .chat-message .name {
    font-weight: bold;
    color: #f0c674;
}
.game-page .chat-input {
    display: flex;
    border-top: 2px solid #333;
}
.game-page .chat-input input[type="text"] {
    flex: 1;
    padding: 10px;
    border: none;
    outline: none;
    background: var(--chat-input-bg);
    color: var(--tab-text);
}
.game-page .chat-input button {
    padding: 10px;
    background: var(--chat-button-bg);
    border: none;
    cursor: pointer;
}
.game-page .chat-input button:hover {
    background-color: #e5b762;
}

.scroll-to-bottom {
    display: none;
    position: absolute;
    bottom: 85px;
    right: 15px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: #54bbff;
    color: #333;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.scroll-to-bottom:hover {
    background-color: #e5b762;
    transform: scale(1.1);
}

.scroll-to-bottom.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-message.dado {
    text-align: center;
    
}

.user-name {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 10px;
}

.dice-container {
    position: relative;
    display: inline-block;
    margin: 10px 0;
}

.dice-image {
    width: 60%;
    height: 60%;
}

.dice-number {
    position: absolute;
    top: 50%;
    left: 49.5%;
    transform: translate(-50%, -50%);
    font-size: 35px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.7);
}

.message-text {
    font-size: 30px;
    margin-top: 10px;
    display: inline-block;
}

.chat-message .message {
    white-space: normal;        /* permite quebra de linha */
    overflow-wrap: anywhere;   /* quebra palavras longas quando necessário */
    word-wrap: break-word;     /* compatibilidade legada */
    hyphens: auto;             /* mostra hífens quando apropriado */
    padding: 0;
}


/* Footer */
footer {
    background: var(--header-bg);
    color: var(--tab-text);
    padding: 10px 0;
    text-align: center;
/*  position: relative;
    bottom: 0;*/
    width: 100%;
    margin-top: auto; /* Mantém o rodapé no fim */
}

/* Seção 'Meus Jogos' */
/* Formulário de criação de jogo */
#criarJogos {
    display: none; /* Formulário escondido inicialmente */
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

/* Inputs e textarea no formulário */
#criarJogos input, #criarJogos textarea, #criarJogos select {
    width: 98%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}
#criarJogos select {
    width: 103.5%;
}
#criarJogos input:focus, #criarJogos textarea:focus, #criarJogos select:focus {
    border-color: #007bff;
    outline: none;
}

/* Botão de submit */
#criarJogos button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#criarJogos button:hover {
    background-color: #0056b3;
}

/* Botão "Criar Jogo" que abre o formulário */
#showFormBtn {
    padding: 12px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
    display: block;
    width: 200px;
    margin-left: auto;
    margin-right: auto;
    transition: background-color 0.3s ease;
}

#showFormBtn:hover {
    background-color: #218838;
}


.user-games {
    padding: 50px 0;
    background-color: #f4f4f4;
}

.user-games h2 {
    text-align: center;
    margin-bottom: 30px;
}

.game-actions {
    text-align: center;
    margin-bottom: 20px;
}

.game-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.game-card {
    background: var(--panel);
    color: var(--text);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.06);
    text-align: center;
    width: 300px;
}

.game-card h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.game-card p {
    font-size: 14px;
    color: var(--game-text);
}
.game-card form{
    background: var(--panel);
}
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-size: 16px;
}

.btn-primary {
    background-color: #28a745;
    color: white;
}

.btn-secondary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover, .btn-secondary:hover {
    opacity: 0.9;
}

/*Form de relação personagem usuario*/
#relationManager {
    display: none;
    background-color: var(--container-bg);
    border: 1px solid var(--muted);
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    margin: 20px auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#relationManager h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: var(--text);
    text-align: center;
}

#addRelationForm label {
    display: block;
    font-size: 1em;
    margin-bottom: 8px;
    color: var(--game-text); 
}

#addRelationForm select {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    background-color: var(--form-bg);
    color: var(--text);
    transition: border-color 0.3s ease;
}

#addRelationForm select:focus {
    border-color: #007bff;
    outline: none;
}

#addRelationForm button {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1em;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#addRelationForm button:hover {
    background-color: #0056b3;
}

#addRelationForm button:active {
    background-color: #004085;
}



/* Estilos para as páginas de Login e Registro */
.auth-section {
    padding: 50px 0;
    background-color: #f4f4f4;
    text-align: center;
}

.auth-section h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 16px;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

button.btn-primary {
    background-color: #28a745;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button.btn-primary:hover {
    opacity: 0.9;
}

p {
    margin-top: 20px;
    font-size: 14px;
}

p a {
    color: #007bff;
    text-decoration: none;
}

p a:hover {
    text-decoration: underline;
}

/* Estilizando o formulário e centralizando-o */
form {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--form-bg);
    border-radius: 8px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 10%;
    left: 10%;
    width: 55%;
    height: 95%;
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-header, .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--model-bg);
    padding: 10px;
    border-bottom: 1px solid var(--muted);
    cursor: grab;
    position: relative;
}

.modal-footer {
    border-top: 1px solid var(--muted);
}

.drag-handle {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.1);
    cursor: grab;
}
.handle-top, .handle-bottom {
    width: 100%;
    height: 100%;
    left: 0;
}

.handle-top {
    top: 0;
    left: 5%;
    width: 95%;
}

.handle-bottom {
    bottom: 0;
}

.handle-left, .handle-right {
    height: 100%;
    width: 10px;
    top: 0;
}

.handle-left {
    left: 0;
}

.handle-right {
    right: 0;
}

.close {
    font-size: 24px;
    color: #bdbdbd;
    cursor: pointer;
}

.close:hover {
    color: red;
}

.modal-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.modal-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    overflow: auto; /* Permitir rolagem dentro do iframe */
}

@media screen and (max-width: 1200px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }

    .hero h2 {
        font-size: 28px;
    }

    .hero p {
        font-size: 16px;
    }

    .feature-list {
        flex-direction: column;
        align-items: center;
    }

    .feature {
        width: 90%;
        max-width: 500px;
    }

    .game-list {
        flex-direction: column;
        align-items: center;
    }

    .game-card {
        width: 90%;
        max-width: 500px;
    }

    form {
        max-width: 90%;
    }
    .handle-top {
        left: 8%;
        width: 92%;
    }
}

@media screen and (max-width: 700px) {
    body {
        font-size: 14px;
    }

    #login {
        background-image: none;
    }

    #login img{
        width: 80%;
        padding-right: 0;
        margin-bottom: 20px;
    }
    
    #login .auth-section {
        width: 90%;
        padding-left: 20px;
    }

    #login form {
        width: 90%;
        height: auto;
    }

    .hero {
        padding: 50px 20px;
    }

    .hero h2 {
        font-size: 22px;
    }

    .hero p {
        font-size: 14px;
    }

    .modal {
        height: 60vh;
        width: 90%;
        left: 5%;
        top: 15%;
        max-height: 70vh;
        top: 5px;
    }
    .handle-top {
        left: 10%;
        width: 90%;
    }

    .game-page {
        flex-direction: column;
        height: auto;
    }

    .game-page .left-panel {
        flex: none;
        border-right: none;
        border-bottom: 2px solid #333;
    }

    .game-page .right-panel {
        flex: none;
        border-left: none;
        min-height: auto;
        height: auto;
        max-height: 60vh;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .game-page .chat-log {
        height: 100%;
        max-height: 70vh;
        flex: 0 0 auto;
    }

    .game-page .chat-input {
        flex-shrink: 0;
    }

    .top-buttons {
        flex-wrap: wrap;
        gap: 5px;
    }

    .feature-list {
        flex-direction: column;
    }

    .feature {
        width: 95%;
        margin: 10px auto;
    }

    form {
        max-width: 95%;
        padding: 15px;
    }

    .form-group input {
        width: 100%;
    }

    #criarJogos input,
    #criarJogos textarea,
    #criarJogos select {
        width: 100%;
        margin-bottom: 15px;
    }

    #criarJogos select {
        width: 100%;
    }

    .game-list {
        flex-direction: column;
        align-items: stretch;
    }

    .game-card {
        width: 100%;
        max-width: 100%;
        margin-bottom: 15px;
    }

    header .container {
        flex-direction: column;
        padding: 10px;
    }

    .nav-links {
        flex-direction: column;
        gap: 10px;
        margin-top: 10px;
    }

    .nav-links li {
        margin: 0;
    }
}
@media screen and (min-width: 3000px) {
    .modal {
        width: 30%;
    }
    .user-name {
        font-size: 70px;
    }

    /* Ajustes para o container do dado em telas enormes: centraliza e evita que o número "empurre" a imagem */
    .dice-container {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 260px; /* garante espaço mínimo */
    }

    /* largura responsiva, mantendo a imagem como bloco */
    .dice-image {
        display: block;
        width: clamp(300px, 10vw, 7000px);
        height: auto;
    }

    /* posicionamento absoluto centralizado sobre a imagem, sem quebra */
    .dice-number {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 65px;
        z-index: 2;
        white-space: nowrap;
        pointer-events: none;
    }

    .message-text {
        font-size: 70px;
        display: block;
        text-align: center;
        margin-top: 10px;
    }

}
/* Separador de mensagens controlado por tema */
.message-separator{
    width:100%;
    height:5px;
    margin-top:10px;
    display:flex;
    justify-content:center;
    background: var(--separator);
}