/* =============================================================================
 * Torneo Basket 3x3 - Iscrizione Squadre
 * Foglio di stile pubblico del plugin (shortcode [torneo_basket])
 *
 * Autore : Mario Velucchi - Consulente Informatico - P.IVA IT01977140506
 * Versione: 1.0.0
 *
 * Palette consolidata:
 *   --tb-navy   #1E3A5F  blu-grigio scuro (intestazioni, testo forte)
 *   --tb-blue   #1a4fc0  blu primario (pulsanti, accenti)
 *   --tb-orange #FF4500  arancio internazionale (call-to-action, evidenze)
 *
 * Note: tutte le regole sono prefissate con .tb3-app per non interferire
 * con il tema WordPress ospitante.
 * ========================================================================== */

/* -------------------------------------------------------------------------
 * 1. Variabili di tema
 * ---------------------------------------------------------------------- */
.tb3-app {
	--tb-navy:        #1E3A5F;
	--tb-navy-dark:   #142a45;
	--tb-blue:        #1a4fc0;
	--tb-blue-dark:   #1440a0;
	--tb-orange:      #FF4500;
	--tb-orange-dark: #e63e00;
	--tb-bg:          #f4f6f9;
	--tb-card:        #ffffff;
	--tb-border:      #d9e0ea;
	--tb-text:        #2b3440;
	--tb-muted:       #6b7785;
	--tb-radius:      14px;
	--tb-shadow:      0 6px 22px rgba(30, 58, 95, 0.10);

	color: var(--tb-text);
	font-size: 16px;
	line-height: 1.55;
}

/* Contenitore generale dello shortcode */
.tb3-app * { box-sizing: border-box; }
.tb3-app {
	max-width: 1080px;
	margin: 0 auto;
	padding: 8px 0 48px;
}

/* -------------------------------------------------------------------------
 * 2. Hero / intestazione torneo
 * ---------------------------------------------------------------------- */
.tb3-hero {
	background: linear-gradient(135deg, var(--tb-navy) 0%, var(--tb-blue-dark) 100%);
	border-radius: var(--tb-radius);
	padding: 38px 34px;
	color: #fff;
	position: relative;
	overflow: hidden;
	box-shadow: var(--tb-shadow);
}
/* Pallone stilizzato sullo sfondo */
.tb3-hero::after {
	content: "";
	position: absolute;
	right: -60px;
	top: -60px;
	width: 220px;
	height: 220px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 35%, var(--tb-orange) 0%, var(--tb-orange-dark) 70%);
	opacity: 0.22;
}
.tb3-hero-badge {
	display: inline-block;
	background: var(--tb-orange);
	color: #fff;
	font-weight: 700;
	font-size: 0.78rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 5px 14px;
	border-radius: 999px;
	margin-bottom: 14px;
}
.tb3-hero-title {
	font-size: 2rem;
	font-weight: 800;
	margin: 0 0 6px;
	line-height: 1.15;
	color: #fff;
}
.tb3-hero-sub {
	margin: 0;
	font-size: 1.02rem;
	opacity: 0.92;
	max-width: 640px;
}

/* -------------------------------------------------------------------------
 * 3. Barra utente (topbar) - mostrata quando si e' autenticati
 * ---------------------------------------------------------------------- */
.tb3-topbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	background: var(--tb-card);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius);
	padding: 12px 18px;
	margin-top: 18px;
	box-shadow: var(--tb-shadow);
}
.tb3-topbar .tb3-user {
	font-weight: 600;
	color: var(--tb-navy);
}
.tb3-topbar .tb3-role {
	font-size: 0.78rem;
	background: var(--tb-bg);
	border: 1px solid var(--tb-border);
	color: var(--tb-muted);
	padding: 3px 10px;
	border-radius: 999px;
}
.tb3-topbar form { margin-left: auto; }

/* -------------------------------------------------------------------------
 * 4. Card generica
 * ---------------------------------------------------------------------- */
.tb3-card {
	background: var(--tb-card);
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius);
	padding: 26px;
	margin-top: 20px;
	box-shadow: var(--tb-shadow);
}

/* -------------------------------------------------------------------------
 * 5. Messaggi flash / alert
 * ---------------------------------------------------------------------- */
.tb3-alert {
	border-radius: 10px;
	padding: 13px 16px;
	margin-top: 18px;
	font-size: 0.96rem;
	border: 1px solid transparent;
	display: flex;
	gap: 9px;
	align-items: flex-start;
}
.tb3-alert.tb3-alert-success {
	background: #e7f6ec; border-color: #b6e2c3; color: #1c6b38;
}
.tb3-alert.tb3-alert-error {
	background: #fdecea; border-color: #f4c2bb; color: #b32b18;
}
.tb3-alert.tb3-alert-info {
	background: #e9f0fb; border-color: #c2d6f2; color: var(--tb-blue-dark);
}
.tb3-alert.tb3-alert-warning {
	background: #fff5e6; border-color: #f5d9a8; color: #9a6512;
}

