/* Frontend: scheda insegnamento e badge.
   Volutamente sobrio: eredita font e colori dal tema, aggiunge solo layout. */

/* ---- Pagina del singolo insegnamento (template del plugin) ----
   Card centrata nella pagina e con UN SOLO sfondo: l'articolo non usa il
   riquadro bianco del tema (.z3-post), così resta solo il riquadro morbido
   della scheda. */
.rm-single {
	max-width: 880px;
	margin: 0 auto;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: visible;
}

.rm-single .rm-card {
	margin-bottom: 0;
}

/* Il riquadro riempie la colonna centrata (niente larghezza doppia). */
.rm-single .rm-card__box {
	max-width: none;
}

/* ---- Scheda singolo insegnamento ---- */
.rm-card {
	--rm-blue: #1788d1;
	margin: 0 0 1.5em;
}

.rm-card__summary {
	margin: 0 0 1.4em;
	font-size: 1.05em;
	line-height: 1.6;
}

/* Riquadro morbido che contiene tabella + pulsanti (come da mockup). */
.rm-card__box {
	max-width: 880px;
	padding: 26px 38px;
	border: 1px solid #ececec;
	border-radius: 16px;
	background: #f9f9f9;
	box-shadow: 0 12px 30px rgba( 0, 0, 0, 0.06 );
}

.rm-card__table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
}

.rm-card__table th,
.rm-card__table td {
	text-align: left;
	vertical-align: top;
	padding: 0.85em 0.5em;
	border-bottom: 1px solid #e7e7e7;
}

.rm-card__table tr:last-child th,
.rm-card__table tr:last-child td {
	border-bottom: 0;
}

.rm-card__table th {
	width: 40%;
	font-weight: 700;
	color: #1f2937;
}

/* I valori (incluse le tassonomie linkate e il docente) sono blu. */
.rm-card__table td,
.rm-card__table td a {
	color: var( --rm-blue );
	font-weight: 600;
	text-decoration: none;
}

.rm-card__table td a:hover,
.rm-card__table td a:focus {
	text-decoration: underline;
}

.rm-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 22px;
}

/* Pulsante a pillola blu del mockup. */
.rm-card .rm-button {
	display: inline-block;
	padding: 13px 30px;
	border: 2px solid var( --rm-blue );
	border-radius: 999px;
	background: var( --rm-blue );
	color: #fff !important;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: none;
}

.rm-card .rm-button:hover,
.rm-card .rm-button:focus {
	background: #1369a8;
	border-color: #1369a8;
	color: #fff !important;
}

/* Variante secondaria (syllabus): contorno blu, sfondo bianco. */
.rm-card .rm-button--secondary {
	background: #fff;
	color: var( --rm-blue ) !important;
}

.rm-card .rm-button--secondary:hover,
.rm-card .rm-button--secondary:focus {
	background: #eaf4fb;
	color: #1369a8 !important;
}

/* Pulsante "programma" disattivato: stessa pillola, ma grigia e non
   cliccabile (materia senza PDF associato). */
.rm-card .rm-button--disabled {
	background: #d9d9d9 !important;
	border-color: #d9d9d9 !important;
	color: #6b6b6b !important;
	box-shadow: none !important;
	cursor: not-allowed;
	pointer-events: none;
}

.rm-card .rm-button--disabled:hover,
.rm-card .rm-button--disabled:focus {
	background: #d9d9d9 !important;
	border-color: #d9d9d9 !important;
	color: #6b6b6b !important;
	transform: none !important;
}

@media ( max-width: 600px ) {
	.rm-card__box {
		padding: 20px 18px;
	}

	.rm-card__table th,
	.rm-card__table td {
		display: block;
		width: auto;
		padding: 0.35em 0;
		border-bottom: 0;
	}

	.rm-card__table td {
		padding-bottom: 0.9em;
		border-bottom: 1px solid #e7e7e7;
	}
}

/* Colori del tema in uso (zulli3): accento e colore primario, con fallback
   all'azzurro brand del sito se le variabili non fossero disponibili. */
.rm-archive,
.rm-badges,
.rm-filter {
	--rm-accent: var( --z3-accent, #0077b6 );
	--rm-primary: var( --z3-primary, #003954 );
}

/* La testata e i contenitori sono quelli nativi del tema (.z3-page-header /
   .z3-content / .z3-container): nessuno stile qui, per restare identici al tema. */

/* ---- Filtro interattivo archivio ---- */
.rm-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	align-items: flex-end;
	margin: 0 0 2em;
	padding: 1em 1.2em;
	border: 1px solid rgba( 0, 0, 0, 0.08 );
	border-left: 4px solid var( --rm-accent );
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.06 );
}

