/* Importando uma fonte moderna */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

/* Variáveis de Cor */
/* Variáveis de Cor (Tema Claro - Padrão) */
:root {
    --color-primary: #588157;
    --color-primary-dark: #3A5A40;
    --color-secondary: #A3B18A;
    --color-accent: #DAD7CD;

    --bg-color: #DAD7CD;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-color: #344E41;
    --text-light: #FBFBFB;
    --input-bg: #fff;
    --input-border: #ddd;

    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 25px rgba(0, 0, 0, 0.3);

    --color-record: #CB4335;
}

/* TEMA ESCURO */
body.dark-mode {
    --color-primary: #6a9c69;
    /* Um pouco mais claro para contraste */
    --color-primary-dark: #8ab689;
    --color-secondary: #4a5d4a;
    --color-accent: #1a1a1a;

    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --text-light: #e0e0e0;
    --input-bg: #2d2d2d;
    --input-border: #444;

    --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-heavy: 0 8px 25px rgba(0, 0, 0, 0.7);
}

/* Reset Básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;

    /* Fundo com Imagem Limpa */
    background-color: var(--bg-color);
    background-image: url('/img/fundo.jpg');
    /* Manter ou remover no dark? */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-image: none;
    /* Remove imagem de fundo no dark mode para leitura */
}

.container {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 0 1rem 80px 1rem;
    /* Espaço extra no bottom para o menu de rodapé */
    position: relative;
    z-index: 2;
}

/* --- HEADER --- */
.app-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-text-light);
    padding: 1.5rem;
    box-shadow: var(--shadow-heavy);
    margin-bottom: 2rem;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    text-align: center;
}

.app-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: inline-block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* --- CARDS --- */
.card {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 6px solid var(--color-primary);
    transition: background-color 0.3s;
}

.card h2 {
    color: var(--color-primary-dark);
    font-size: 1.25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--color-secondary);
    padding-bottom: 0.5rem;
}

.btn-close-section {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    z-index: 10;
}

.btn-close-section:hover {
    color: #333;
}

/* Botão Flutuante (FAB) - Reposicionado */
.fab-button {
    position: fixed;
    bottom: 90px;
    /* Acima do menu de rodapé */
    right: 2rem;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.3s, box-shadow 0.3s;
}

