/*
 * Create-program form (rendered by [analingua_create]). Uses theme tokens.
 */

.anc {
	max-width: 900px;
	margin: 0 auto;
	padding: 32px var(--an-gutter, 18px) 48px;
}

.anc__title {
	font-family: var(--an-font-head);
	font-size: clamp(26px, 5vw, 36px);
	font-weight: 700;
	margin: 0 0 24px;
}

.anc-empty { color: var(--an-muted); font-size: 16px; }

.anc-field { display: block; margin-bottom: 16px; }
.anc-field__label { display: block; font-size: 13px; color: var(--an-muted); margin-bottom: 5px; }

.anc-form input[type="text"],
.anc-form textarea,
.anc-form select {
	width: 100%;
	font: inherit;
	padding: 9px 11px;
	border: 1px solid var(--an-border);
	border-radius: var(--an-radius-btn, 4px);
	background: var(--an-surface);
	color: var(--an-text);
}

.anc-form input:focus,
.anc-form textarea:focus,
.anc-form select:focus {
	outline: none;
	border-color: var(--an-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--an-primary) 22%, transparent);
}

.anc-form textarea { resize: vertical; }

.anc-meta {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	margin-bottom: 22px;
}

@media (min-width: 520px) {
	.anc-meta { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 860px) {
	.anc-meta { grid-template-columns: 1.6fr 0.8fr 1fr 1.4fr; }
}

.anc-items { counter-reset: anc; margin-bottom: 16px; }

/* Each word = a numbered two-row block, separated by a divider line. */
.anc-item {
	counter-increment: anc;
	display: grid;
	grid-template-columns: 36px 1fr;
	gap: 12px;
	align-items: stretch;
	padding: 16px 0;
	border-bottom: 1px solid var(--an-border);
}

.anc-item:first-child { padding-top: 0; }
.anc-item:last-child { border-bottom: none; padding-bottom: 0; }

/* Left rail: number opposite row 1, delete opposite row 2. */
.anc-item__side { display: flex; flex-direction: column; gap: 8px; align-items: center; }

.anc-item__num {
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--an-faint);
	font-weight: 700;
	font-size: 14px;
}

.anc-item__num::before { content: counter(anc) "."; }

.anc-item__del {
	width: 38px;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: none;
	border-radius: var(--an-radius-btn, 4px);
	color: var(--an-faint);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: color 0.12s ease, background 0.12s ease;
}

.anc-item__del:hover { color: #d33; background: rgba(210, 51, 51, 0.08); }

/* Two-row word card: foreign side on top, native (RU) side below. One flex
 * container; the full-width .anc-break forces the wrap. Field order is set per
 * word type so each line holds the right fields. */
.anc-fields { display: flex; flex-wrap: wrap; gap: 10px 12px; min-width: 0; align-items: flex-start; }
.anc-break { flex: 0 0 100%; height: 0; margin: 0; padding: 0; }

.anc-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 160px; }
/* Narrow fixed-width selects so the text fields get the room. */
.anc-f--artikel,
.anc-f--aux { flex: 0 0 96px; }
.anc-f--ex,
.anc-f--expl { flex: 1 1 220px; }
.anc-f__l { font-size: 12px; color: var(--an-muted); }
.anc-f__l--verb,
.anc-f__l--tr-ru { display: none; }

/* Order: word (+ plural) + translation on row 1; break; example + expl on row 2. */
.anc-f--artikel { order: 1; }
.anc-f--word    { order: 2; }
.anc-f--plural  { order: 3; display: none; flex: 0 0 96px; }
.anc-f--prat    { order: 4; }
.anc-f--aux     { order: 5; }
.anc-f--part    { order: 6; }
.anc-f--tr      { order: 7; }
.anc-f--truk    { order: 8; display: none; }
.anc-break      { order: 9; }
.anc-f--ex      { order: 10; }
.anc-f--expl    { order: 11; }

/* Plural-ending field: nouns only, right after the word. */
.anc-item[data-type="noun"] .anc-f--plural { display: flex; }

/* Verbs: the forms fill row 1, so translation(s) + example go on row 2. */
.anc-item[data-type="verb"] .anc-f--tr   { order: 10; flex: 1 1 220px; }
.anc-item[data-type="verb"] .anc-f--truk { order: 11; flex: 1 1 220px; }
.anc-item[data-type="verb"] .anc-f--ex   { order: 12; flex: 1 1 220px; }

/* Bilingual (shared) programs: show the Ukrainian translation + RU label. */
.anc--bi .anc-f--truk { display: flex; }
.anc--bi .anc-f__l--tr-mono { display: none; }
.anc--bi .anc-f__l--tr-ru { display: inline; }

/* Field visibility by word type */
.anc-item[data-type="noun"] .anc-f--prat,
.anc-item[data-type="noun"] .anc-f--aux,
.anc-item[data-type="noun"] .anc-f--part { display: none; }

.anc-item[data-type="verb"] .anc-f--artikel,
.anc-item[data-type="verb"] .anc-f--expl { display: none; }
.anc-item[data-type="verb"] .anc-f--word .anc-f__l--noun { display: none; }
.anc-item[data-type="verb"] .anc-f--word .anc-f__l--verb { display: inline; }

.anc-item:not([data-type="noun"]):not([data-type="verb"]) .anc-f--artikel,
.anc-item:not([data-type="noun"]):not([data-type="verb"]) .anc-f--prat,
.anc-item:not([data-type="noun"]):not([data-type="verb"]) .anc-f--aux,
.anc-item:not([data-type="noun"]):not([data-type="verb"]) .anc-f--part,
.anc-item:not([data-type="noun"]):not([data-type="verb"]) .anc-f--expl { display: none; }

/* Delete-whole-program button (edit mode only). */
.anc-delete {
	margin-left: auto;
	background: #e24b4a;
	border: 1px solid #c0392b;
	color: #fff;
	font: inherit;
	font-weight: 700;
	padding: 11px 22px;
	border-radius: var(--an-radius-btn, 4px);
	cursor: pointer;
}

.anc-delete:hover { background: #d33; }
.anc-delete[hidden] { display: none; }

.anc-add {
	background: none;
	border: 1px dashed var(--an-border);
	color: var(--an-primary-accent);
	font: inherit;
	font-weight: 600;
	padding: 9px 16px;
	border-radius: var(--an-radius-btn, 4px);
	cursor: pointer;
}

.anc-add:hover { border-color: var(--an-primary-accent); }

.anc-actions {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-top: 24px;
	flex-wrap: wrap;
}

.anc-submit {
	background: var(--an-primary);
	border: 1px solid var(--an-primary-border);
	color: var(--an-primary-ink);
	font: inherit;
	font-weight: 700;
	padding: 12px 28px;
	border-radius: var(--an-radius-btn, 4px);
	cursor: pointer;
}

.anc-submit:hover { background: var(--an-primary-hover); }
.anc-submit:disabled { opacity: 0.6; cursor: default; }

.anc-status { font-size: 14px; }
.anc-status--ok { color: var(--an-primary-accent); }
.anc-status--err { color: #d33; }
