/* ============================================
   Portal de Jogos - Abraca do Bem
   Estilos principais
   ============================================ */

:root {
    --primary: #2c3e50;
    --primary-light: #34495e;
    --accent: #e74c3c;
    --accent-hover: #c0392b;
    --success: #27ae60;
    --warning: #f39c12;
    --info: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --white: #ffffff;
    --gray: #95a5a6;
    --gray-light: #bdc3c7;
    --bg: #f5f6fa;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-lg: 0 5px 20px rgba(0,0,0,0.15);
    --radius: 10px;
    --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== NAVBAR ========== */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 8px;
}
.navbar-brand:hover { text-decoration: none; color: var(--light); }
.navbar-brand span { font-size: 1.5rem; }

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 5px;
    align-items: center;
}

.navbar-nav a {
    color: rgba(255,255,255,0.85);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-size: 0.9rem;
}
.navbar-nav a:hover {
    background: rgba(255,255,255,0.15);
    color: var(--white);
    text-decoration: none;
}

.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.container-sm { max-width: 500px; margin: 40px auto; padding: 0 20px; }
.container-md { max-width: 800px; margin: 0 auto; padding: 20px; }

/* ========== CARDS ========== */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-header { font-size: 1.2rem; font-weight: bold; margin-bottom: 15px; color: var(--primary); }

/* ========== GRID ========== */
.grid {
    display: grid;
    gap: 20px;
}
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ========== STATS CARDS ========== */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--info);
}
.stat-card .stat-number { font-size: 2rem; font-weight: bold; color: var(--primary); }
.stat-card .stat-label { color: var(--gray); font-size: 0.85rem; margin-top: 5px; }

/* ========== FORMS ========== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--light);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s;
    background: var(--white);
}
.form-control:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ========== BUTTONS ========== */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary { background: var(--info); color: var(--white); }
.btn-primary:hover { background: #2980b9; color: var(--white); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #219a52; color: var(--white); }

.btn-danger { background: var(--accent); color: var(--white); }
.btn-danger:hover { background: var(--accent-hover); color: var(--white); }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #e67e22; color: var(--white); }

.btn-secondary { background: var(--gray); color: var(--white); }
.btn-secondary:hover { background: #7f8c8d; color: var(--white); }

.btn-lg { padding: 14px 30px; font-size: 1.1rem; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }

/* ========== ALERTS ========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.95rem;
    border-left: 4px solid;
}
.alert-success { background: #d4edda; color: #155724; border-color: var(--success); }
.alert-danger { background: #f8d7da; color: #721c24; border-color: var(--accent); }
.alert-warning { background: #fff3cd; color: #856404; border-color: var(--warning); }
.alert-info { background: #d1ecf1; color: #0c5460; border-color: var(--info); }

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}
.badge-bronze { background: #cd7f32; color: var(--white); }
.badge-prata { background: #c0c0c0; color: var(--dark); }
.badge-ouro { background: #ffd700; color: var(--dark); }
.badge-iniciante { background: var(--gray-light); color: var(--dark); }
.badge-basico { background: var(--success); color: var(--white); }
.badge-medio { background: var(--warning); color: var(--white); }
.badge-alto { background: var(--accent); color: var(--white); }
.badge-ativo { background: var(--success); color: var(--white); }
.badge-inativo { background: var(--gray); color: var(--white); }

/* ========== TABLES ========== */
.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
table th {
    background: var(--primary);
    color: var(--white);
    padding: 12px 15px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
}
table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--light);
    font-size: 0.9rem;
}
table tr:hover { background: rgba(52,152,219,0.05); }
table tr.highlight { background: rgba(52,152,219,0.1); }

/* ========== PROGRESS BAR ========== */
.progress {
    background: var(--light);
    border-radius: 50px;
    height: 12px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar {
    height: 100%;
    border-radius: 50px;
    background: linear-gradient(90deg, var(--info), var(--success));
    transition: width 0.5s ease;
}

/* ========== TEMA CARDS ========== */
.tema-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    text-align: center;
    transition: all 0.3s;
    border-top: 4px solid var(--info);
    position: relative;
    overflow: hidden;
}
.tema-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.tema-card .tema-icone { font-size: 3rem; margin-bottom: 10px; }
.tema-card .tema-nome { font-size: 1.2rem; font-weight: bold; color: var(--primary); margin-bottom: 8px; }
.tema-card .tema-desc { color: var(--gray); font-size: 0.85rem; margin-bottom: 15px; }
.tema-card .tema-info { font-size: 0.8rem; color: var(--gray); margin-bottom: 12px; }
.tema-card .tema-alerta { font-size: 0.8rem; color: var(--accent); font-weight: bold; }

/* ========== CROSSWORD GRID ========== */
.cruzada-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.cruzada-grid-wrapper {
    flex: 0 0 auto;
    overflow-x: auto;
}

