@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600&display=swap');

/* ==========================================
   DIVINOMAPA BETA - ESTILOS OTIMIZADOS FINAL
   Melhorias: UI/UX, Responsividade, Login Social
   ========================================== */

/* ================= VARIÁVEIS CSS ================= */
:root {
    /* Cores principais */
    --primary-blue: #0A3D62;
    --accent-orange: #F27D23;
    --bg-off-white: #F4F7F6;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;

    /* Sombras e efeitos */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Transições */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;

    /* Z-index (organizado) */
    --z-map: 1;
    --z-controls: 1000;
    --z-panel: 1001;
    --z-header: 1002;
    --z-context-menu: 5000;
    --z-modal: 6000;
    --z-mobile-toggle: 10000;
}

/* ================= RESET E BASE ================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-off-white);
    color: var(--text-dark);
    line-height: 1.5;
    height: 100vh;
    /* Altura total da viewport */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Impede rolagem da página inteira */
}

/* ================= SKIP LINK (ACESSIBILIDADE) ================= */
.skip-link {
    position: absolute;
    left: -9999px;
    z-index: 999999;
    background: var(--primary-blue);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    left: 0;
    top: 0;
}

/* ================= CABEÇALHO ================= */
.main-header {
    /* Gradiente Otimizado */
    background: linear-gradient(to right,
            /* Direção: da esquerda para a direita */
            #0f172a 20%,
            /* O Azul Escuro domina os primeiros 20% (área do logo) */
            #0d9488 40%,
            /* Transição suave para Turquesa até chegar nos 40% */
            #0d9488 60%,
            /* Mantém o Turquesa sólido até 60% (cobre a área central dos botões) */
            #0f172a 80%
            /* Transição suave de volta para Azul Escuro até 80% (área do perfil) */
        );
    color: white;
    padding: 0 24px;

    /* AJUSTE IPHONE: Área segura e altura */
    padding-top: env(safe-area-inset-top);
    height: calc(70px + env(safe-area-inset-top));

    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    z-index: var(--z-header);
    position: relative;
}

/* Logo */
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-fast);
}

.logo-area:hover {
    opacity: 0.95;
}

/* Logo SVG */
.logo-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    filter: drop-shadow(0px 4px 8px rgba(13, 148, 136, 0.15));
    transition: var(--transition-fast);
}

.logo-area:hover .logo-icon {
    filter: drop-shadow(0px 6px 12px rgba(13, 148, 136, 0.25));
    transform: translateY(-1px);
}

