/* style.css */
:root {
    --primary-color: #007bff;
    /* Azul tema */
    --secondary-color: #f8f9fa;
    /* Fundo claro */
    --piece-border: #333;
    --slot-bg: #e9ecef;
    --board-size: 400px;
    /* Tamanho base do tabuleiro, ajuste conforme necessário */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--secondary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
    background-color: var(--primary-color);
    color: white;
    padding: 0;
    border-radius: 0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--primary-color);
}

.logo {
    flex: 1;
}

.home-link {
    color: white;
    text-decoration: none;
    font-size: 1.3em;
    font-weight: bold;
    transition: opacity 0.3s ease;
}

.home-link:hover {
    opacity: 0.8;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-8px, -8px);
}

.navbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    padding: 10px 20px;
    background-color: var(--primary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    transition: background-color 0.3s ease, padding 0.3s ease;
    font-size: 0.95em;
    white-space: nowrap;
    border-radius: 4px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

header h1 {
    color: white;
    margin-bottom: 15px;
    margin-top: 15px;
    font-size: 1.8em;
    padding: 10px 20px 15px;
}

#puzzle-nav {
    display: flex;
    flex-wrap: wrap;
}

.container-puzzles {
    padding: 20px;
}

main {
    width: 100%;
    max-width: 900px;
    /* Ajuste para caber tudo confortavelmente */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-controls {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    /* Para melhor ajuste em telas menores */
    justify-content: center;
    /* Centraliza os controles */
}

.game-controls label {
    font-weight: bold;
}

.game-controls select,
.game-controls button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

.game-controls button {
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.game-controls button:hover {
    background-color: #0056b3;
}

#puzzle-area {
    display: flex;
    flex-wrap: wrap;
    /* Para telas menores, o pieces-container pode ir para baixo */
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    width: 100%;
}

#puzzle-board {
    width: var(--board-size);
    height: var(--board-size);
    display: grid;
    border: 2px solid var(--piece-border);
    background-color: #fff;
    /* Fundo branco para o tabuleiro em si */
    position: relative;
}

.puzzle-slot {
    width: 100%;
    height: 100%;
    border: 2px dashed #aaa;
    background-color: var(--slot-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.puzzle-slot.over {
    /* Classe para feedback de arrastar sobre */
    background-color: #d0e0ff;
    border-style: solid;
    border-color: var(--primary-color);
    box-shadow: inset 0 0 10px rgba(0, 123, 255, 0.3);
}

.puzzle-slot.filled {
    background-color: #e8f5e9;
    border-color: #4caf50;
    border-style: solid;
}

#pieces-container {
    width: var(--board-size);
    min-height: var(--board-size);
    padding: 10px;
    border: 2px dashed var(--primary-color);
    background-color: #f0f0f0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 8px;
    border-radius: 8px;
}

.puzzle-piece {
    border: 2px solid var(--piece-border);
    cursor: grab;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    touch-action: none;
    border-radius: 4px;
    background-color: white;
    /* Essencial para interações de toque suaves, previne scroll/zoom na peça */
    /* As dimensões (width/height) são definidas via JS */
}

.puzzle-piece:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Estilo para a peça quando está sendo ativamente movida pelo mouse (HTML5 D&D) */
.puzzle-piece:active {
    cursor: grabbing;
    /* Efeitos de transform/box-shadow podem ser gerenciados pela API D&D ou classes JS
       para evitar conflitos com a lógica de toque. */
    z-index: 1000;
    /* Garante que a peça fique acima das outras */
}

/* Estilo para a peça quando está sendo arrastada por toque */
.puzzle-piece.dragging-touch {
    transform: scale(1.15);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color);
    background-color: #e3f2fd;
    /* z-index e position:fixed são aplicados via JS */
}

#preview-area {
    margin-top: 20px;
    text-align: center;
}

#preview-image {
    max-width: 100%;
    height: auto;
    /* Mantém a proporção */
    max-height: 200px;
    /* Limita a altura da pré-visualização */
    border: 1px solid #ccc;
    border-radius: 4px;
}