/* -------------------------------------------------------------------------
 * 6. Area autenticazione (schede login)
 * ---------------------------------------------------------------------- */
.tb3-auth { margin-top: 22px; }

.tb3-tabs {
	border: none;
	gap: 6px;
	margin-bottom: 0;
}
.tb3-tabs .nav-link {
	border: 1px solid var(--tb-border);
	border-bottom: none;
	border-radius: 10px 10px 0 0;
	color: var(--tb-muted);
	font-weight: 600;
	background: var(--tb-bg);
	padding: 11px 18px;
}
.tb3-tabs .nav-link.active {
	color: #fff;
	background: var(--tb-navy);
	border-color: var(--tb-navy);
}
.tb3-tab-content {
	background: var(--tb-card);
	border: 1px solid var(--tb-border);
	border-radius: 0 var(--tb-radius) var(--tb-radius) var(--tb-radius);
	padding: 26px;
	box-shadow: var(--tb-shadow);
}
.tb3-tab-intro {
	color: var(--tb-muted);
	font-size: 0.95rem;
	margin-bottom: 18px;
}

/* -------------------------------------------------------------------------
 * 7. Form
 * ---------------------------------------------------------------------- */
.tb3-form .form-label {
	font-weight: 600;
	color: var(--tb-navy);
	margin-bottom: 4px;
	font-size: 0.93rem;
}
.tb3-form .form-control:focus,
.tb3-form .form-select:focus {
	border-color: var(--tb-blue);
	box-shadow: 0 0 0 0.2rem rgba(26, 79, 192, 0.15);
}
.tb3-req { color: var(--tb-orange); font-weight: 700; }

.tb3-section-title {
	color: var(--tb-navy);
	font-weight: 800;
	font-size: 1.35rem;
	margin: 4px 0 4px;
}

.tb3-group-title {
	color: var(--tb-navy);
	font-weight: 700;
	font-size: 1.05rem;
	margin: 22px 0 2px;
	display: flex;
	align-items: center;
	gap: 8px;
}
.tb3-group-hint {
	color: var(--tb-muted);
	font-size: 0.85rem;
	display: block;
	margin-bottom: 6px;
}

/* -------------------------------------------------------------------------
 * 8. Blocco giocatore
 * ---------------------------------------------------------------------- */
.tb3-player {
	border: 1px solid var(--tb-border);
	border-left: 5px solid var(--tb-blue);
	border-radius: 12px;
	padding: 18px 18px 6px;
	margin-top: 14px;
	background: #fbfcfe;
}
.tb3-player-reserve {
	border-left-color: var(--tb-orange);
	background: #fffaf5;
}
.tb3-player-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}
.tb3-player-num {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: var(--tb-blue);
	color: #fff;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
}
.tb3-player-reserve .tb3-player-num { background: var(--tb-orange); }
.tb3-player-role {
	font-weight: 700;
	color: var(--tb-navy);
}

/* -------------------------------------------------------------------------
 * 9. Informativa privacy
 * ---------------------------------------------------------------------- */
.tb3-privacy {
	background: var(--tb-bg);
	border: 1px dashed var(--tb-border);
	border-radius: 10px;
	padding: 14px 16px;
	margin-top: 22px;
	font-size: 0.88rem;
	color: var(--tb-muted);
}
.tb3-privacy a { color: var(--tb-blue); }

/* -------------------------------------------------------------------------
 * 10. Pulsanti
 * ---------------------------------------------------------------------- */
.tb3-btn-primary,
.tb3-btn-accent,
.tb3-btn-dark,
.tb3-btn-outline {
	font-weight: 700;
	border-radius: 10px;
	padding: 10px 22px;
	border: 2px solid transparent;
	transition: transform .06s ease, filter .15s ease;
}
.tb3-btn-primary:active,
.tb3-btn-accent:active,
.tb3-btn-dark:active,
.tb3-btn-outline:active { transform: translateY(1px); }

