/* YT Area Membri – area riservata. Si appoggia ai colori del tema con valori di riserva. */

.ytam-app, .ytam-login {
	--ytam-fg: var(--wp--preset--color--foreground, currentColor);
	--ytam-bg: var(--wp--preset--color--background, transparent);
	--ytam-card: var(--wp--preset--color--tertiary, rgba(127,127,127,.12));
	--ytam-accent: var(--wp--preset--color--primary, #c8553d);
	--ytam-line: color-mix(in srgb, currentColor 18%, transparent);
	--ytam-danger: #d64545;
	max-width: 1100px;
	margin: 0 auto;
	font-size: 15px;
}

.ytam-app *, .ytam-login * { box-sizing: border-box; }
.ytam-loading, .ytam-empty, .ytam-muted { opacity: .75; }
.ytam-error, .ytam-login-error { color: var(--ytam-danger); font-weight: 600; }

/* ---------- Login ---------- */
.ytam-login { max-width: 420px; padding: 32px; border-radius: 16px; background: var(--ytam-card); }
.ytam-login h2 { margin-top: 0; }
.ytam-login form p { margin: 0 0 14px; }
.ytam-login label { display: block; font-size: 13px; margin-bottom: 4px; }
.ytam-login input[type=text], .ytam-login input[type=password] { width: 100%; }
.ytam-login .login-remember label { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Controlli ---------- */
.ytam-app input[type=text], .ytam-app input[type=number], .ytam-app input[type=url], .ytam-app input[type=date],
.ytam-app input[type=time], .ytam-app select, .ytam-app textarea,
.ytam-login input[type=text], .ytam-login input[type=password] {
	font: inherit; color: inherit; background: color-mix(in srgb, currentColor 6%, transparent);
	border: 1px solid var(--ytam-line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
.ytam-app input:focus, .ytam-app select:focus, .ytam-app textarea:focus,
.ytam-login input:focus { outline: 2px solid var(--ytam-accent); outline-offset: 1px; }
.ytam-app select option { color: #222; }

.ytam-btn, .ytam-login input[type=submit] {
	font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none !important;
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 40px; padding: 8px 16px; border-radius: 999px;
	border: 1px solid var(--ytam-line); background: color-mix(in srgb, currentColor 8%, transparent); color: inherit;
	transition: background .15s, transform .1s;
}
.ytam-btn:hover { background: color-mix(in srgb, currentColor 16%, transparent); }
.ytam-btn:active { transform: translateY(1px); }
.ytam-btn:disabled { opacity: .55; cursor: progress; }
.ytam-btn--primary, .ytam-login input[type=submit] { background: var(--ytam-accent); border-color: var(--ytam-accent); color: #fff; }
.ytam-btn--primary:hover { background: color-mix(in srgb, var(--ytam-accent) 85%, #000); }
.ytam-btn--ghost { background: transparent; }
.ytam-btn--danger { color: var(--ytam-danger); border-color: color-mix(in srgb, var(--ytam-danger) 45%, transparent); background: transparent; }
.ytam-btn--danger:hover { background: color-mix(in srgb, var(--ytam-danger) 14%, transparent); }
.ytam-back { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; opacity: .8; padding: 4px 0; }
.ytam-back:hover { opacity: 1; text-decoration: underline; }

.ytam-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Intestazione e schede ---------- */
.ytam-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 20px; }
.ytam-head h2 { margin: 0; flex: 1 1 auto; font-size: clamp(22px, 3vw, 30px); }
.ytam-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ytam-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--ytam-line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.ytam-tab { white-space: nowrap; }

/* ---------- Scheda Gallerie ---------- */
.ytam-newgallery {
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
	padding: 18px 20px; border-radius: 14px; margin-bottom: 20px;
	border: 2px dashed var(--ytam-line);
}
.ytam-newgallery h3 { margin: 0 0 4px; font-size: 18px; }
.ytam-newgallery p { margin: 0; font-size: 13px; }
.ytam-newgallery__controls { display: flex; flex-wrap: wrap; gap: 8px; }
.ytam-newgallery__controls select { min-width: 260px; max-width: 100%; }
.ytam-gcards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ytam-gcard { border-radius: 14px; overflow: hidden; background: var(--ytam-card); display: flex; flex-direction: column; }
.ytam-gcard__img { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 0; cursor: pointer; background: color-mix(in srgb, currentColor 8%, transparent); overflow: hidden; }
.ytam-gcard__img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.ytam-gcard__img:hover img { transform: scale(1.04); }
.ytam-gcard__count { position: absolute; left: 10px; bottom: 10px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; background: rgba(0,0,0,.65); color: #fff; }
.ytam-gcard__body { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 0; }
.ytam-gcard__actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 14px; margin-top: auto; }
.ytam-tab { font: inherit; font-weight: 600; background: none; border: 0; color: inherit; padding: 10px 14px; cursor: pointer; opacity: .65; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.ytam-tab.is-active { opacity: 1; border-bottom-color: var(--ytam-accent); }

/* ---------- Elenco eventi ---------- */
.ytam-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ytam-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 16px; align-items: center; padding: 12px; border-radius: 14px; background: var(--ytam-card); }
.ytam-row__img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; display: block; }
.ytam-row__img--empty { display: flex; align-items: center; justify-content: center; border: 2px dashed var(--ytam-line); font-family: Georgia, serif; font-size: 26px; opacity: .6; }
.ytam-row__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ytam-row__title { font-size: 17px; }
.ytam-row__sub { font-size: 13px; opacity: .8; }
.ytam-row__actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ytam-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; margin-left: 8px; border-radius: 999px; background: color-mix(in srgb, currentColor 15%, transparent); vertical-align: middle; }
@media (max-width: 720px) {
	.ytam-row { grid-template-columns: 56px 1fr; }
	.ytam-row__img { width: 56px; height: 56px; }
	.ytam-row__actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- Modulo ---------- */
.ytam-form { display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: 16px; background: var(--ytam-card); }
.ytam-field { display: flex; flex-direction: column; gap: 6px; }
.ytam-field__label { font-size: 13px; font-weight: 600; }
.ytam-field small { font-size: 12px; opacity: .7; }
.ytam-grid2, .ytam-grid3 { display: grid; gap: 16px; }
.ytam-grid2 { grid-template-columns: 1fr 1fr; }
.ytam-grid3 { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 640px) { .ytam-grid2, .ytam-grid3 { grid-template-columns: 1fr; } }
.ytam-poster-preview { display: flex; align-items: center; gap: 14px; }
.ytam-poster-preview img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.ytam-form__actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; }

/* ---------- Caricamento ---------- */
.ytam-upload, .ytam-album { padding: 20px 24px; border-radius: 16px; background: var(--ytam-card); margin-bottom: 20px; }
.ytam-upload h3, .ytam-album h3 { margin: 0 0 12px; font-size: 20px; }
.ytam-fotografo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.ytam-fotografo select { min-width: 240px; }
.ytam-newfoto { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ytam-newfoto[hidden] { display: none; }
.ytam-ini { width: 90px; text-transform: uppercase; }
.ytam-drop {
	border: 2px dashed var(--ytam-line); border-radius: 14px; padding: 28px 16px;
	display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
	transition: border-color .15s, background .15s;
}
.ytam-drop p { margin: 0; }
.ytam-drop small { opacity: .7; max-width: 520px; }
.ytam-drop.is-over { border-color: var(--ytam-accent); background: color-mix(in srgb, var(--ytam-accent) 10%, transparent); }
.ytam-progress { margin-top: 14px; }
.ytam-progress[hidden] { display: none; }
.ytam-progress__bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, currentColor 12%, transparent); overflow: hidden; }
.ytam-progress__bar span { display: block; height: 100%; width: 0; background: var(--ytam-accent); transition: width .3s ease; }
.ytam-progress__text { margin: 8px 0 0; font-size: 14px; }
.ytam-progress__errors { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ytam-danger); }
.ytam-progress__errors li:first-child { list-style: none; margin-left: -18px; color: inherit; }

/* ---------- Album ---------- */
.ytam-album__head { display: flex; align-items: baseline; gap: 12px; }
.ytam-album > p { margin: 0 0 12px; font-size: 13px; }
.ytam-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ytam-photos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ytam-photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, currentColor 8%, transparent); cursor: grab; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .1s, opacity .1s; }
.ytam-photo img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ytam-photo.is-cover { outline-color: var(--ytam-accent); }
.ytam-photo.is-selected { outline-color: #4a90e2; }
.ytam-photo.is-dragging { opacity: .4; }
.ytam-photo.is-target { outline-color: #fff; outline-style: dashed; }
.ytam-photo__check { position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,.55); border-radius: 6px; padding: 4px; line-height: 0; }
.ytam-photo__check input { width: 18px; height: 18px; margin: 0; }
.ytam-photo__badge { position: absolute; top: 6px; right: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 7px; border-radius: 99px; background: var(--ytam-accent); color: #fff; }
.ytam-photo__tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; padding: 6px; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .15s; }
.ytam-photo:hover .ytam-photo__tools, .ytam-photo:focus-within .ytam-photo__tools { opacity: 1; }
@media (hover: none) { .ytam-photo__tools { opacity: 1; } }
.ytam-photo__tools button { width: 32px; height: 32px; border-radius: 99px; border: 0; background: rgba(255,255,255,.18); color: #fff; font-size: 15px; cursor: pointer; }
.ytam-photo__tools button:hover { background: rgba(255,255,255,.35); }
.ytam-photo__name { position: absolute; top: 34px; left: 6px; right: 6px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; opacity: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ytam-photo:hover .ytam-photo__name { opacity: .9; }
.ytam-photos .ytam-empty { grid-column: 1 / -1; aspect-ratio: auto; }

/* ---------- Barra salvataggio e notifiche ---------- */
.ytam-savebar {
	position: sticky; bottom: 16px; z-index: 50; margin-top: 16px;
	display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
	background: #1d1a17; color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.ytam-savebar[hidden] { display: none; }
.ytam-savebar span { flex: 1 1 auto; font-weight: 600; }
.ytam-toast {
	position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 100001;
	background: #1d1a17; color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px;
	box-shadow: 0 8px 30px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
}
.ytam-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.ytam-toast.is-error { background: #8f1f1f; }
