/* =========================================================
   EUNOCAMP COMBAT UI - GLOBAL STYLESHEET
   Estilo Xports: Agressividade, Velocidade e Competição
   Otimizado para PWA / Native App Experience no Mobile
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Teko:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root { 
    --bg-dark: #050203; 
    --bg-panel: #0f070a; 
    --brand-primary: #b21e20; 
    --brand-secondary: #5f2226; 
    --text-light: #f8f9fa; 
    --text-muted: #878a99;
    --font-combat: 'Teko', sans-serif;
    --font-base: 'Inter', sans-serif;
    --app-safe-bottom: env(safe-area-inset-bottom, 20px); /* Suporte para iPhone com Notch */
}

/* --- APP NATIVE FEEL BASE --- */
html {
    -webkit-text-size-adjust: 100%; /* Previne o redimensionamento automático de texto no modo paisagem */
    scroll-behavior: smooth; /* Rolagem suave nativa */
}

body { 
    background-color: var(--bg-dark); 
    color: var(--text-light); 
    font-family: var(--font-base); 
    overflow-x: hidden; 
    -webkit-tap-highlight-color: transparent; /* Remove o piscar azul/cinza ao tocar em links no mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none; /* Previne o efeito 'bounce' exagerado no topo e base como em apps nativos */
}

/* Otimiza a resposta ao toque em elementos clicáveis */
a, button, input, select, textarea, .btn, .btn-combat, .accordion-button {
    touch-action: manipulation; /* Remove o delay de 300ms de duplo clique em mobile */
}

/* Impede o utilizador de selecionar textos de botões acidentalmente enquanto tenta clicar */
.btn, .btn-combat, .navbar-combat, .accordion-button, .sidebar-header {
    user-select: none;
    -webkit-user-select: none;
}

/* --- SCROLLBAR COMBAT --- */
::-webkit-scrollbar { width: 6px; height: 6px; } /* Ligeiramente mais fino para mobile */
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--brand-secondary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-primary); }

/* --- TIPOGRAFIA AGRESSIVA --- */
h1, h2, h3, h4, h5, h6, .font-combat {
    font-family: var(--font-combat);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* --- BOTÕES XPORTS (SKEW) --- */
.btn, .btn-combat {
    background: linear-gradient(90deg, var(--brand-primary) 0%, #8f1719 100%);
    color: #fff !important;
    font-family: var(--font-combat);
    font-size: 1.2rem;
    letter-spacing: 1.5px;
    padding: 10px 25px; /* Aumentado ligeiramente para melhor Touch Target */
    border: none;
    border-radius: 0 !important;
    position: relative;
    transform: skewX(-15deg) translateZ(0); /* translateZ forca a aceleração de GPU (Hardware Acceleration) */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(178, 30, 32, 0.4);
    cursor: pointer;
    min-height: 44px; /* Regra de Ouro da Apple/Google para botões mobile */
}
.btn span, .btn-combat span, .btn i {
    transform: skewX(15deg); 
}
.btn:hover, .btn-combat:hover {
    background: #fff;
    color: var(--brand-primary) !important;
    box-shadow: 0 8px 20px rgba(178, 30, 32, 0.6);
    transform: skewX(-15deg) scale(1.02) translateZ(0);
}
.btn:active, .btn-combat:active {
    transform: skewX(-15deg) scale(0.95) translateZ(0); /* Efeito de clique físico estilo app */
}

/* Botões Secundários e Contornos */
.btn-outline-light, .btn-secondary {
    background: transparent;
    border: 2px solid var(--text-muted);
    color: var(--text-light) !important;
}
.btn-outline-light:hover, .btn-secondary:hover {
    background: var(--text-muted);
    color: #fff !important;
}

/* --- CARTÕES E PAINÉIS (SHARP EDGES) --- */
.card, .metric-card, .form-section {
    background-color: var(--bg-panel) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-bottom: 3px solid var(--brand-primary) !important; 
    border-radius: 0 !important; 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.card:hover, .metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--brand-primary) !important;
    box-shadow: 0 10px 25px rgba(178, 30, 32, 0.15);
}
.card-header {
    background: transparent !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
}

/* --- SIDEBAR (PAINÉIS ADMIN/PROFESSOR) --- */
#sidebar { 
    min-width: 250px; 
    max-width: 250px; 
    min-height: 100dvh; /* dvh: Dynamic Viewport Height (perfeito para browsers mobile) */
    background-color: var(--bg-panel); 
    border-right: 2px solid var(--brand-secondary); 
    z-index: 1040;
    will-change: transform; /* Otimiza a animação no mobile */
}
#sidebar .sidebar-header { 
    padding: 20px; 
    background: rgba(178, 30, 32, 0.1); 
    border-bottom: 1px solid var(--brand-secondary); 
    text-align: center; 
}
#sidebar .sidebar-header h3 { 
    color: var(--brand-primary); 
    font-weight: 900; 
    letter-spacing: 2px; 
    margin:0;
}
#sidebar ul.components { padding: 20px 0; }
#sidebar ul li a { 
    font-family: var(--font-combat);
    font-size: 1.3rem;
    letter-spacing: 1px;
    padding: 15px 20px; 
    display: block; 
    color: var(--text-light); 
    text-decoration: none; 
    transition: 0.2s; 
    border-left: 3px solid transparent;
}
#sidebar ul li a:hover, #sidebar ul li a.active { 
    background: linear-gradient(90deg, rgba(178,30,32,0.1) 0%, transparent 100%);
    color: #fff; 
    border-left: 5px solid var(--brand-primary); 
    transform: translateX(5px);
}
#sidebar ul li a i { margin-right: 10px; width: 20px; text-align: center; }