.fab-button:active {
    transform: scale(0.90);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.fab-button .material-icons {
    font-size: 36px;
}

/* Perfil no Modal de Configurações */
.profile-content {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
}

.profile-card {
    background: var(--bg-color);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
}

.profile-avatar {
    margin-bottom: 1rem;
}

.profile-avatar .material-icons {
    font-size: 4rem;
    color: var(--color-primary);
}

.profile-info {
    margin-bottom: 1.5rem;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e9ecef;
}

.profile-info-item:last-child {
    border-bottom: none;
}

.profile-info-item strong {
    color: var(--color-primary-dark);
    font-size: 0.9rem;
}

.profile-info-item span {
    color: #666;
    font-size: 0.9rem;
}

/* --- MODAL (FORMULÁRIO) --- */
.modal {
    display: none;
    /* Escondido por padrão */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    overflow-y: auto;
    /* Permite rolar */
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    /* Margem superior */
    padding: 2rem;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    color: var(--text-color);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-modal:hover {
    color: #000;
}

/* --- ESTILOS DO FORMULÁRIO --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-family: inherit;
    background-color: var(--input-bg);
    color: var(--text-color);
}

/* Caixa de Destaque (GPS) */
.highlight-box {
    background-color: #f0f7f0;
    padding: 1rem;
    border-radius: 8px;
    border: 1px dashed var(--color-primary);
}

/* --- SELETOR DE TIPO DE MÍDIA (Radio Buttons) --- */
.media-type-selector {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    justify-content: space-between;
}

.media-type-selector label {
    background: #fff;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: center;
    flex: 1;
    transition: all 0.2s;
}

.media-type-selector label:hover {
    background: #f0f0f0;
}

.media-type-selector input {
    display: none;
}

/* Classe para destacar a aba ativa (adicionada via JS) */
.media-active {
    background-color: var(--color-primary) !important;
    color: white !important;
    border-color: var(--color-primary-dark) !important;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* --- CONTROLES DE CAPTURA E PREVIEW --- */
.capture-controls {
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 10px;
    border: 1px solid var(--input-border);
}

/* Botões grandes de captura */
.capture-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    padding: 0.8rem;
    margin: 0 !important;
    width: 100%;
    cursor: pointer;
    background-color: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-color);
    transition: all 0.2s;
}

.capture-btn:hover {
    background-color: var(--bg-color);
}

.capture-btn.btn-primary {
    /* Estilo específico se tiver a classe btn-primary */
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border: none;
}

.preview-box {
    margin-top: 15px;
    text-align: center;
    background: #fff;
    border: 2px dashed #ddd;
    padding: 10px;
    border-radius: 8px;
}

.preview-media {
    max-width: 100%;
    max-height: 200px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


/* --- BOTÕES GERAIS --- */
.btn {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-text-light);
    box-shadow: 0 4px 10px rgba(88, 129, 87, 0.3);
}

.btn-secondary {
    background-color: white;
    color: var(--color-primary-dark);
    border: 2px solid var(--color-primary-dark);
}

.btn-primary.recording {
    background: linear-gradient(135deg, var(--color-record), #a03429);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(203, 67, 53, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(203, 67, 53, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(203, 67, 53, 0);
    }
}

/* --- LOGIN --- */
#login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-image: url('/img/fundo.jpg');
    background-size: cover;
    background-position: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: none;
}

.button-group-login {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

@media (min-width: 600px) {
    .button-group-login {
        flex-direction: row;
    }
}

.login-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    display: none;
}

.login-status.error {
    background-color: #ffebee;
    color: #c62828;
}

.login-status.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.login-status.neutral {
    background-color: #e3f2fd;
    color: #0d47a1;
}

/* --- MAPA E LISTA --- */
#map {
    height: 350px;
    width: 100%;
    border-radius: 10px;
    z-index: 1;
    border: 2px solid #fff;
}

.coleta-item {
    padding: 1rem;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--input-border);
    border-radius: 10px;
    margin-bottom: 0.8rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-color);
}

/* --- RODAPÉ --- */
.app-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    background-color: rgba(58, 90, 64, 0.9);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    color: white;
}

.app-footer p {
    margin-top: 1rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.btn-logout {
    background-color: transparent;
    color: #ffcccc;
    border: 1px solid #ffcccc;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background-color: #ffcccc;
    color: var(--color-record);
}

/* Esconde o app principal por padrão */
#main-app-content {
    display: none;
}

/* --- NOVOS ESTILOS V2 (Rastro e Voz) --- */

/* Botões de Voz */
.btn-voice {
    background: var(--input-bg);
    border: none;
    border-radius: 5px;
    padding: 0 10px;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
    height: 100%;
}

.btn-voice:active,
.recording-pulse {
    background: #ff4757;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Botões de Mídia */
.media-buttons-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.btn-media-action {
    flex: 1;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 10px 5px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-color);
}

.btn-media-action .material-icons {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--color-primary);
    display: block;
    margin-top: 2px;
}

.btn-media-action:active {
    background: var(--bg-color);
}

/* Lista de Mídia (Thumbnails) */
#media-list-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-top: 10px;
    min-height: 90px;
}

.media-list-item {
    position: relative;
    width: 80px;
    text-align: center;
    flex-shrink: 0;
}

.media-thumb-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--input-border);
}

.media-thumb-wrapper img,
.media-thumb-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-type-label {
    font-size: 0.7rem;
    color: #666;
    display: block;
    margin-top: 2px;
}

.btn-remove-media {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
    z-index: 10;
}

