/* components/popup/popup.css */
.fab-btn { position: absolute; bottom: 20px; right: 20px; width: 44px; height: 44px; border-radius: 50%; background-color: var(--primary); color: white; border: none; font-size: 18px; cursor: pointer; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4); transition: transform 0.2s, background-color 0.2s; display: flex; align-items: center; justify-content: center; }
.fab-btn:hover { background-color: var(--primary-hover); transform: scale(1.05); }

.popup-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 9990; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; }
.popup-overlay.active { display: flex; opacity: 1; }

/* 
   AQUI FOI A GRANDE MUDANÇA:
   - Aumentei o max-width genérico para 400px (antes era 320px).
   - O width a 95% garante que em telemóveis super estreitos não corta fora do ecrã.
*/
.popup-content { 
    background-color: var(--bg-panel); 
    border: 1px solid var(--border-color); 
    border-radius: var(--radius-md); 
    width: 95%; 
    max-width: 400px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.6); 
    transform: scale(0.95); 
    transition: transform 0.2s; 
}
.popup-overlay.active .popup-content { transform: scale(1); }

.popup-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border-color); }

/* O título ficou ligeiramente maior (16px) para acompanhar a nova largura */
.popup-header h3 { font-size: 16px; font-weight: 600; color: var(--text-main); }
.popup-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; transition: color 0.2s; }
.popup-header button:hover { color: #ef4444; }

.popup-options { display: flex; flex-direction: column; padding: 10px; }

/* Os botões dentro dos popups ficaram com mais espaço (padding) */
.popup-options button { display: flex; align-items: center; gap: 15px; width: 100%; padding: 14px 20px; background: transparent; border: none; color: var(--text-main); font-size: 14px; font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); transition: background-color 0.2s; }
.popup-options button:hover { background-color: rgba(255, 255, 255, 0.05); }
.popup-options button i { font-size: 18px; width: 25px; text-align: center; }

.codex-item-select:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Garante que botões AMT fiquem pequenos e quadrados */
.btn-amt {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 26px;
    height: 26px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}

.btn-amt:hover {
    border-color: var(--primary);
    color: white;
    background: var(--bg-body);
}

/* Reset para os inputs dentro do card codex para não parecerem textareas */
.codex-card input {
    height: auto !important;
    min-height: 0 !important;
}

/* Esconde as setas do input number (Ano) */
.codex-card input::-webkit-outer-spin-button,
.codex-card input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Botões Circulares de Ação (Picards) */
.btn-action-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05); /* Fundo muito subtil */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

/* Quando passas o rato, ele "acorda" */
.btn-action-circle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Destaque para a ação principal (Ícone Indigo) */
.btn-action-circle.primary-icon {
    color: var(--primary);
    border-color: rgba(99, 102, 241, 0.2);
}

.btn-action-circle.primary-icon:hover {
    background: var(--primary); /* Só fica sólido no hover */
    color: white;
    border-color: var(--primary);
}

/* Container das abas do Popup */
.sub-tabs {
    display: flex;
    gap: 8px;
    background: transparent;
    padding: 10px 0;
}

/* Botões Inativos do Popup */
.sub-tabs button {
    background: transparent; /* Remove o fundo cinzento/escuro */
    border: 1px solid rgba(255, 255, 255, 0.1); /* Borda muito subtil */
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px;
    transition: 0.2s;
}

/* Botão Ativo do Popup (Estilo "Pill" Sólido) */
.sub-tabs button.active {
    background-color: white !important; /* Cor sólida como na imagem */
    color: #0f172a !important; /* Texto escuro para contraste */
    border-color: white;
    font-weight: 700;
}

/* Efeito Hover nos inativos do popup */
.sub-tabs button:not(.active):hover {
    border-color: var(--primary);
    color: var(--text-main);
}