/* Texto da Logo */
.logo-text h1 {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2px;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.brand-name {
    color: white;
    font-weight: 800;
    letter-spacing: -0.5px;
}



.logo-text .tagline {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

/* Navegação Desktop */
.main-nav {
    display: flex;
    gap: 15px;
    align-items: center;
}

.main-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.8;
    padding: 6px 10px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.main-nav a:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ================= BOTÕES DE LOGIN (PADRONIZADOS) ================= */
.user-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-logged-in {
    display: none;
    align-items: center;
    gap: 10px;
}

#user-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

#user-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

#badge-admin {
    display: none;
    background-color: var(--accent-orange);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Botões Sociais (Google/Apple) */
.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    height: 38px;
    padding: 0 16px;

    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-social:active {
    transform: scale(0.96);
}

.social-icon {
    width: 18px;
    height: 18px;
}

/* Tema Google */
.btn-google {
    background-color: white;
    color: #3c4043;
    border-color: #dadce0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-google:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

/* Tema Apple */
.btn-apple {
    background-color: #000000;
    color: white;
    border-color: #000000;
}

.btn-apple:hover {
    background-color: #333333;
    border-color: #333333;
}

/* Botão Sair no Header */
.main-header .btn-logout {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.main-header .btn-logout:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ================= MAPA ================= */
.map-container {
    flex: 1;
    position: relative;
    width: 100%;
    background-color: #E5E7EB;
}

#map {
    width: 100%;
    height: 100%;
    z-index: var(--z-map);
}

/* ================= POPUPS DO LEAFLET ================= */
.leaflet-popup-content-wrapper {
    border-radius: var(--border-radius);
    padding: 0;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.leaflet-popup-content {
    /* Respiro e largura ajustados */
    margin: 25px 24px !important;
    width: 310px !important;
    max-width: 85vw !important;
    font-size: 0.95rem;
    line-height: 1.6;
}

.leaflet-popup-tip {
    box-shadow: var(--shadow-sm);
}

.leaflet-container a.leaflet-popup-close-button {
    top: 12px;
    right: 12px;
    font-size: 1.4rem;
    color: #999;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
}

.leaflet-container a.leaflet-popup-close-button:hover {
    color: var(--danger);
    background: #f1f1f1;
    transform: scale(1.1);
}

/* ================= FORMULÁRIO NO POPUP ================= */
.form-popup-container {
    width: 100%;
}

.form-popup-container h4 {
    margin: 0 0 20px 0;
    color: var(--danger);
    /* Ou azul para ruas */
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    letter-spacing: -0.5px;
}

.form-popup-container label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-popup-container select,
.form-popup-container textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
    background: #ffffff;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-popup-container select:focus,
.form-popup-container textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.1);
}

.upload-area {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: var(--border-radius-sm);
    padding: 16px;
    cursor: pointer;
    margin: 10px 0 20px 0;
    width: 100%;
    min-height: 60px;
    transition: var(--transition-fast);
}

.upload-area:hover {
    background-color: #f1f5f9;
    border-color: var(--primary-blue);
}

.form-popup-container button {
    margin-top: 5px;
    padding: 14px !important;
    font-size: 1rem !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    background-color: #0A3D62 !important;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.form-popup-container button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ================= PAINEL LATERAL DE FILTROS ================= */
.floating-panel,
#painel-filtros {
    position: absolute;
    top: 90px;
    left: 20px;
    width: 240px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 15px;
    z-index: var(--z-panel);
    max-height: calc(100vh - 120px);
    overflow-y: auto;

    display: none;
    /* <--- ADICIONE ISSO (Começa escondido) */
}

#painel-filtros.ativo {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floating-panel::-webkit-scrollbar {
    width: 4px;
}

.floating-panel::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Indicador de Swipe (Mobile) */
#painel-filtros::before {
    content: '';
    display: none;
    /* Escondido por padrão */
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 10px;
    z-index: 10;
}

/* Mostra o indicador apenas em mobile quando o painel está ativo */
@media (max-width: 768px) {
    #painel-filtros.ativo::before {
        display: block;
    }

    /* Ajusta padding do topo para dar espaço ao indicador */
    #painel-filtros.ativo {
        padding-top: 20px;
    }
}

#painel-filtros h3 {
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    color: var(--primary-blue);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Adicionar larguras específicas para as colunas */
.tabela-admin th,
.tabela-admin td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.9rem;
}

/* Larguras específicas das colunas */
.tabela-admin th:nth-child(1),
.tabela-admin td:nth-child(1) {
    width: 80px;
    /* Foto */
}

.tabela-admin th:nth-child(2),
.tabela-admin td:nth-child(2) {
    width: 120px;
    /* Tipo */
}

.tabela-admin th:nth-child(3),
.tabela-admin td:nth-child(3) {
    width: 35%;
    /* Descrição - mais espaço */
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tabela-admin th:nth-child(4),
.tabela-admin td:nth-child(4) {
    width: 110px;
    /* Data */
}

.tabela-admin th:nth-child(5),
.tabela-admin td:nth-child(5) {
    width: 120px;
    /* Ação */
    text-align: center;
}

.btn-filter-map {
    background: transparent;
    border: 1px solid #eee;
    padding: 8px 12px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-filter-map:hover {
    background: #f8f9fa;
    padding-left: 16px;
}

.btn-filter-map.ativo {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(10, 61, 98, 0.2);
}

.separator {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin: 12px 0 4px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #eee;
}

/* ================= CARDS E OUTROS ================= */
.card {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* ================= CONTROLES DE ZOOM ================= */
.zoom-controls {
    position: absolute;
    bottom: 30px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: var(--z-controls);
}

.zoom-controls button {
    width: 48px;
    height: 48px;
    background: white;
    border: none;
    border-radius: 12px;
    /* Mais moderno que círculo */
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-controls button:hover {
    transform: scale(1.05);
}

.zoom-controls button:active {
    transform: scale(0.95);
}

/* Container do botão reportar (centralizado na parte inferior) */
#context-menu {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: transparent;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50px;
    box-shadow: none;
    display: none;
    /* Começa oculto, JavaScript mostra quando necessário */
    justify-content: center;
    align-items: center;
    width: auto !important;
}

/* Botão de reportar */
.context-item {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    background: white;
    border: none;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    padding: 12px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.context-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background-color: #f8fafc;
}

.context-item:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ================= MODAIS ================= */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
}

/* Modal overlay mais escuro para admin */
#painel-admin-modal.modal-overlay {
    background: rgba(0, 0, 0, 0.85);
    z-index: 20000;
    backdrop-filter: blur(5px);
}

.modal-box {
    background: white;
    width: 90%;
    max-width: 600px;
    padding: 25px;
    border-radius: var(--border-radius-lg);
    animation: modalSlideUp 0.3s ease-out;
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal de estatísticas (mais compacto) */
#modal-estatisticas .modal-box {
    max-width: 400px;
    padding: 15px;
    max-height: 95vh;
}

#modal-estatisticas .btn-fechar {
    width: auto;
    /* Não ocupa mais a tela toda */
    min-width: 120px;
    /* Tamanho mínimo confortável */
    display: block;
    /* Permite centralizar */
    margin: 15px auto 0 auto;
    /* Centraliza na tela */

    padding: 8px 20px;
    /* Mais fino */
    font-size: 0.85rem;
    /* Letra menor */

    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#modal-estatisticas .btn-fechar:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
}