/* --- TABELAS RESPONSIVAS --- */
.table-custom { margin-bottom: 0; }
.table-custom thead th {
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-muted) !important;
    font-family: var(--font-combat);
    font-size: 1.1rem;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    white-space: nowrap; /* Evita quebra de cabeçalho em telas pequenas */
}
.table-custom tbody tr td {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255,255,255,0.05) !important;
    color: var(--text-light) !important;
    vertical-align: middle;
}
.table-custom tbody tr:hover td {
    background-color: rgba(178,30,32,0.05) !important;
}

/* --- BADGES (SKEW) --- */
.badge, .badge-combat {
    padding: 6px 12px;
    font-family: var(--font-combat);
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    transform: skewX(-10deg);
    display: inline-block;
    border-radius: 0;
}
.badge span, .badge-combat span {
    display: block;
    transform: skewX(10deg);
}

/* --- INPUTS E FORMULÁRIOS (APP OPTIMIZED) --- */
.form-control, .form-select {
    background-color: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important; 
    color: #fff !important;
    padding: 12px 15px;
    transition: all 0.3s ease;
    min-height: 48px; /* Touch target ideal */
}
.form-control:focus, .form-select:focus {
    box-shadow: none !important;
    border-color: var(--brand-primary) !important;
    border-left: 4px solid var(--brand-primary) !important; 
    background-color: rgba(0, 0, 0, 0.8) !important;
}

/* ==========================================
   NAVBAR COMBAT (XPORTS STYLE)
========================================== */
.navbar-combat {
    background-color: rgba(5, 2, 3, 0.85);
    backdrop-filter: blur(15px); /* Aumentado blur para um efeito mais "vidro" de app */
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 0; /* Mais compacto no mobile */
    transition: all 0.4s ease;
    position: sticky; /* Mantém a navbar visível ao rolar estilo app nativo */
    top: 0;
    z-index: 1030;
}

.navbar-combat .nav-link {
    font-family: var(--font-combat);
    font-size: 1.35rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-light);
    transition: 0.3s;
    position: relative;
    padding: 10px 15px !important; /* Touch target nativo */
}

.navbar-combat .nav-link:hover { color: var(--brand-primary) !important; }

.navbar-combat .nav-link::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--brand-primary);
    transition: 0.3s ease-out;
    transform: skewX(-15deg);
}

.navbar-combat .nav-link:hover::after { width: 100%; }

.logo-combat-nav {
    filter: drop-shadow(0 0 10px rgba(178, 30, 32, 0.4));
    transition: 0.3s;
    max-height: 60px; /* Melhor ajuste em telas pequenas */
}
.logo-combat-nav:hover {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
    transform: scale(1.05) translateZ(0);
}