.rm-filter__field {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
}

.rm-filter__label {
	font-size: 0.82em;
	font-weight: 600;
	opacity: 0.85;
}

.rm-filter select {
	min-width: 180px;
	padding: 0.45em 0.6em;
	border-radius: 6px;
}

.rm-filter select:focus {
	outline: 2px solid var( --rm-accent );
	outline-offset: 1px;
}

/* Casella di ricerca testuale dell'archivio. */
.rm-filter__search {
	flex: 1 1 240px;
}

.rm-filter input[type="search"] {
	width: 100%;
	min-width: 200px;
	padding: 0.45em 0.6em;
	border: 1px solid rgba( 0, 0, 0, 0.2 );
	border-radius: 6px;
}

.rm-filter input[type="search"]:focus {
	outline: 2px solid var( --rm-accent );
	outline-offset: 1px;
}

.rm-filter__submit {
	padding: 0.5em 1.5em;
	border: 0;
	border-radius: 6px;
	background: var( --rm-accent );
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.rm-filter__submit:hover,
.rm-filter__submit:focus {
	filter: brightness( 0.94 );
}

/* ---- Badge / archivio per anno accademico ---- */
.rm-badges__group {
	margin: 0 0 2.2em;
}

.rm-badges__heading {
	margin: 0 0 0.9em;
	padding-bottom: 0.35em;
	border-bottom: 2px solid var( --rm-accent );
}

/* Griglia: 4 insegnamenti per riga, celle di egual dimensione. */
.rm-badges__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: 1.2em;
}

.rm-badge {
	margin: 0;
	display: flex; /* la card riempie l'intera cella della griglia */
}

@media ( max-width: 900px ) {
	.rm-badges__list {
		grid-template-columns: repeat( 2, 1fr );
	}
}

@media ( max-width: 560px ) {
	.rm-badges__list {
		grid-template-columns: 1fr;
	}
}

/* Card moderna: barra d'accento in alto, ombra morbida, hover sollevato. */
.rm-badge__link {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 4px;
	width: 100%;
	min-width: 0; /* consente alla cella della griglia di restringersi */
	height: 100%; /* tutte le card della riga della stessa altezza */
	box-sizing: border-box;
	padding: 1em 1.1em;
	border: 1px solid rgba( 0, 0, 0, 0.08 );
	border-top: 4px solid var( --rm-accent );
	border-radius: 10px;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.08 );
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.rm-badge__link:hover,
.rm-badge__link:focus-visible {
	box-shadow: 0 8px 22px rgba( 0, 0, 0, 0.14 );
	transform: translateY( -3px );
}

/* Pillola CFU in evidenza in alto. */
.rm-badge__cfu {
	align-self: flex-start;
	padding: 0.15em 0.7em;
	border-radius: 999px;
	font-size: 0.78em;
	font-weight: 700;
	color: #fff;
	background: var( --rm-accent );
}

.rm-badge__name {
	margin: 0.45em 0 0.1em;
	font-weight: 700;
	font-size: 1.05em;
	line-height: 1.25;
	overflow-wrap: break-word;
	color: var( --rm-primary );
}

/* Elenco di TUTTE le info della materia. */
.rm-badge__meta-list {
	display: flex;
	flex-direction: column;
	gap: 0.45em;
	margin: 0.5em 0 0;
	padding-top: 0.6em;
	border-top: 1px solid rgba( 0, 0, 0, 0.08 );
}

.rm-badge__row {
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.rm-badge__row dt {
	font-size: 0.66em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var( --z3-medium-gray, #6c757d );
}

.rm-badge__row dd {
	margin: 0;
	font-size: 0.9em;
	line-height: 1.3;
	color: var( --z3-text, #212529 );
	overflow-wrap: break-word;
}

/* Richiamo "vedi scheda" in fondo alla card. */
.rm-badge__cta {
	margin-top: auto;
	padding-top: 0.7em;
	font-size: 0.82em;
	font-weight: 600;
	color: var( --rm-accent );
}

.rm-empty {
	font-style: italic;
	opacity: 0.8;
}
