/* ISOLAMENTO PARA EVITAR CONFLITOS COM CMS (WordPress/Joomla) */
#conv-tp-root {
	--tp-primary: #9b1c31; /* Rubi */
	--tp-bg-card: #ffffff;
	--tp-bg-dark: #0f172a;
	--tp-text-dark: #1e293b;
	--tp-border: #e2e8f0;

	/* Cores IUPAC */
	--nm-color: #ef4444; /* Não Metais */
	--gn-color: #a855f7; /* Gases Nobres */
	--re-color: #10b981; /* Representativos */
	--te-color: #3b82f6; /* Transição Externa */
	--ti-color: #f59e0b; /* Transição Interna */

	font-family: 'Inter', system-ui, sans-serif;
	color: var(--tp-text-dark);
	max-width: 1400px;
	margin: 0 auto;
	padding: 20px;
}

#conv-tp-root header { text-align: center; margin-bottom: 30px; }
#conv-tp-root .conv-title-tp { color: var(--tp-primary); font-size: 2rem; font-weight: 800; text-transform: uppercase; margin: 0; }

/* BARRA DE BUSCA ESTILO CONVERTUS */
#conv-tp-root .search-container { max-width: 500px; margin: 20px auto; position: relative; }
#conv-tp-root .search-bar { 
	width: 100%; padding: 15px 25px; border-radius: 50px; 
	border: 2px solid var(--tp-border); background: #fff;
	font-size: 1rem; transition: 0.3s; outline: none; box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
#conv-tp-root .search-bar:focus { border-color: var(--tp-primary); box-shadow: 0 4px 20px rgba(155, 28, 49, 0.15); }

/* GRID DA TABELA */
#conv-tp-root .table-scroller { 
    overflow-x: hidden; /* Troque auto por hidden para desktop */
    background: var(--tp-bg-card); 
    padding: 10px; /* Reduzi um pouco para ganhar espaço lateral */
    border-radius: 16px; 
    border: 1px solid var(--tp-border);
    width: 100%; /* Garante que respeite o pai */
    box-sizing: border-box;
}
#conv-tp-root .periodic-table { 
    display: grid; 
    grid-template-columns: repeat(18, 1fr); 
    gap: 4px; 
    min-width: 0; /* MUITO IMPORTANTE: Mude de 1100px para 0 */
    width: 100%; 
}

/* CÉLULA DO ELEMENTO */
#conv-tp-root .el-cell { 
	aspect-ratio: 1/1.1; border-radius: 6px; display: flex; flex-direction: column; 
	width: 100%;
	min-width: 0;
	align-items: center; justify-content: center; cursor: pointer; transition: 0.2s;
	border: 1px solid rgba(0,0,0,0.05); padding: 5px; position: relative; color: white;
}
#conv-tp-root .el-cell:hover { transform: scale(1.15); z-index: 50; box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
#conv-tp-root .el-cell .z { position: absolute; top: 3px; left: 5px; font-size: 0.6rem; font-weight: bold; opacity: 0.9; }
#conv-tp-root .el-cell .sym { font-weight: 900; font-size: 1.2rem; }
#conv-tp-root .el-cell .name { font-size: 0.45rem; text-transform: uppercase; font-weight: 600; text-align: center; }

/* CATEGORIAS COLORIDAS */
#conv-tp-root .NM { background: var(--nm-color); } 
#conv-tp-root .GN { background: var(--gn-color); }
#conv-tp-root .R  { background: var(--re-color); } 
#conv-tp-root .TE { background: var(--te-color); } 
#conv-tp-root .TI { background: var(--ti-color); }

/* MODAL REFATORADO */
#conv-tp-root .tp-modal { 
	position: fixed; inset: 0; background: rgba(15, 23, 42, 0.95); 
	display: none; align-items: center; justify-content: center; z-index: 9999; padding: 20px; 
}
#conv-tp-root .modal-content { 
	background: #fff; width: 100%; max-width: 500px; border-radius: 24px; 
	padding: 40px; position: relative; text-align: center; overflow: hidden;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
#conv-tp-root .close-btn { position: absolute; top: 80px; right: 25px; font-size: 1.5rem; cursor: pointer; color: #94a3b8; }

/* DIAGRAMA DE PAULING ACADÊMICO */
#conv-tp-root .pauling-grid { 
	display: grid; grid-template-columns: repeat(4, 1fr); 
	gap: 12px; margin: 30px auto; max-width: 350px; position: relative;
}
#conv-tp-root .orbital { 
	height: 50px; border-radius: 12px; border: 2px solid #f1f5f9;
	display: flex; align-items: center; justify-content: center; font-size: 0.8rem;
	font-weight: bold; color: #cbd5e1; background: #f8fafc; transition: 0.3s;
}
#conv-tp-root .orbital.active { color: white; border-color: transparent; }
#conv-tp-root .orbital.s.active { background: var(--nm-color); }
#conv-tp-root .orbital.p.active { background: var(--re-color); }
#conv-tp-root .orbital.d.active { background: var(--te-color); }
#conv-tp-root .orbital.f.active { background: var(--ti-color); }

#conv-tp-root .modal-footer { 
	background: #f8fafc; padding: 20px; border-radius: 16px; 
	color: var(--tp-primary); font-weight: 800; border: 1px solid #f1f5f9;
}

/* MOBILE */
@media (max-width: 900px) {
	#conv-tp-root .periodic-table { display: flex; flex-direction: column; min-width: unset; gap: 30px; }
	#conv-tp-root .cat-section { 
		display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); 
		gap: 8px; padding: 15px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0;
	}
	#conv-tp-root .cat-header { 
		grid-column: 1 / -1; color: var(--tp-primary); font-weight: 900; 
		margin-bottom: 10px; border-bottom: 2px solid var(--tp-border); font-size: 0.75rem; padding-bottom: 5px;
	}
}