/* ==========================================
   HERO SECTION 2 (gt-hero-2 parallaxie)
========================================== */
.gt-hero-section-2 {
    position: relative;
    padding: 180px 0 120px 0;
    background-image: url('../img/luta04.png');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    z-index: 1;
    overflow: hidden;
}

.gt-hero-section-2::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, rgba(5,2,3,0.95) 0%, rgba(5,2,3,0.8) 50%, rgba(5,2,3,0.3) 100%);
    z-index: -1;
}

.hero-grid-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 25px 25px;
    z-index: -1;
}

.hero-badge-combat {
    display: inline-block;
    background: var(--brand-primary);
    color: #fff;
    font-family: var(--font-combat);
    font-size: 1.2rem;
    padding: 5px 20px;
    transform: skewX(-15deg);
    box-shadow: 0 4px 15px rgba(178, 30, 32, 0.3);
}
.hero-badge-combat span {
    display: block;
    transform: skewX(15deg);
    letter-spacing: 2px;
}

.hero-title-combat {
    font-size: clamp(3rem, 7vw, 6.5rem); /* clamp é perfeito para adaptação nativa */
    line-height: 0.95;
    color: #fff;
    text-shadow: 4px 4px 0px rgba(0,0,0,0.8);
    margin-top: 15px;
}

.text-brand-primary {
    color: var(--brand-primary);
    text-shadow: 3px 3px 0px #000;
}

.hero-subtitle-combat {
    font-size: 1.15rem;
    color: #ccc;
    max-width: 600px;
    line-height: 1.6;
    border-left: 3px solid var(--brand-primary);
    padding-left: 15px;
    background: linear-gradient(90deg, rgba(178,30,32,0.1) 0%, transparent 100%);
}

.btn-lg-combat {
    font-size: 1.4rem;
    padding: 15px 40px;
}

/* --- IMAGENS DOS CAMPEONATOS --- */
.camp-img-container {
    height: 200px;
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}
.camp-banner {
    width: 100%; height: 100%;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: transform 0.6s ease;
    will-change: transform;
}
.camp-card:hover .camp-banner { transform: scale(1.08) translateZ(0); }
.camp-banner.grayscale { filter: grayscale(100%) opacity(0.7); }