/* ================= ESTATÍSTICAS NO MODAL ================= */
.stats-grid-modal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 10px;
    width: 100%;
}

.stats-grid-modal .stat-card {
    background: #f8f9fa;
    padding: 5px;
    border-radius: 8px;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 65px;
    transition: transform 0.2s;
}

.stats-grid-modal .stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1F2937;
    margin: 2px 0;
    line-height: 1;
}

.stats-grid-modal .stat-name {
    font-size: 0.6rem;
    color: #6B7280;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.stats-grid-modal .stat-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

/* Card total (ocupa 2 colunas) */
.stats-grid-modal .stat-card.total-card {
    grid-column: span 2;
    background: #e0f2fe;
    border-color: #bae6fd;
    flex-direction: row;
    gap: 10px;
    min-height: 45px;
}

.stats-grid-modal .stat-card.total-card .stat-value {
    font-size: 1.3rem;
    color: #0284c7;
}

.stats-grid-modal .stat-card.total-card .stat-name {
    font-size: 0.7rem;
    color: #0369a1;
}

.stats-grid-modal .stat-card.total-card .stat-icon {
    font-size: 1.4rem;
}

/* ================= RESPONSIVO - MOBILE ================= */
@media (max-width: 768px) {

    /* Esconde elementos desktop */
    .main-nav {
        display: none !important;
    }

    .user-area {
        display: none !important;
    }

    /* Logo mobile - mostra nome completo */
    .logo-area {
        gap: 10px;
    }

    .logo-icon {
        width: 42px;
        height: 42px;
    }

    .logo-text h1 {
        font-size: 1rem;
    }

    .brand-name {
        font-size: 1rem;
    }



    .logo-text .tagline {
        font-size: 0.65rem;
        display: block;
        /* Mantém visível */
    }

    /* Cabeçalho compacto com iPhone Fix */
    .main-header {
        height: calc(60px + env(safe-area-inset-top));
        padding: 0 12px;
        padding-top: env(safe-area-inset-top);
    }

    /* Botão Menu Hambúrguer */
    #btn-mobile-toggle {
        display: flex;
        justify-content: center;
        align-items: center;
        position: fixed;
        top: calc(8px + env(safe-area-inset-top));
        /* Ajuste fino */
        right: 15px;
        z-index: var(--z-mobile-toggle);
        width: 44px;
        height: 44px;
        background: white;
        color: var(--primary-blue);
        border: 1px solid #ddd;
        border-radius: 10px;
        font-size: 1.4rem;
        box-shadow: var(--shadow-md);
        cursor: pointer;
    }

    #btn-mobile-toggle.ativo-btn {
        background: var(--primary-blue);
        color: white;
        border-color: transparent;
    }

    /* Zoom Controls */
    .zoom-controls {
        bottom: 90px;
        right: 15px;
    }

    /* Painel estilo Gaveta (Bottom Sheet) */
    .floating-panel,
    #painel-filtros {
        display: none;
        position: fixed;
        width: 100%;
        left: 0;
        bottom: 0;
        top: auto;
        max-height: 70vh;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        padding-top: 25px;
        /* Espaço para o indicador */
        animation: slideUpPanel 0.3s ease-out;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
        overflow-y: auto;
        overflow-x: hidden;

        /* Permite transformações suaves durante o swipe */
        will-change: transform, opacity;
    }

    .floating-panel.ativo,
    #painel-filtros.ativo {
        display: flex;
        flex-direction: column;
    }

    /* Indicador de Arraste (Drag Handle) */
    .floating-panel::before,
    #painel-filtros::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 50px;
        height: 5px;
        background: #cbd5e1;
        border-radius: 10px;
        z-index: 10;

        /* Animação sutil para chamar atenção */
        animation: pulseHandle 2s ease-in-out infinite;
    }

    @keyframes pulseHandle {

        0%,
        100% {
            opacity: 0.6;
        }

        50% {
            opacity: 1;
        }
    }

    @keyframes slideUpPanel {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

        to {
            transform: translateY(0);
        }
    }

    /* Ajustes em Botões Sociais para telas muito pequenas */
    @media (max-width: 380px) {
        .btn-social {
            height: 40px;
            padding: 0 20px;
            min-width: 120px;
        }
    }
}