/* Info Content (Menu) */
.info-content h4 {
    color: var(--color-primary-dark);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.info-content p {
    color: #555;
    line-height: 1.5;
    font-size: 0.95rem;
}

.info-content ul {
    padding-left: 20px;
    color: #555;
}

.info-content li {
    margin-bottom: 5px;
}

/* Badge QR Code */
.btn-qr {
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    text-decoration: none;
}

/* Estilos para Menu de App Moderno */
.app-menu-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.menu-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}

.menu-option:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.menu-option .material-icons:first-child {
    color: var(--color-primary);
    font-size: 24px;
}

.menu-option .material-icons:last-child {
    color: #999;
    font-size: 20px;
    margin-left: auto;
}

.menu-option div {
    flex: 1;
}

.menu-option strong {
    display: block;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.menu-option small {
    color: #666;
    font-size: 0.8rem;
}

.about-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 10px;
    margin-top: 1rem;
}

.about-content h4 {
    color: var(--color-primary-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.about-content p {
    color: #555;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.about-content ul {
    padding-left: 1rem;
    color: #555;
    font-size: 0.85rem;
}

.about-content li {
    margin-bottom: 0.3rem;
}

/* Estilos para Checkbox de Termos */
.checkbox-container {
    font-size: 0.8rem;
    line-height: 1.3;
    color: #333;
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    transform: scale(1.1);
}

.checkbox-container a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.checkbox-container a:hover {
    text-decoration: underline;
}

#profile-pic-preview {
    transition: all 0.3s ease;
}

#profile-pic-preview:hover {
    opacity: 0.8;
}

/* Modal QR Gallery */
#qr-gallery-list {
    max-height: 60vh;
    overflow-y: auto;
    padding: 5px;
}

/* Trilha de Cadastro/Perfil */
.profile-setup-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-header h2 {
    color: var(--color-primary-dark);
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 25%;
}

.progress-text {
    color: #666;
    font-size: 0.9rem;
}

.profile-step {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.step-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.profile-step h3 {
    color: var(--color-primary-dark);
    margin-bottom: 1rem;
}

.step-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.step-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.profile-summary {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: left;
}

.profile-display {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.profile-item:last-child {
    border-bottom: none;
}

/* Menu de Rodapé */
.app-footer-menu {
    display: none;
    /* Escondido por padrão, ativado via JS */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--input-border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.footer-menu-items {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
}

.footer-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
    min-width: 60px;
}

.footer-menu-item:hover {
    background: #f8f9fa;
}

.footer-menu-item.active {
    color: var(--color-primary);
}

.footer-menu-item .material-icons {
    font-size: 24px;
    margin-bottom: 2px;
}

.footer-menu-item small {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Seções do App */
.app-section {
    padding-bottom: 80px;
    /* Espaço para o menu de rodapé */
}

/* Configurações */
.settings-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-item:hover {
    background: #e9ecef;
}

.setting-item .material-icons {
    color: var(--color-primary);
}

/* Responsivo para trilha de cadastro */
@media (max-width: 480px) {
    .profile-setup-container {
        padding: 1rem;
    }

    .profile-step {
        padding: 1.5rem;
    }

    .step-buttons {
        flex-direction: column;
    }
}

/* =========================================
   MEDIA QUERY: PRINT (Etiquetas)
   ========================================= */
@media print {
    body * {
        visibility: hidden;
    }

    #qr-gallery-list,
    #qr-gallery-list * {
        visibility: visible;
    }

    #qr-gallery-list {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        /* 4 por linha */
        gap: 20px !important;
    }

    .qr-item {
        border: 1px dashed #ccc;
        padding: 10px;
        text-align: center;
        page-break-inside: avoid;
    }

    .qr-item img {
        width: 100px;
        height: 100px;
    }

    .qr-item p {
        font-size: 10px;
        color: black;
    }

    /* Esconder botões de ação na impressão */
    .qr-actions,
    button {
        display: none !important;
    }
}