/* ==========================================
   RANKING GLOBAL (WIDGETS)
========================================== */
.rank-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 8px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 4px; /* Suavidade nativa em listas */
}
.rank-row:hover {
    background: rgba(178,30,32,0.1);
    border-left: 4px solid var(--brand-primary);
    transform: translateX(5px) translateZ(0);
}
.rank-1 { background: linear-gradient(90deg, rgba(255,215,0,0.1) 0%, transparent 100%); border-left: 4px solid #ffd700; }
.rank-2 { background: linear-gradient(90deg, rgba(192,192,192,0.1) 0%, transparent 100%); border-left: 4px solid #c0c0c0; }
.rank-3 { background: linear-gradient(90deg, rgba(205,127,50,0.1) 0%, transparent 100%); border-left: 4px solid #cd7f32; }

.rank-pos { font-family: var(--font-combat); font-size: 2rem; width: 45px; text-align: center; line-height: 1; }
.rank-1 .rank-pos { color: #ffd700; }
.rank-2 .rank-pos { color: #c0c0c0; }
.rank-3 .rank-pos { color: #cd7f32; }

.rank-points {
    font-family: var(--font-combat);
    font-size: 1.8rem;
    color: #fff;
    width: 80px;
    text-align: right;
    line-height: 1;
}
.rank-points span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    font-family: var(--font-base);
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* =========================================================
   MOBILE APP NATIVE EXPERIENCE (MEDIA QUERIES)
   O segredo da adaptação perfeita para Smartphone
========================================================= */

@media (max-width: 768px) {
    
    /* Proteção iOS Safari: Evita o zoom na tela ao focar num input */
    .form-control, .form-select, input, textarea {
        font-size: 16px !important; 
    }

    /* Espaçamentos mais inteligentes para toque de polegar */
    .card, .metric-card, .form-section {
        padding: 15px !important;
        margin-bottom: 15px;
    }

    /* Botoes de acao 100% da largura da tela para touch facil */
    .btn-mobile-full {
        width: 100%;
        display: flex;
        justify-content: center;
        margin-top: 10px;
    }

    /* Oculta o Sidebar na esquerda como um "App Drawer" nativo */
    #sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100dvh; /* Usa a altura exata da tela, ignorando barras do Chrome */
        z-index: 1050;
        box-shadow: none;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1); /* Animação nativa Material Design/iOS */
    }
    
    /* Classe para abrir a gaveta no mobile */
    #sidebar.active {
        transform: translateX(280px) translateZ(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    }

    /* Background escurecido quando o menu mobile está aberto (Overlay) */
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 1045;
        opacity: 0;
        visibility: hidden;
        transition: 0.3s ease;
    }
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Ajuste da Navbar no Mobile */
    .navbar-combat {
        padding: 5px 0;
    }
    
    /* Hero Section compactada para mobile */
    .gt-hero-section-2 {
        padding: 120px 0 80px 0;
        background-attachment: scroll; /* Parallax consome muita bateria no mobile, scroll nativo é melhor */
    }

    .hero-title-combat {
        font-size: 3.2rem;
        line-height: 1;
        text-align: center;
    }
    
    .hero-subtitle-combat {
        font-size: 1rem;
        text-align: center;
        border-left: none;
        border-bottom: 3px solid var(--brand-primary);
        padding-left: 0;
        padding-bottom: 15px;
        margin: 0 auto 20px auto;
        background: linear-gradient(0deg, rgba(178,30,32,0.1) 0%, transparent 100%);
    }

    /* Tabelas no mobile: scroll horizontal suave tipo App */
    .table-responsive {
        -webkit-overflow-scrolling: touch; /* Momentum scrolling no iOS */
        scrollbar-width: none; /* Firefox */
    }
    .table-responsive::-webkit-scrollbar {
        display: none; /* Esconde scrollbar na tabela mobile para visual mais limpo */
    }

    /* Espaço extra no final da página para iPhones e navegação por gestos */
    body {
        padding-bottom: var(--app-safe-bottom);
    }
}


/* ==========================================================================
   DOJO CONTROL MOBILE - PADRÃO DEFINITIVO
   Focado em telas mobile, simulando app nativo.
   Não altera a versão desktop.
   ========================================================================== */

/* Aplica apenas para telas com largura até 768px (smartphones) */
@media only screen and (max-width: 768px) {

    /* 1. Reset Básico e Corpo */
    body {
        overflow-x: hidden; /* Evita scroll horizontal */
        position: relative;
        width: 100%;
        height: 100%;
        /* Garante que o conteúdo ocupe toda a tela, ignorando notches */
        padding-bottom: env(safe-area-inset-bottom); 
        background-color: #000; /* Fundo preto padrão */
    }

    /* Wrapper principal - Garante que não haja overflow */
    .wrapper {
        display: flex;
        flex-direction: column;
        width: 100vw;
        height: 100vh;
        height: -webkit-fill-available; /* Correção para altura no iOS */
        overflow: hidden;
        padding: 0 !important; /* Remove paddings laterais do painel */
        margin: 0 !important;
    }

    /* 2. Sidebar / Menu - Comportamento de App Drawer */
    #sidebar {
        position: fixed;
        top: 0;
        left: -260px; /* Escondido por padrão à esquerda */
        width: 250px;
        height: 100%;
        height: -webkit-fill-available;
        z-index: 9999;
        transition: all 0.3s ease; /* Animação suave */
        background: #1d0e16 !important; /* Cor do painel escuro */
        border-right: 1px solid #b21e20 !important; /* Linha vermelha */
        overflow-y: auto;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }

    /* Classe ativa para mostrar a sidebar (precisa de um pequeno JS) */
    #sidebar.active {
        left: 0;
    }

    /* Ajuste dos itens do menu para toque */
    #sidebar ul.components li a {
        padding: 15px 20px;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        color: #f8f9fa !important;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    #sidebar ul.components li a i {
        margin-right: 15px;
        font-size: 1.3rem;
        width: 25px;
        text-align: center;
    }

    /* Botão de fechar o menu (se criado via JS) */
    #sidebar-close-btn {
        display: block;
        position: absolute;
        top: 10px;
        right: 15px;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 1.5rem;
    }

    /* 3. Área de Conteúdo Principal */
    #content {
        width: 100%;
        padding: 15px !important; /* Padding reduzido para mobile */
        margin-top: 60px; /* Espaço para a navbar mobile */
        background-color: #000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Scroll suave no iOS */
    }

    /* Ajuste de títulos e cards */
    .font-combat {
        letter-spacing: 0.5px;
    }
    
    h2.font-combat {
        font-size: 1.8rem !important;
        margin-bottom: 15px !important;
    }

    /* Cards de Gestão (Dashboard) */
    .card-gestao, .turma-card {
        margin-bottom: 15px;
        padding: 15px !important;
    }
    .card-gestao h2 {
        font-size: 2.5rem !important;
    }
    .card-icon {
        font-size: 4rem !important; /* Ícones menores no card */
    }

    /* 4. Navbar Mobile (Topo) - Botão de Menu e Logo */
    .mobile-navbar {
        display: flex; /* Escondido no desktop via display:none */
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background-color: #1d0e16;
        border-bottom: 2px solid #b21e20;
        z-index: 9998;
        align-items: center;
        justify-content: space-between;
        padding: 0 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    }

    .mobile-navbar-brand img {
        max-height: 40px;
    }

    .mobile-menu-btn {
        background: transparent;
        border: none;
        color: #fff;
        font-size: 1.8rem;
        cursor: pointer;
        display: flex;
        align-items: center;
    }

    /* Esconder a logo original do sidebar em mobile se a navbar estiver ativa */
    #sidebar .text-center.p-4.border-bottom.border-secondary {
        display: none;
    }

    /* 5. Tabelas Responsivas - Padrão App */
    .table-responsive.form-section {
        border: none;
        background: transparent;
        padding: 0;
    }

    .table-custom {
        width: 100%;
        display: block;
        overflow-x: auto;
        border-collapse: separate;
        border-spacing: 0 8px; /* Espaçamento entre linhas */
    }

    .table-custom thead {
        display: none; /* Esconde cabeçalhos tradicionais */
    }

    .table-custom tbody {
        display: block;
        width: 100%;
    }

    .table-custom tr {
        display: block;
        background: #1d0e16; /* Fundo do card da linha */
        margin-bottom: 10px;
        border-radius: 8px;
        padding: 10px;
        border-left: 3px solid #5f2226; /* Borda lateral */
    }

    .table-custom td {
        display: block;
        text-align: right;
        padding: 8px 5px;
        border: none;
        position: relative;
        color: #fff;
        font-size: 0.95rem;
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }

    /* Adiciona o nome da coluna (data-label) antes do conteúdo */
    .table-custom td::before {
        content: attr(data-label);
        position: absolute;
        left: 5px;
        width: 40%;
        text-align: left;
        font-weight: bold;
        color: #ffc107; /* Amarelo para títulos */
        font-size: 0.85rem;
        text-transform: uppercase;
    }

    .table-custom td:last-child {
        border-bottom: none;
        text-align: center; /* Botões de ação centralizados */
        padding-top: 15px;
    }

    .table-custom td:last-child::before {
        display: none; /* Esconde label em botões */
    }

    /* Ajuste de botões na tabela mobile */
    .table-custom .btn {
        width: 100%;
        margin-bottom: 5px;
        font-size: 1rem;
        padding: 10px;
    }
    .table-custom .d-inline {
        display: block !important;
        width: 100%;
    }

    /* 6. Formulários e Inputs */
    .form-control, .form-select {
        font-size: 16px; /* Evita zoom automático do iOS em inputs */
        height: 45px;
        margin-bottom: 10px;
    }

    .modal-dialog {
        margin: 10px;
        max-width: none;
    }
    .modal-content {
        border-radius: 10px;
    }
    .modal-body {
        padding: 15px;
    }

    /* Ajuste de botões em geral */
    .btn-warning, .btn-info, .btn-combat {
        min-height: 45px; /* Tamanho mínimo para toque fácil */
        font-size: 1.1rem;
        font-family: 'Teko', sans-serif;
        letter-spacing: 1px;
    }
}