/* ================= LOADING ================= */
.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
    text-align: center;
}

/* ================= UTILITÁRIOS ================= */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* =========================================
   PAINEL DO USUÁRIO (GAMIFICADO)
   ========================================= */

/* 1. Botão Flutuante (O que abre o painel) */
.fab-perfil {
    position: fixed !important;
    top: 80px;
    right: 20px;
    z-index: 9999 !important;
    background: white;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: bold;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: transform 0.2s, background-color 0.2s;
    display: none;
}

.fab-perfil:hover {
    transform: scale(1.05);
    background-color: #f8f8f8;
}

/* 2. A Gaveta Lateral (O Painel em si) */
#painel-usuario {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: #ffffff;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

/* Estados de Animação */
.painel-fechado {
    transform: translateX(110%);
}

.painel-aberto {
    transform: translateX(0);
}

/* ================= CABEÇALHO HERO COM DEGRADÊ ================= */
.painel-header-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 30px 25px;
    position: relative;
    border-radius: 0;
    margin: 0;
    flex-shrink: 0;
}

.btn-fechar-absoluto {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-fechar-absoluto:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Perfil e Barra de XP */
.perfil-flex {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-badge {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.nivel-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #fbbf24;
    color: #0f172a;
    font-size: 0.75rem;
    font-weight: 800;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f172a;
}

.perfil-dados {
    flex: 1;
    min-width: 0;
}

.perfil-dados h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.barra-xp-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 8px 0;
    overflow: hidden;
    position: relative;
}

.barra-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9 0%, #06b6d4 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.5);
}

.perfil-dados small {
    font-size: 0.8rem;
    opacity: 0.9;
    color: rgba(255, 255, 255, 0.85);
}

/* ================= MINI STATS ================= */
.painel-stats-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px 25px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.mini-stat {
    background: white;
    padding: 15px 10px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mini-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mini-stat span {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1;
}

.mini-stat small {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ================= LISTA DE OCORRÊNCIAS ================= */
.lista-ocorrencias {
    flex: 1;
    overflow-y: auto;
    padding: 0 25px 20px 25px;
}

.lista-ocorrencias h4 {
    position: sticky;
    top: 0;
    background: white;
    padding: 15px 0 10px 0;
    margin: 0 0 15px 0;
    z-index: 10;
}

/* Lista Timeline */
.lista-timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}

.loading-item {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    font-style: italic;
}

.item-timeline {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.item-timeline:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}

.timeline-header small {
    color: #94a3b8;
    font-weight: 400;
    font-size: 0.75rem;
}

/* ================= BARRA DE STATUS VISUAL ================= */
.status-track {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 12px 0;
    padding: 0 10px;
}

/* Linha cinza de fundo */
.status-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
    transform: translateY(-50%);
}

.step {
    background: white;
    z-index: 1;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s;
    position: relative;
}

/* Passo Ativo (Azul) */
.step.active {
    border-color: #0ea5e9;
    background: #e0f2fe;
    color: #0ea5e9;
    transform: scale(1.15);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

/* Passo Concluído (Verde) */
.step.done {
    border-color: #22c55e;
    background: #22c55e;
    color: white;
    transform: scale(1.1);
}

.timeline-status-text {
    text-align: center;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 8px;
    font-weight: 500;
}

/* ================= RODAPÉ ================= */
.painel-footer {
    border-top: 1px solid #e2e8f0;
    padding: 20px 25px;
    background: #f8fafc;
    flex-shrink: 0;
}

#painel-usuario .btn-logout {
    width: 100%;
    padding: 12px;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}

