/**
 * Odontogramma Plus - Odontogramma Master.
 */

.medaid-odonto-master {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 0 0 16px;
	padding: 12px 14px 8px;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	background: #fff;
}

.medaid-odonto-master__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-bottom: 6px;
}

.medaid-odonto-master__title {
	font-weight: 600;
	font-size: 0.95rem;
	color: #111827;
}

.medaid-odonto-master__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.78rem;
	color: #6b7280;
}

.medaid-odonto-master__legend li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.medaid-odonto-legend-dot {
	width: 12px;
	height: 12px;
	border-radius: 3px;
	border: 1px solid #9ca3af;
	display: inline-block;
}

.medaid-odonto-legend-dot--none { background: #fff; }
.medaid-odonto-legend-dot--todo { background: #e53935; border-color: #e53935; }
.medaid-odonto-legend-dot--done { background: #111111; border-color: #111111; }
.medaid-odonto-legend-dot--both {
	border-color: #111111;
	background: repeating-linear-gradient(45deg, #e53935 0 3px, #111111 3px 6px);
}

.medaid-odonto-master__stage {
	width: 100%;
	display: flex;
	justify-content: center;
}

.medaid-odonto-master__stage .mdp-svg {
	width: 100%;
	height: auto;
	max-height: 420px;
	display: block;
	overflow: visible;
}

.medaid-odonto-master__hint {
	margin: 6px 0 0;
	font-size: 0.75rem;
	color: #9ca3af;
	text-align: center;
}

.medaid-odonto-master__empty {
	margin: 18px 0;
	font-size: 0.85rem;
	color: #6b7280;
	text-align: center;
}

.medaid-odonto-master.is-awaiting-patient {
	opacity: 0.75;
}

/* --- SVG --- */

.mdp-axis {
	stroke: #1f2937;
	stroke-width: 2;
	stroke-linecap: round;
}

.mdp-label {
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	fill: #374151;
	cursor: pointer;
	user-select: none;
}

.mdp-quadrant {
	font-family: inherit;
	font-size: 11px;
	fill: #9ca3af;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	pointer-events: none;
}

.mdp-tooth {
	cursor: pointer;
	outline: none;
}

.mdp-tooth__hit {
	fill: transparent;
	stroke: none;
	pointer-events: all;
}

.mdp-tooth__shape {
	fill: #ffffff;
	stroke: #4b5563;
	stroke-width: 1.4;
	stroke-linejoin: round;
	transition: fill 0.12s ease;
}

.mdp-tooth__cervical {
	fill: none;
	stroke: #6b7280;
	stroke-width: 1;
	pointer-events: none;
}

/* Stati */
.mdp-tooth.is-todo .mdp-tooth__shape { fill: #e53935; }
.mdp-tooth.is-done .mdp-tooth__shape { fill: #111111; }
.mdp-tooth.is-both .mdp-tooth__shape { fill: url(#mdp-zebra); }

.mdp-tooth.is-done .mdp-tooth__cervical,
.mdp-tooth.is-both .mdp-tooth__cervical {
	stroke: rgba(255, 255, 255, 0.6);
}

/* Hover / focus: #749AD8 */
.mdp-tooth:hover .mdp-tooth__shape,
.mdp-tooth.is-hover .mdp-tooth__shape,
.mdp-tooth:focus-visible .mdp-tooth__shape {
	fill: #749AD8;
	stroke: #3f5fa3;
}

.mdp-tooth:hover .mdp-tooth__cervical,
.mdp-tooth.is-hover .mdp-tooth__cervical,
.mdp-tooth:focus-visible .mdp-tooth__cervical {
	stroke: rgba(255, 255, 255, 0.85);
}

/* --- Modal leggero --- */

.mdp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.mdp-modal[hidden] {
	display: none;
}

.mdp-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.35);
}

.mdp-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 380px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
	padding: 18px 18px 14px;
	animation: mdp-pop 0.14s ease-out;
}

@keyframes mdp-pop {
	from { transform: translateY(6px) scale(0.98); opacity: 0; }
	to   { transform: none; opacity: 1; }
}

.mdp-modal__close {
	position: absolute;
	top: 8px;
	right: 10px;
	border: 0;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	color: #9ca3af;
	cursor: pointer;
}

.mdp-modal__close:hover {
	color: #374151;
}

.mdp-modal__title {
	margin: 0 0 12px;
	font-size: 1rem;
	font-weight: 600;
	color: #111827;
}

.mdp-modal__options {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mdp-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 10px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.9rem;
	color: #111827;
	margin: 0;
	transition: border-color 0.12s ease, background 0.12s ease;
}

.mdp-option:hover {
	border-color: #749AD8;
	background: #f4f7fd;
}

.mdp-option input {
	margin: 0;
	accent-color: #749AD8;
}

.mdp-option__swatch {
	width: 14px;
	height: 14px;
	border-radius: 3px;
	flex: 0 0 auto;
}

.mdp-option--todo .mdp-option__swatch { background: #e53935; }
.mdp-option--done .mdp-option__swatch { background: #111111; }

.mdp-option input:disabled ~ .mdp-option__label {
	color: #9ca3af;
}

.mdp-modal__error {
	margin: 10px 0 0;
	font-size: 0.8rem;
	color: #b91c1c;
}

.mdp-modal__error[hidden] {
	display: none;
}

.mdp-modal__actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 14px;
}

.mdp-btn {
	padding: 6px 14px;
	font-size: 0.85rem;
	border-radius: 8px;
}

.mdp-btn--save:disabled {
	opacity: 0.6;
	cursor: default;
}

/* --- Note per dente --- */

.medaid-odonto-legend-note {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #f59e0b;
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px #d97706;
	display: inline-block;
	margin: 0 2px;
}

.mdp-note-dot {
	display: none;
	fill: #f59e0b;
	stroke: #ffffff;
	stroke-width: 1.5;
	cursor: pointer;
}

.mdp-note-dot.is-visible {
	display: inline;
}

.mdp-modal__note {
	margin-top: 12px;
}

.mdp-modal__note-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 4px;
}

.mdp-modal__note-label {
	margin: 0;
	font-size: 0.82rem;
	font-weight: 600;
	color: #374151;
}

.mdp-modal__note-count {
	font-size: 0.72rem;
	color: #9ca3af;
	font-variant-numeric: tabular-nums;
}

.mdp-modal__note-count.is-near-limit {
	color: #b45309;
}

.mdp-modal__note-input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	min-height: 84px;
	max-height: 260px;
	resize: vertical;
	padding: 8px 10px;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	font: inherit;
	font-size: 0.88rem;
	line-height: 1.45;
	color: #111827;
	background: #fff;
	transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.mdp-modal__note-input:focus {
	outline: none;
	border-color: #749AD8;
	box-shadow: 0 0 0 3px rgba(116, 154, 216, 0.2);
}

.mdp-modal__note-input[readonly] {
	background: #f9fafb;
	color: #374151;
}

.mdp-modal__note-hint {
	display: block;
	margin-top: 4px;
	font-size: 0.7rem;
	color: #9ca3af;
	text-align: right;
}

.mdp-modal__note-hint[hidden],
.mdp-modal__meta[hidden] {
	display: none;
}

.mdp-modal__meta {
	margin: 8px 0 0;
	font-size: 0.72rem;
	color: #6b7280;
}

/* --- Tooltip dente --- */

.mdp-tip {
	position: fixed;
	z-index: 99990; /* sotto il modal (100000) */
	max-width: 280px;
	min-width: 150px;
	padding: 9px 11px 8px;
	border-radius: 9px;
	background: #1f2937;
	color: #f9fafb;
	font-size: 0.8rem;
	line-height: 1.4;
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
	pointer-events: none;
	opacity: 0;
	transform: translateY(3px);
	transition: opacity 0.12s ease, transform 0.12s ease;
}

.mdp-tip.is-below {
	transform: translateY(-3px);
}

.mdp-tip.is-visible {
	opacity: 1;
	transform: none;
}

.mdp-tip[hidden] {
	display: none;
}

.mdp-tip::after {
	content: "";
	position: absolute;
	left: var(--mdp-tip-arrow, 50%);
	top: 100%;
	margin-left: -6px;
	border: 6px solid transparent;
	border-top-color: #1f2937;
}

.mdp-tip.is-below::after {
	top: auto;
	bottom: 100%;
	border-top-color: transparent;
	border-bottom-color: #1f2937;
}

.mdp-tip__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.mdp-tip__head strong {
	font-weight: 600;
	white-space: nowrap;
}

.mdp-tip__status {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 0.72rem;
	color: #d1d5db;
	white-space: nowrap;
}

.mdp-tip__status i {
	width: 9px;
	height: 9px;
	border-radius: 2px;
	display: inline-block;
	border: 1px solid rgba(255, 255, 255, 0.5);
}

.mdp-tip__status--todo i { background: #e53935; border-color: #e53935; }
.mdp-tip__status--done i { background: #111111; }
.mdp-tip__status--both i { background: repeating-linear-gradient(45deg, #e53935 0 2px, #111111 2px 4px); }

.mdp-tip__note {
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px solid rgba(255, 255, 255, 0.12);
	white-space: pre-line;
	word-break: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 6;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mdp-tip__meta {
	margin-top: 6px;
	font-size: 0.7rem;
	color: #9ca3af;
}

.mdp-tip__foot {
	margin-top: 4px;
	font-size: 0.68rem;
	color: #749AD8;
}

@media (prefers-reduced-motion: reduce) {
	.mdp-tip {
		transition: none;
	}
}

@media (max-width: 640px) {
	.medaid-odonto-master {
		padding: 10px 8px 6px;
	}
	.mdp-label {
		font-size: 17px;
	}
}