#message-area {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid transparent;
    /* Borda base */
    border-radius: 4px;
    text-align: center;
    font-size: 1.2em;
    width: 100%;
    max-width: 900px;
}

#footer-container{
    width: 100%;;
}

footer {
    background-color: #2c3e50;
    color: white;
    margin-top: 40px;
    padding: 40px 20px 20px;
    width: 100%;
    font-size: 0.9em;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto 30px;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #444;
    color: #95a5a6;
}

.footer-bottom p {
    margin: 0;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsividade */
@media (max-width: 768px) {
    :root {
        --board-size: 300px;
        /* Reduz o tabuleiro em telas menores */
    }

    .menu-toggle {
        display: flex;
    }

    .navbar {
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border-top: none;
        padding: 0 20px;
    }

    .navbar.active {
        max-height: 500px;
        padding: 10px 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link {
        padding: 12px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: left;
        border-radius: 0;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .header-top {
        padding: 12px 15px;
    }

    .logo {
        flex: 1;
        text-align: left;
    }

    .home-link {
        font-size: 1.1em;
    }

    header h1 {
        font-size: 1.4em;
        margin-bottom: 10px;
        margin-top: 10px;
        padding: 5px 20px 10px;
    }

    #puzzle-area {
        flex-direction: column;
        align-items: center;
    }

    #pieces-container {
        width: 100%;
        max-width: var(--board-size);
        /* Mantém a mesma largura do tabuleiro */
        min-height: 150px;
        /* Ajusta altura mínima do container de peças */
    }

    .game-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    :root {
        --board-size: 240px;
        /* Ainda menor para celulares */
    }

    .home-link {
        font-size: 1em;
    }

    header h1 {
        font-size: 1.2em;
    }

    .nav-link {
        font-size: 0.9em;
        padding: 10px 0;
    }

    .game-controls select,
    .game-controls button {
        font-size: 0.9em;
        /* Reduz um pouco a fonte nos controles */
    }

    #preview-image {
        max-height: 150px;
    }

    footer {
        padding: 30px 15px 15px;
    }

    .footer-section h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    .footer-section ul li {
        margin-bottom: 8px;
    }

    .footer-section a {
        font-size: 0.85em;
    }

    .footer-bottom {
        font-size: 0.8em;
    }
}

/* Page Content Styles */
.page-content {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.page-content h2 {
    color: var(--primary-color);
    margin-top: 30px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.page-content p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: #555;
}

.page-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
}

.page-content ul li {
    margin-bottom: 10px;
    line-height: 1.7;
    color: #555;
}

.page-content a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.page-content a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Contact Form Styles */
.contact-form {
    margin: 30px 0;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Arial', sans-serif;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.submit-btn {
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    align-self: flex-start;
}

.submit-btn:hover {
    background-color: #0056b3;
}

.form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
    display: none;
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Contact Info Grid */
.contact-info {
    margin-top: 40px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.info-item {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.info-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.info-item p {
    margin: 0;
}

/* Values Grid */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.value-item {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-top: 4px solid var(--primary-color);
    text-align: center;
}

.value-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.value-item p {
    margin: 0;
}

/* Legal Content */
.legal-content {
    line-height: 1.9;
}

.legal-content strong {
    color: #333;
}

/* Responsive Styles for Page Content */
@media (max-width: 768px) {
    .page-content {
        margin: 20px 10px;
        padding: 15px;
    }

    .puzzle-piece {
        border-width: 2px;
    }

    .puzzle-piece:hover {
        transform: scale(1.08);
    }

    .puzzle-piece.dragging-touch {
        transform: scale(1.2);
    }

    #puzzle-area {
        gap: 15px;
    }

    #pieces-container {
        gap: 10px;
    }

    .page-content h2 {
        font-size: 1.4em;
    }

    .contact-form {
        padding: 15px;
    }

    .info-grid,
    .values-grid {
        grid-template-columns: 1fr;
    }

    .submit-btn {
        width: 100%;
        align-self: stretch;
    }
}