#painel-usuario .btn-logout:hover {
    background-color: #e2e8f0;
    color: #334155;
    border-color: #cbd5e1;
}

/* ============================================================
   📱 OTIMIZAÇÕES MOBILE PARA PAINEL DO USUÁRIO
   ============================================================ */

@media (max-width: 768px) {

    /* 1. Painel em Tela Cheia */
    #painel-usuario {
        width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
        /* Dynamic viewport height (melhor para mobile) */
        top: 0;
        right: 0;
        border-radius: 0;
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 9999;
        padding: 0;

        /* Suporte para safe areas (notch do iPhone) */
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Estado fechado (escondido à direita) */
    #painel-usuario.painel-fechado {
        transform: translateX(100%) !important;
    }

    /* Estado aberto (visível) */
    #painel-usuario.painel-aberto {
        transform: translateX(0) !important;
    }

    /* 2. Cabeçalho Hero - Ajustes para Mobile */
    .painel-header-hero {
        padding-top: max(50px, env(safe-area-inset-top, 20px));
        padding-bottom: 25px;
        padding-left: 20px;
        padding-right: 20px;
        margin: 0;
        border-radius: 0 0 24px 24px;
    }

    /* 3. Botão Fechar - Touch Friendly */
    .btn-fechar-absoluto {
        top: max(15px, env(safe-area-inset-top, 10px));
        right: 15px;
        width: 44px;
        /* Tamanho mínimo recomendado para touch (44x44px) */
        height: 44px;
        font-size: 1.8rem;
        background: rgba(0, 0, 0, 0.25);
        backdrop-filter: blur(10px);
    }

    .btn-fechar-absoluto:active {
        transform: scale(0.95);
        background: rgba(0, 0, 0, 0.35);
    }

    /* 4. Avatar e Badge - Ajustes de Tamanho */
    .avatar-badge {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }

    .nivel-badge {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    /* 5. Texto do Nível */
    .perfil-dados h3 {
        font-size: 1.15rem;
    }

    .perfil-dados small {
        font-size: 0.75rem;
    }

    /* 6. Barra de XP */
    .barra-xp-container {
        height: 10px;
        /* Um pouco mais grossa para mobile */
    }

    /* 7. Mini Stats - Otimizado para Mobile */
    .painel-stats-mini {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 18px 20px;
    }

    .mini-stat {
        padding: 14px 10px;
        border-radius: 10px;
    }

    .mini-stat span {
        font-size: 1.5rem;
    }

    .mini-stat small {
        font-size: 0.65rem;
    }

    /* 8. Lista de Ocorrências */
    .lista-ocorrencias {
        padding: 0 20px 100px 20px;
        /* Espaço extra embaixo */
    }

    .lista-ocorrencias h4 {
        padding: 12px 0 8px 0;
        font-size: 0.9rem;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }

    /* 9. Items da Timeline - Touch Friendly */
    .item-timeline {
        padding: 18px;
        margin-bottom: 14px;
        border-radius: 14px;
        /* Área de toque maior */
        min-height: 100px;
    }

    .item-timeline:active {
        background: #f1f5f9;
        transform: scale(0.98);
    }

    .timeline-header {
        font-size: 0.95rem;
        margin-bottom: 14px;
    }

    /* 10. Status Track - Ajustes para Mobile */
    .status-track {
        padding: 0 15px;
        margin: 14px 0;
    }

    .step {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .step.active {
        transform: scale(1.2);
    }

    .timeline-status-text {
        font-size: 0.8rem;
        margin-top: 10px;
    }

    /* 11. Rodapé - Fixo na Parte Inferior */
    .painel-footer {
        padding: 18px 20px;
        padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
        background: white;
        border-top: 2px solid #e2e8f0;
        position: sticky;
        bottom: 0;
        z-index: 10;
    }

    #painel-usuario .btn-logout {
        padding: 16px;
        font-size: 1rem;
        border-radius: 12px;
        /* Touch feedback */
        -webkit-tap-highlight-color: transparent;
    }

    #painel-usuario .btn-logout:active {
        transform: scale(0.98);
        background-color: #cbd5e1;
    }

    /* 12. Botão Flutuante "Minha Conta" */
    .fab-perfil {
        bottom: 20px;
        right: 20px;
        top: auto;
        padding: 14px 26px;
        font-size: 0.95rem;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    }

    /* 13. Scrollbar Customizada (Webkit) */
    #painel-usuario::-webkit-scrollbar {
        width: 6px;
    }

    #painel-usuario::-webkit-scrollbar-track {
        background: #f1f5f9;
    }

    #painel-usuario::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }

    /* 14. Loading Item */
    .loading-item {
        padding: 40px 20px;
        font-size: 0.9rem;
    }
}

