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

:root {
    /* Cores do Tema */
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --primary: #4da3ff;
    --primary-hover: #3391ff;
    --danger: #dc3545;
    --success: #28a745;
    --text: #1c1e21;
    --text-muted: #606770;
    --border: #dddfe2;
    --tag-bg: #e7f3ff;
}

body {
    font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6; /* <-- ADICIONE ESTA LINHA */
}

.conteudo-pagina {
    padding: 25px 20px 40px 20px;
}

/* Bloqueio visual de cópia */
img, video {
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* Bloqueia menu de salvar no iPhone/Android */
    -webkit-user-drag: none;     /* Impede arrastar a imagem */
    user-select: none;
    pointer-events: auto;        /* Mantém o clique para abrir o Lightbox */
}

/* --- ESTRUTURA DE CABEÇALHO UNIFICADO --- */
.header-principal {
    position: sticky;
    top: 0;
    z-index: 1200;
    background-color: var(--bg-color);
    padding: 10px 0;
    width: 100%; /* Garante que não passe da tela */
    overflow-x: hidden; /* Evita que resíduos de animação criem rolagem */
}

nav {
    background: var(--card-bg);
    padding: 8px 15px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 50px;
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    max-width: 95%; /* No PC ele é contido, no celular ajustaremos abaixo */
    transition: all 0.3s ease;
}

/* Containers de Modo (Onde a mágica acontece) */
.nav-normal-mode {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-album-mode {
    display: grid;
    /* Ajuste preventivo para telas médias */
    grid-template-columns: 40px 1fr minmax(60px, 80px);
    align-items: center;
    width: 100%;
    gap: 10px;
}

.nav-album-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text);
    text-align: center;
    /* ESSAS 3 LINHAS ABAIXO EVITAM A ROLAGEM HORIZONTAL */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Isso garante que o ícone e o texto aceitem ordens de empilhamento */
.menu-icon, .menu-text {
    display: block; 
    width: 100%;
    text-align: center;
}

/* --- LINKS E BOTÕES --- */

nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

nav a:hover { color: var(--primary); }

.btn-save {
    background: var(--primary);
    color: white; border: none; padding: 14px;
    width: 100%; border-radius: 6px; font-weight: bold; cursor: pointer;
    transition: 0.2s; font-size: 1rem;
    display: inline-block;
    text-align: center;
}
.btn-save:hover { background: var(--primary-hover); }

/* --- BOTÃO BAIXAR UNIFICADO (PC e Celular) --- */
.btn-baixar-nav {
    background: var(--primary);
    color: white !important;
    text-decoration: none;
    padding: 4px 8px; /* Menor altura */
    border-radius: 8px;
    font-size: 0.7rem;
    display: flex;
    flex-direction: column; /* Ícone sobre texto sempre */
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    min-width: 60px; /* Garante que o botão tenha um clique bom */
    transition: background 0.2s;
}

.btn-baixar-nav:hover {
    background: var(--primary-hover);
}

.btn-baixar-nav .menu-icon {
    font-size: 1rem !important; /* Ícone menor no PC para alinhar */
    margin-bottom: 2px;
}

/* Estilo base para o botão de apagar (rosa claro) */
.btn-apagar-hover {
    background: #ffeded !important;
    color: #dc3545 !important;
    border: 1px solid #ffcccc !important;
    cursor: pointer; /* Faz aparecer a "mãozinha" de clique */
    transition: all 0.2s ease;
}

/* Efeito ao passar o mouse no botão de apagar */
.btn-apagar-hover:hover {
    background: #f8d7da !important; /* Um rosa um pouco mais escuro */
    transform: scale(1.05); /* Dá um leve aumento para mostrar que é clicável */
}

/* Garante que todos os botões no nav tenham o cursor de clique */
.btn-baixar-nav {
    cursor: pointer;
}

/* --- GRIDS E CARDS --- */

.galeria {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.grid-albuns {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.card, .card-album {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: 0.3s;
}

.card:hover, .card-album:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.15); 
}

.card img, .card video { width: 100%; height: 220px; object-fit: cover; }
.card-album img { width: 100%; height: 160px; object-fit: cover; }

.card-body, .album-info { padding: 15px; }

.card-body h3 {
    margin-bottom: 8px; /* Espaço abaixo do título da foto */
}

.card-body p {
    margin-bottom: 12px; /* Espaço abaixo da descrição */
}

.btn-whatsapp-share:active {
    transform: scale(0.95);
    background-color: rgba(37, 211, 102, 0.1);
}

/* --- FORMULÁRIOS E INPUTS --- */

.upload-container {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    max-width: 500px;
    margin: 0 auto 30px auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    margin: 8px 0 15px 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    box-sizing: border-box;
}

/* --- TAGS E ACOES --- */