.cruzada-grid {
    border-collapse: collapse;
    margin: 0 auto;
}

.cruzada-grid td {
    width: 38px;
    height: 38px;
    border: 2px solid var(--primary);
    text-align: center;
    vertical-align: middle;
    padding: 0;
    position: relative;
    background: var(--white);
}

.cruzada-grid td.blocked {
    background: var(--primary);
    border-color: var(--primary);
}

.cruzada-grid td .cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: 9px;
    color: var(--gray);
    font-weight: bold;
    z-index: 1;
}

.cruzada-grid td input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    background: transparent;
    color: var(--dark);
    outline: none;
    padding: 0;
}

/* Word boundaries - thick colored borders to delimit words */
.cruzada-grid td.word-start-h { border-left: 4px solid var(--accent); }
.cruzada-grid td.word-end-h { border-right: 4px solid var(--accent); }
.cruzada-grid td.word-start-v { border-top: 4px solid var(--info); }
.cruzada-grid td.word-end-v { border-bottom: 4px solid var(--info); }

/* Pre-filled hint letters */
.cruzada-grid td input.hint-letter {
    color: var(--info);
    background: #eef6ff;
    cursor: default;
}
.cruzada-grid td:has(input.hint-letter) {
    background: #eef6ff;
}

.cruzada-grid td.active {
    background: #eaf4fe;
}

.cruzada-grid td.current {
    background: #bee3f8;
}

.cruzada-grid td.correct {
    background: #d4edda !important;
}
.cruzada-grid td.correct input { color: var(--success); }

.cruzada-grid td.wrong {
    background: #f8d7da !important;
}
.cruzada-grid td.wrong input { color: var(--accent); }

/* ========== HINTS PANEL ========== */
.dicas-panel {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.dicas-panel h3 {
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--light);
    font-size: 1rem;
}

.dica-item {
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.88rem;
    transition: background 0.2s;
    line-height: 1.4;
}
.dica-item:hover { background: var(--light); }
.dica-item.active { background: #bee3f8; }
.dica-item .dica-num {
    font-weight: bold;
    color: var(--accent);
    margin-right: 5px;
}

/* ========== RESULTADO ========== */
.resultado-score {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: var(--radius);
    margin-bottom: 25px;
}
.resultado-score .score-big {
    font-size: 3rem;
    font-weight: bold;
}
.resultado-score .score-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

.palavra-resultado {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--light);
}
.palavra-resultado .icone-resultado { font-size: 1.2rem; }
.palavra-resultado .palavra-texto { font-weight: bold; }
.palavra-resultado .palavra-dica { color: var(--gray); font-size: 0.85rem; }

/* ========== AUTH PAGES ========== */
.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 35px;
    margin-top: 40px;
}
.auth-card h2 {
    text-align: center;
    color: var(--primary);
    margin-bottom: 25px;
}

.code-input {
    text-align: center;
    font-size: 2rem;
    letter-spacing: 12px;
    font-weight: bold;
    padding: 15px;
}

/* ========== GAME ACTIONS ========== */
.game-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ========== PERFIL ========== */
.perfil-header {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    border-radius: var(--radius);
    margin-bottom: 25px;
}
.perfil-header .perfil-nome { font-size: 1.8rem; font-weight: bold; }
.perfil-header .perfil-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}
.perfil-header .perfil-stat-item { text-align: center; }
.perfil-header .perfil-stat-value { font-size: 1.5rem; font-weight: bold; }
.perfil-header .perfil-stat-label { font-size: 0.8rem; opacity: 0.8; }

/* ========== PAGINATION ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--white);
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}
.pagination .active { background: var(--info); color: var(--white); }

/* ========== FOOTER ========== */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--gray);
    font-size: 0.85rem;
    border-top: 1px solid var(--light);
}

/* ========== UTILITIES ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.gap-10 { gap: 10px; }
.hidden { display: none; }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .navbar { padding: 0 15px; }
    .navbar-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--primary);
        padding: 10px;
        box-shadow: var(--shadow);
    }
    .navbar-nav.active { display: flex; }
    .navbar-toggle { display: block; }

    .container { padding: 15px; }

    .cruzada-container { flex-direction: column; align-items: center; }
    .dicas-panel { max-width: 100%; }

    .cruzada-grid td { width: 32px; height: 32px; }
    .cruzada-grid td input { font-size: 0.9rem; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

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

    .resultado-score .score-big { font-size: 2rem; }
}

@media (max-width: 480px) {
    .cruzada-grid td { width: 28px; height: 28px; }
    .cruzada-grid td input { font-size: 0.8rem; }
    .cruzada-grid td .cell-number { font-size: 7px; }

    .auth-card { padding: 20px; }
    .code-input { font-size: 1.5rem; letter-spacing: 8px; }
}