.tb3-btn-primary { background: var(--tb-blue); color: #fff; }
.tb3-btn-primary:hover { background: var(--tb-blue-dark); color: #fff; }

.tb3-btn-accent { background: var(--tb-orange); color: #fff; }
.tb3-btn-accent:hover { background: var(--tb-orange-dark); color: #fff; }

.tb3-btn-dark { background: var(--tb-navy); color: #fff; }
.tb3-btn-dark:hover { background: var(--tb-navy-dark); color: #fff; }

.tb3-btn-outline {
	background: transparent;
	color: var(--tb-blue);
	border-color: var(--tb-blue);
}
.tb3-btn-outline:hover { background: var(--tb-blue); color: #fff; }

/* -------------------------------------------------------------------------
 * 11. Stato vuoto
 * ---------------------------------------------------------------------- */
.tb3-empty {
	text-align: center;
	color: var(--tb-muted);
	padding: 34px 16px;
}
.tb3-empty i { font-size: 2.4rem; color: var(--tb-border); display: block; margin-bottom: 8px; }

/* -------------------------------------------------------------------------
 * 12. Statistiche (cruscotto admin)
 * ---------------------------------------------------------------------- */
.tb3-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	margin-top: 18px;
}
.tb3-stat {
	background: var(--tb-card);
	border: 1px solid var(--tb-border);
	border-top: 4px solid var(--tb-navy);
	border-radius: 12px;
	padding: 16px;
	text-align: center;
}
.tb3-stat-num {
	font-size: 1.9rem;
	font-weight: 800;
	color: var(--tb-navy);
	line-height: 1;
}
.tb3-stat-lbl {
	font-size: 0.82rem;
	color: var(--tb-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-top: 4px;
}
.tb3-stat-warn { border-top-color: #d99412; }
.tb3-stat-warn .tb3-stat-num { color: #d99412; }
.tb3-stat-ok { border-top-color: #1c6b38; }
.tb3-stat-ok .tb3-stat-num { color: #1c6b38; }
.tb3-stat-no { border-top-color: #b32b18; }
.tb3-stat-no .tb3-stat-num { color: #b32b18; }

/* -------------------------------------------------------------------------
 * 13. Toolbar (filtri / export)
 * ---------------------------------------------------------------------- */
.tb3-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-top: 20px;
	padding-bottom: 6px;
}
.tb3-toolbar form { display: inline-flex; gap: 8px; align-items: center; }
.tb3-toolbar .tb3-spacer { margin-left: auto; }

/* -------------------------------------------------------------------------
 * 14. Scheda squadra
 * ---------------------------------------------------------------------- */
.tb3-team {
	border: 1px solid var(--tb-border);
	border-radius: 12px;
	margin-top: 16px;
	overflow: hidden;
	background: var(--tb-card);
}
.tb3-team-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	background: var(--tb-navy);
	color: #fff;
}
.tb3-team-name {
	font-weight: 800;
	font-size: 1.1rem;
	margin: 0;
}
.tb3-team-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 18px;
	padding: 12px 18px;
	font-size: 0.9rem;
	color: var(--tb-muted);
	border-bottom: 1px solid var(--tb-border);
}
.tb3-team-meta strong { color: var(--tb-navy); }

/* Badge di stato (riusa colori semantici) */
.tb3-badge {
	font-size: 0.76rem;
	font-weight: 700;
	padding: 3px 11px;
	border-radius: 999px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.tb3-badge-in_attesa  { background: #fff5e6; color: #9a6512; }
.tb3-badge-confermata { background: #e7f6ec; color: #1c6b38; }
.tb3-badge-rifiutata  { background: #fdecea; color: #b32b18; }

/* Tabella giocatori */
.tb3-players-table { margin: 0; }
.tb3-players-table thead th {
	background: var(--tb-bg);
	color: var(--tb-navy);
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.tb3-players-table td { vertical-align: middle; font-size: 0.92rem; }

.tb3-team-note {
	padding: 10px 18px;
	background: #fffaf5;
	border-top: 1px solid var(--tb-border);
	font-size: 0.88rem;
	color: var(--tb-muted);
}
.tb3-team-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 12px 18px;
	border-top: 1px solid var(--tb-border);
	background: #fbfcfe;
}

/* -------------------------------------------------------------------------
 * 15. Validazione Bootstrap - rifinitura
 * ---------------------------------------------------------------------- */
.tb3-form .was-validated .form-control:invalid,
.tb3-form .form-control.is-invalid { border-color: #b32b18; }
.tb3-form .invalid-feedback { font-size: 0.84rem; }

/* -------------------------------------------------------------------------
 * 16. Responsive
 * ---------------------------------------------------------------------- */
@media (max-width: 860px) {
	.tb3-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
	.tb3-hero { padding: 28px 22px; }
	.tb3-hero-title { font-size: 1.55rem; }
	.tb3-card, .tb3-tab-content { padding: 18px; }
	.tb3-stats { grid-template-columns: 1fr 1fr; }
	.tb3-topbar form { margin-left: 0; width: 100%; }
	.tb3-team-meta { gap: 6px 12px; }
}

/* =========================================================================
 * 17. Estensioni v2.0.0 - Residenza, foto giocatore, password recovery
 *     Palette: navy #1E3A5F / blue #1a4fc0 / orange #FF4500 / arancio #ff4f00
 * ====================================================================== */

/* --- Categoria fissa (Open Maschile) - badge readonly ----------------- */
.tb3-cat-fixed {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	background: #fff3ec;
	border: 2px solid #ff4f00;
	border-radius: 8px;
	color: #1E3A5F;
	font-weight: 700;
	font-size: 0.95rem;
	letter-spacing: 0.3px;
}
.tb3-cat-fixed::before {
	content: "";
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #ff4f00;
	box-shadow: 0 0 0 3px rgba(255, 79, 0, 0.18);
}

/* --- Sotto-titoli dei gruppi (Residenza / Contatti / Documenti) ------- */
.tb3-subgroup-title {
	margin: 18px 0 10px;
	padding: 6px 0 6px 12px;
	border-left: 3px solid #1a4fc0;
	color: #1E3A5F;
	font-size: 0.95rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.tb3-subgroup-title .bi {
	color: #ff4f00;
	margin-right: 4px;
}

/* Il primo subgroup-title non deve spingere troppo in basso */
.tb3-player-card .tb3-subgroup-title:first-of-type {
	margin-top: 8px;
}

/* --- Thumbnail foto giocatore nelle tabelle squadra ------------------- */
.tb3-foto-thumb {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 50%;
	border: 2px solid #1E3A5F;
	background: #f3f6fb;
	display: block;
}
.tb3-foto-thumb:hover {
	border-color: #ff4f00;
	box-shadow: 0 0 0 3px rgba(255, 79, 0, 0.15);
	transition: all 0.2s ease;
}

/* Placeholder quando manca la foto (caso teorico, in v2.0 e' richiesta) */
.tb3-foto-placeholder {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: linear-gradient(135deg, #e9eef7 0%, #d6dfee 100%);
	border: 2px dashed #9aa8c0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #1E3A5F;
	font-size: 1.4rem;
}
.tb3-foto-placeholder .bi {
	opacity: 0.55;
}

/* --- Cella "Residenza & Contatti" nella tabella giocatori ------------- */
.tb3-cell-contacts {
	font-size: 0.85rem;
	line-height: 1.45;
	color: #3c4d6b;
}
.tb3-cell-contacts .tb3-contact-row {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin-bottom: 3px;
}
.tb3-cell-contacts .tb3-contact-row:last-child {
	margin-bottom: 0;
}
.tb3-cell-contacts .bi {
	color: #1a4fc0;
	flex-shrink: 0;
	margin-top: 2px;
}
.tb3-cell-contacts a {
	color: #1a4fc0;
	text-decoration: none;
	word-break: break-word;
}
.tb3-cell-contacts a:hover {
	color: #ff4f00;
	text-decoration: underline;
}

/* --- Link "Password dimenticata" sotto il login utente ---------------- */
.tb3-link-lost {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-top: 10px;
	font-size: 0.88rem;
	color: #1a4fc0;
	text-decoration: none;
	font-weight: 500;
	cursor: pointer;
	background: none;
	border: none;
	padding: 4px 0;
}
.tb3-link-lost:hover {
	color: #ff4f00;
	text-decoration: underline;
}
.tb3-link-lost .bi {
	font-size: 0.95rem;
}

/* --- Layout 2 colonne per certificato + foto nel form ----------------- */
.tb3-docs-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
}
@media (max-width: 700px) {
	.tb3-docs-row {
		grid-template-columns: 1fr;
		gap: 12px;
	}
}

/* --- Box informativo "anti-enumerazione" su lost password ------------- */
.tb3-info-neutral {
	padding: 14px 16px;
	background: #f1f5fc;
	border-left: 4px solid #1a4fc0;
	border-radius: 6px;
	color: #1E3A5F;
	font-size: 0.92rem;
	margin-bottom: 18px;
}
.tb3-info-neutral .bi {
	color: #1a4fc0;
	margin-right: 6px;
}

/* --- Hint testuale per campo CAP / Provincia / Telefono --------------- */
.tb3-pl-field.tb3-prov {
	text-transform: uppercase;
	letter-spacing: 2px;
	font-weight: 600;
}

/* --- Migliora leggibilita' tabella giocatori a 7 colonne -------------- */
.tb3-team-players table th,
.tb3-team-players table td {
	vertical-align: middle;
}
.tb3-team-players table th.tb3-th-foto,
.tb3-team-players table td.tb3-td-foto {
	width: 70px;
	text-align: center;
}
@media (max-width: 900px) {
	/* Su mobile, tabella giocatori scorre orizzontale */
	.tb3-team-players {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	.tb3-team-players table {
		min-width: 720px;
	}
}