.tag {
    display: inline-block;
    background: var(--tag-bg);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.acoes {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.btn-acao {
    border: none; background: none; cursor: pointer; 
    font-size: 0.85rem; color: var(--primary); font-weight: 500;
}

.btn-acao.del { color: var(--danger); }

/* --- LIGHTBOX E ANIMAÇÕES --- */

.lightbox {
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.loading-anim { animation: blink 1.5s infinite; }

/* --- RESPONSIVIDADE (CELULAR) --- */
@media (max-width: 600px) {
    .header-principal {
        padding: 5px 0;
    }

    nav {
        max-width: 100% !important; 
        width: 100%;
        border-radius: 0; 
        border-left: none;
        border-right: none;
        padding: 8px 0; /* Removido padding lateral para ganhar cada pixel */
        min-width: 0;
    }

    /* Força os 5 itens a dividirem a tela perfeitamente */
    .nav-normal-mode {
        width: 100%;
        display: flex;
        justify-content: space-evenly;
        gap: 0;
    }

    .nav-normal-mode a {
        flex-direction: column !important; /* Ícone sobre o texto */
        align-items: center;
        justify-content: center;
        flex: 1; /* Ocupa exatamente 1/5 da tela */
        min-width: 0;
        gap: 2px !important;
        padding: 0 2px;
    }

    .menu-text {
        font-size: 0.6rem !important; /* Diminuído para não empurrar o vizinho */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip; /* Se o nome for grande, ele corta em vez de rolar */
    }

    .menu-icon {
        font-size: 1.1rem !important; /* Tamanho ideal para 5 ícones */
        margin-bottom: 2px;
    }

    /* Ajuste Modo Álbum: Título e botões */
    .nav-album-mode {
        grid-template-columns: 35px 1fr 115px; /* Seta menor e botão compacto */
        gap: 5px;
        padding: 0 5px;
    }

    .nav-album-title {
        font-size: 0.85rem;
    }
}

/* Estilo para garantir que o ícone do menu tenha destaque */
.menu-icon {
    font-size: 1.4rem;
    line-height: 1;
}

/* --- AJUSTES DE ESPAÇAMENTO DA HOME --- */
.home-container {
    text-align: center;
}

/* Espaço para o botão Adicionar Fotos */
.container-acoes-home {
    margin: 30px 0;
}

.btn-importar-home {
    text-decoration: none;
    padding: 15px 30px;
    width: auto !important;
}

/* Espaço para a Busca */
.busca-container {
    max-width: 600px;
    margin: 30px auto;
}

/* Espaço para o Divisor e Título Nossos Álbuns */
.divisor-home {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 45px 0 25px 0; /* Espaçamento generoso para não grudar */
}

.titulo-albuns {
    margin-bottom: 25px !important;
    display: block;
}

/* Seção de Segurança lá embaixo */
.secao-seguranca {
    margin-top: 60px;
    padding: 40px 20px;
    border-top: 1px dashed var(--border);
    text-align: center;
}

.btn-backup {
    width: auto !important;
    background-color: #6c757d !important;
    padding: 10px 25px;
    text-decoration: none;
}

/* --- AJUSTE DA SEÇÃO DE SEGURANÇA --- */
.secao-seguranca {
    margin-top: 80px; /* Grande distância do conteúdo acima */
    padding: 40px 20px;
    border-top: 1px solid var(--border);
    background-color: #f8f9fa; /* Um cinza bem clarinho para separar do branco */
}

.seguranca-card {
    max-width: 700px;
    margin: 0 auto;
}

.seguranca-card h3 {
    margin-bottom: 15px;
    color: var(--text);
}

.seguranca-card p {
    margin-bottom: 25px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.container-acoes-seguranca {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.btn-backup {
    width: auto !important;
    background-color: #6c757d !important; /* Cor cinza para diferenciar do azul principal */
    padding: 15px 35px !important;
    text-decoration: none;
    font-size: 0.9rem !important;
}

.aviso-seguranca {
    display: block;
    color: #a0a0a0;
    font-size: 0.8rem;
    font-style: italic;
}

/* No Celular */
@media (max-width: 600px) {
    .secao-seguranca {
        margin-top: 50px;
        padding: 30px 15px;
    }
    
    .btn-backup {
        width: 100% !important; /* No celular o botão de backup fica grande para facilitar o clique */
    }
}

/* Estilo do Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* Botão Fechar (X) - Perfeito para o polegar no celular */
.btn-fechar-lb {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 35px;
    color: white;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    pointer-events: auto;
}

/* Ajuste das imagens dentro do Lightbox */
.lightbox img, .lightbox video {
    max-width: 95vw;
    max-height: 85vh;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* --- GESTÃO DE TAGS --- */
.container-tag-gestao {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.form-inline-tag {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    align-items: center;
}

.form-inline-tag input {
    flex: 2;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 1rem;
    min-width: 0;
    margin: 0; /* Remove margens automáticas que possam quebrar o alinhamento */
}

.form-inline-tag .btn-add-tag {
    flex: 0 0 auto;
    width: auto !important;
    padding: 12px 25px;
    white-space: nowrap;
    margin: 0;
}

.tabela-tags {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    width: 100%;
    border-collapse: collapse;
}

.tabela-tags thead { background: #f8f9fa; }
.tabela-tags th, .tabela-tags td { padding: 15px; text-align: left; }
.tabela-tags tr { border-top: 1px solid #eee; }

/* --- AJUSTE DE TAMANHO DOS CARDS (Sua solicitação anterior) --- */
/* Cards na Home (Menores conforme solicitado) */
.grid-albuns .card-album img {
    height: 150px; /* Reduzido de 160px */
}

/* Cards na Galeria Normal (Padrão) */
.galeria .card img, .galeria .card video {
    height: 220px;
}

/* --- PAGINA DE CONFIGURAÇÕES --- */
.container-config {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.grid-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch; /* Essencial para alinhar as alturas */
}

.card-config {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: 0.3s;
    height: 100%;          /* Ocupa toda a altura da grid */
    display: flex;         /* Inicia o flex para alinhar conteúdo interno */
    flex-direction: column;
    justify-content: center;
    border: 1px solid transparent; /* Evita "pulo" no hover */
}

.card-config:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    border-color: var(--primary);
}

.card-config h3 {
    margin: 0;
    color: var(--text);
}

.card-config p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}