/* ============================================================
   📱 EXTRA: Ajustes para Telas Muito Pequenas (< 375px)
   ============================================================ */

@media (max-width: 374px) {
    .painel-header-hero {
        padding-left: 15px;
        padding-right: 15px;
    }

    .perfil-flex {
        gap: 12px;
    }

    .avatar-badge {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }

    .perfil-dados h3 {
        font-size: 1rem;
    }

    .mini-stat span {
        font-size: 1.3rem;
    }

    .lista-ocorrencias {
        padding: 0 15px 100px 15px;
    }
}

/* =========================================
   NOVO PAINEL ADMINISTRATIVO
   ========================================= */

/* 2. A Janela Branca (Conteúdo) */
.modal-conteudo-admin {
    background: white;
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    border-radius: 12px;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: relative;
}

/* Sobrescrever .modal-box para o painel admin */
.modal-box.admin-box {
    max-width: 1400px !important;
    width: 90%;
    height: 85vh;
}

/* Cabeçalho do Modal (Título na esquerda, Botão na direita) */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    width: 100%;
    background-color: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: #1e293b;
    font-weight: 600;
}

/* Botão de Fechar (X) mais bonito */
.btn-fechar-x {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s ease;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fechar-x:hover {
    color: #ef4444;
    transform: scale(1.1);
}

/* Barra de Filtros do Admin */
.admin-filters {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 15px 20px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 150px;
}

.filter-group select:hover {
    border-color: #94a3b8;
}

.filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-stats {
    margin-left: auto;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
}

.filter-stats span {
    color: #3b82f6;
    font-size: 1.1rem;
}

.admin-header h2 {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Corpo da Tabela com Rolagem */
.admin-body {
    flex: 1;
    /* Ocupa todo o espaço restante */
    overflow-y: auto;
    /* Barra de rolagem interna */
    padding: 0;
    background-color: white;
}

/* 3. A Tabela de Dados */
.tabela-admin {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
    /* Garante que não quebre em telas médias */
}

.tabela-admin thead th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 15px 20px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #e2e8f0;
}

.tabela-admin tbody td {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.tabela-admin tbody tr:hover {
    background-color: #f8fafc;
    /* Efeito hover na linha */
}

/* Miniatura da Foto */
.thumb-admin {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
    background-color: #eee;
}

.thumb-admin:hover {
    transform: scale(2.5);
    /* Zoom ao passar o mouse */
    z-index: 50;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-color: white;
}

/* Botões de Ação na Tabela */
.btn-acao-admin {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-ver {
    background: #e0f2fe;
    color: #0284c7;
}

.btn-ver:hover {
    background: #0284c7;
    color: white;
}

.btn-banir {
    background: #fee2e2;
    color: #dc2626;
}

.btn-banir:hover {
    background: #dc2626;
    color: white;
}

/* 4. Botão Flutuante Dourado (Só aparece se for Admin) */
.fab-admin {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: #1e293b;
    /* Azul bem escuro */
    color: #fbbf24;
    /* Dourado */
    border: 2px solid #fbbf24;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: none;
    /* O JavaScript vai mostrar isso */
    transition: transform 0.2s, box-shadow 0.2s;
    align-items: center;
    justify-content: center;
}

.fab-admin:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 10px 25px rgba(251, 191, 36, 0.4);
    /* Brilho dourado */
    background: #0f172a;
}

/* ================= BOTÃO FECHAR MODAL ================= */
.btn-fechar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 25px;
    padding: 14px;
    background-color: transparent;
    color: #64748b;
    /* Slate 500 */
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-fechar:hover {
    background-color: #f8fafc;
    /* Slate 50 */
    color: #334155;
    /* Slate 700 */
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-fechar:active {
    transform: translateY(0);
}