* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --gray: #95a5a6;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--primary);
    color: white;
    position: fixed;
    height: 100vh;
    padding: 20px 0;
}

.logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.logo h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.logo p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.nav-menu {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    transition: 0.3s;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255,255,255,0.1);
}

.nav-link i {
    margin-right: 10px;
    width: 20px;
}

.sidebar-footer {
    position: absolute;
    bottom: 20px;
    padding: 0 20px;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px;
}

header {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Botões */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-primary { background: var(--secondary); color: white; }
.btn-secondary { background: var(--gray); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.9rem; }

.btn:hover { opacity: 0.9; }

/* Dashboard */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.dashboard-card .valor {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
}

/* Equipamentos */
.equipamentos-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.equipamento-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.equipamento-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.Operacional { background: #d4edda; color: #155724; }
.status-badge.Em\ Manutenção { background: #fff3cd; color: #856404; }
.status-badge.Aguardando\ Peça { background: #cce5ff; color: #004085; }
.status-badge.Desativado { background: #f8d7da; color: #721c24; }

/* Formulários */
.form-cadastro {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ========== JOGOS ========== */
.jogos-container {
    padding: 20px;
}

.jogos-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    position: relative;
    text-align: center;
}

.jogos-header h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 10px;
}

.jogos-timer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 8px;
}

.jogos-menu {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 10px;
}

.jogo-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.jogo-btn i {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--gray);
}

.jogo-btn span {
    color: var(--gray);
}

.jogo-btn:hover { background: var(--light); }
.jogo-btn.active { background: #e3f2fd; }
.jogo-btn.active i,
.jogo-btn.active span { color: var(--secondary); }

.area-jogo {
    background: white;
    border-radius: 15px;
    padding: 30px;
    min-height: 500px;
}

/* Jogo da Velha */
.grid-velha {
    display: grid;
    grid-template-columns: repeat(3, 120px);
    gap: 10px;
    justify-content: center;
    margin: 30px auto;
}

.celula-velha {
    width: 120px;
    height: 120px;
    background: white;
    border: 2px solid var(--secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.celula-velha:hover { background: var(--light); }
.celula-velha.x { color: var(--danger); }
.celula-velha.o { color: var(--secondary); }
.celula-velha.vitoria { background: #d4edda; border-color: var(--success); }

/* Jogo da Memória */
.grid-memoria {
    display: grid;
    grid-template-columns: repeat(4, 100px);
    gap: 15px;
    justify-content: center;
    margin: 30px auto;
}

.carta-memoria {
    width: 100px;
    height: 120px;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}

.carta-frente,
.carta-verso {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: 0.6s;
}

.carta-frente {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.carta-verso {
    background: white;
    border: 2px solid var(--secondary);
    transform: rotateY(180deg);
}

.carta-memoria.virada .carta-frente { transform: rotateY(180deg); }
.carta-memoria.virada .carta-verso { transform: rotateY(0); }
.carta-memoria.encontrada .carta-verso { background: #d4edda; border-color: var(--success); }

/* Quiz */
.pergunta-texto {
    font-size: 1.3rem;
    padding: 20px;
    background: var(--light);
    border-radius: 10px;
    border-left: 5px solid var(--secondary);
    margin-bottom: 25px;
}

.opcoes-container {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.opcao-quiz {
    padding: 15px 20px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    text-align: left;
}

.opcao-quiz:hover { border-color: var(--secondary); }
.opcao-quiz.selecionada { background: #cce5ff; border-color: var(--secondary); }
.opcao-quiz.correta { background: #d4edda; border-color: var(--success); }
.opcao-quiz.incorreta { background: #f8d7da; border-color: var(--danger); }

/* Ranking */
.ranking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.ranking-card {
    background: var(--light);
    padding: 20px;
    border-radius: 10px;
}

.ranking-card h4 {
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary);
    margin-bottom: 20px;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ranking-table th,
.ranking-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.ranking-table th { background: #e9ecef; }

/* Responsividade */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .grid-velha {
        grid-template-columns: repeat(3, 80px);
    }
    
    .celula-velha {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
    
    .grid-memoria {
        grid-template-columns: repeat(2, 80px);
    }
    
    .carta-memoria {
        width: 80px;
        height: 100px;
    }
}