:root {
    --bg-primary: #f8f9fa;
    --text-main: #212529;
    --text-muted: #6c757d;
    --accent: #0d6efd;
    
    /* Cores do Semáforo */
    --cor-verde: #2ec4b6;
    --cor-amarelo: #ffb703;
    --cor-vermelho: #e63946;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 16px;
}

.app-container {
    flex: 1;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 10px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a1a1a;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Opções de Perfil */
.perfil-section {
    margin-bottom: 24px;
}

.perfil-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-perfil {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 14px 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-perfil span {
    font-size: 1.2rem;
}

.btn-perfil:hover {
    border-color: #ccc;
}

.btn-perfil.active {
    border-color: var(--accent);
    background-color: #eec; /* Será substituído por leve azul dinamicamente ou mantido fixo */
    background: linear-gradient(145deg, #f0f7ff, #e1efff);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.15);
}

/* Barra de Busca Híbrida */
.busca-section {
    margin-bottom: 24px;
    position: relative;
}

.busca-wrapper {
    display: flex;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: border-color 0.2s;
}

.busca-wrapper:focus-within {
    border-color: var(--accent);
}

#input-busca {
    flex: 1;
    border: none;
    padding: 16px;
    font-size: 1rem;
    outline: none;
}

#btn-camera {
    background: #f1f3f5;
    border: none;
    width: 60px;
    font-size: 1.3rem;
    color: #495057;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-camera:hover {
    background: #e9ecef;
    color: var(--accent);
}

/* Autocompletar */
#lista-autocompletar {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

#lista-autocompletar li {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    font-size: 0.95rem;
}

#lista-autocompletar li:last-child {
    border-bottom: none;
}

#lista-autocompletar li:hover {
    background-color: #f1f3f5;
}

.hidden {
    display: none !important;
}

/* Cartão de Resultado Semáforo */
.resultado-container {
    animation: fadeInUp 0.3s ease-out;
}

/* Atualização para os Cards em Lista */
.card-resultado {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    text-align: left; /* Alinhado à esquerda fica mais legível para listas */
    position: relative;
    overflow: hidden;
    border-left: 8px solid #ccc; /* Bordas laterais ficam lindas em listas */
}

.status-badge {
    float: right; /* Joga a tag do semáforo para o canto superior direito */
    padding: 6px 12px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* Cores dinâmicas atualizadas */
.status-verde .status-badge { background-color: var(--cor-verde); }
.status-amarelo .status-badge { background-color: var(--cor-amarelo); color: #000; }
.status-vermelho .status-badge { background-color: var(--cor-vermelho); }

.status-verde { border-left-color: var(--cor-verde); }
.status-amarelo { border-left-color: var(--cor-amarelo); }
.status-vermelho { border-left-color: var(--cor-vermelho); }

#resultado-nome {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 6px;
}

#resultado-explicacao {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #495057;
}

/* Rodapé */
footer {
    text-align: center;
    padding: 24px 0 10px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Indicador de carregamento da IA */
.loader-container {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}