/**!
 * @file ViewFlashCards.css
 * @desc Modern shell for esl_viewFlashCards.php (the take-a-flashcard-quiz
 *       page). Layout: 2-column at desktop (article + sidebar). Article
 *       holds the hero (eyebrow, deck/lesson title, counter), the 3D flip
 *       card, the listen + navigation controls, the optional add-to-deck
 *       selector, the front-side switcher, and the details panel (English
 *       definition + word examples revealed when the card is flipped).
 *
 *       Sidebar uses the shared .ll-panel component.
 *
 *       Preserves legacy IDs and classes the JS depends on:
 *         #flipCard, #parafront, #paraback, #wordcounter,
 *         #flashcard, #frstCard, #prevCard, #nextCard, #lastCard,
 *         #deck, #engdef, #vocabexamples, #defandexamples,
 *         #ERRORPANEL, #switcher, .swcard, .front, .back, .testselect2
 *
 *       Scoped under body.view-flashcards so nothing leaks.
 */
/************************************************************************************************************************************/

body.view-flashcards {
	--fc-brand:      var(--sw-brand-color, #0e6630);
	--fc-brand-dark: #084a22;
	--fc-brand-soft: #e8f3ec;
	--fc-brand-tint: #f4f9f5;
	--fc-ink:        #14211a;
	--fc-ink-soft:   #4a5b51;
	--fc-card:       #ffffff;
	--fc-border:     #e0e8e3;
	--fc-radius:     14px;
	--fc-radius-sm:  10px;
	--fc-max-width:  1180px;
	--fc-shadow:     0 1px 2px rgba(20, 50, 30, 0.04),
	                 0 8px 28px rgba(20, 50, 30, 0.08);

	background-color: var(--fc-brand-tint) !important;
}

/* ------------------------------------------------------------------ */
/* PAGE + GRID                                                         */
/* ------------------------------------------------------------------ */

body.view-flashcards .fc-page {
	max-width: var(--fc-max-width);
	margin: 0 auto;
	padding: 18px 16px 32px 16px;
}

body.view-flashcards .fc-content {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 24px;
	align-items: start;
}

/* ------------------------------------------------------------------ */
/* MAIN ARTICLE CARD                                                   */
/* ------------------------------------------------------------------ */

body.view-flashcards .fc-article {
	background: var(--fc-card);
	border-radius: var(--fc-radius);
	box-shadow: var(--fc-shadow);
	overflow: hidden;
	min-width: 0;
}

/* --- Hero --- */

body.view-flashcards .fc-hero {
	padding: 24px 32px 22px 32px;
	background: linear-gradient(180deg, var(--fc-brand-tint) 0%, var(--fc-card) 100%);
	border-bottom: 1px solid var(--fc-border);
	display: flex;
	align-items: center;
	gap: 16px;
}

body.view-flashcards .fc-hero__left {
	flex: 1;
	min-width: 0;
}

body.view-flashcards .fc-hero__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--fc-brand-dark);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--fc-brand-soft);
	margin-bottom: 10px;
}

body.view-flashcards .fc-hero__title {
	font-size: clamp(1.25rem, 1.8vw, 1.55rem);
	font-weight: 800;
	margin: 0;
	color: var(--fc-ink);
	line-height: 1.25;
	word-break: break-word;
}

body.view-flashcards .fc-hero__title a {
	color: var(--fc-ink);
	text-decoration: none;
}

body.view-flashcards .fc-hero__title a:hover {
	color: var(--fc-brand-dark);
}

body.view-flashcards .fc-hero__counter {
	flex-shrink: 0;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--fc-brand-dark);
	background: var(--fc-card);
	padding: 6px 14px;
	border: 1px solid var(--fc-border);
	border-radius: 999px;
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* BODY (card + controls + details)                                    */
/* ------------------------------------------------------------------ */

body.view-flashcards .fc-body {
	padding: 30px 32px 32px 32px;
}

/* ------------------------------------------------------------------ */
/* 3D FLIP CARD                                                        */
/* ------------------------------------------------------------------ */

body.view-flashcards .container_fcd,
body.view-flashcards .fc-card-stage {
	max-width: 540px;
	margin: 0 auto;
	perspective: 1200px;
	border: none;
	background: transparent;
	width: 100%;
	height: auto;
}

/* Override legacy fixed-height container — we use aspect ratio so the
   card scales with viewport. */
body.view-flashcards .container_fcd {
	height: auto;
	display: block;
	position: relative;
}

body.view-flashcards .swcard {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	transform-style: preserve-3d;
	transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
	cursor: pointer;
}

body.view-flashcards .swcard.flipped {
	transform: rotateY(180deg);
}

body.view-flashcards .swcard .front,
body.view-flashcards .swcard .back {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 36px 32px 48px 32px;
	border-radius: var(--fc-radius);
	text-align: center;
	box-shadow: 0 8px 24px rgba(20, 50, 30, 0.15),
	            0 2px 6px rgba(20, 50, 30, 0.08);
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	width: 100%;
	height: 100%;
}

body.view-flashcards .swcard .front {
	background: linear-gradient(135deg, var(--fc-brand) 0%, var(--fc-brand-dark) 100%);
	color: #fff;
}

body.view-flashcards .swcard .back {
	background: linear-gradient(135deg, var(--fc-brand-soft) 0%, var(--fc-card) 100%);
	color: var(--fc-ink);
	border: 1px solid var(--fc-border);
	transform: rotateY(180deg);
}

/* Word text — front. !important overrides padding-top set by padWord() JS,
   so flex centering wins regardless of word length. */
body.view-flashcards .parafront {
	font-size: clamp(1.8rem, 4.5vw, 3rem);
	font-weight: 800;
	color: #fff;
	margin: 0 !important;
	padding: 0 !important;
	line-height: 1.2;
	word-break: break-word;
	letter-spacing: -0.01em;
}

/* Word text — back. */
body.view-flashcards .paraback {
	font-size: clamp(1.5rem, 4vw, 2.5rem);
	font-weight: 700;
	color: var(--fc-brand-dark);
	margin: 0 !important;
	padding: 0 !important;
	line-height: 1.3;
	word-break: break-word;
}

/* The JS inlines a smaller-text div inside paraback for the definition. */
body.view-flashcards .paraback > div {
	font-size: 0.95rem !important;
	font-weight: 500;
	color: var(--fc-ink-soft);
	margin-top: 12px !important;
	max-width: 92%;
	line-height: 1.5;
}

/* "Click to see the answer" hint at the bottom of the front side. */
body.view-flashcards .bottomclick {
	position: absolute;
	bottom: 14px;
	left: 0;
	right: 0;
	font-size: 0.78rem !important;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.85);
	letter-spacing: 0.04em;
	pointer-events: none;
	width: 100%;
	text-align: center;
}

/* ------------------------------------------------------------------ */
/* SPEAKER + NAVIGATION CONTROLS                                       */
/* ------------------------------------------------------------------ */

body.view-flashcards .speaker_outer,
body.view-flashcards .fc-listen-row {
	margin-top: 22px;
	display: flex;
	justify-content: center;
	background: transparent;
	padding: 0;
}

body.view-flashcards .speaker_outer button,
body.view-flashcards .fc-listen-btn {
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: var(--fc-brand);
	color: #fff;
	border: none;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.15rem;
	box-shadow: 0 4px 14px rgba(20, 50, 30, 0.15);
	transition: background 0.12s ease, transform 0.12s ease;
}

body.view-flashcards .speaker_outer button:hover,
body.view-flashcards .fc-listen-btn:hover {
	background: var(--fc-brand-dark);
	transform: scale(1.06);
}

body.view-flashcards .speaker_outer img {
	display: none; /* hide legacy speaker.png — we render an FA icon instead */
}

/* Hide native audio element wherever it sits. */
body.view-flashcards audio {
	display: none;
}

/* Navigation buttons */

body.view-flashcards .action_outer {
	margin-top: 20px;
	padding: 0;
	background: transparent;
}

body.view-flashcards .NavFlashCard {
	display: flex;
	justify-content: center;
	gap: 8px;
	padding: 0;
	background: transparent;
	margin: 0 0 12px 0;
}

body.view-flashcards button.flashcard {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	padding: 0;
	background: var(--fc-card);
	color: var(--fc-brand-dark);
	border: 1px solid var(--fc-border);
	border-radius: 50%;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
	position: relative;
	transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
	box-shadow: 0 1px 2px rgba(20, 50, 30, 0.04);
}

body.view-flashcards button.flashcard:hover {
	background: var(--fc-brand-soft);
	border-color: var(--fc-brand);
	color: var(--fc-brand-dark);
}

body.view-flashcards button.flashcard img {
	display: none; /* hide legacy nav GIFs — FA icons inline in the markup */
}

/* Tooltip on hover */

body.view-flashcards button.flashcard .tooltiptext {
	visibility: hidden;
	opacity: 0;
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: var(--fc-ink);
	color: #fff;
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 0.75rem;
	font-weight: 500;
	white-space: nowrap;
	pointer-events: none;
	transition: opacity 0.15s ease;
	z-index: 10;
}

body.view-flashcards button.flashcard:hover .tooltiptext {
	visibility: visible;
	opacity: 1;
}

/* ------------------------------------------------------------------ */
/* DECK SELECTOR (SumoSelect)                                          */
/* ------------------------------------------------------------------ */

body.view-flashcards .fc-deck-selector {
	max-width: 540px;
	margin: 8px auto 0 auto;
}

body.view-flashcards .SumoSelect {
	width: 100% !important;
	margin: 0 !important;
}

body.view-flashcards .SumoSelect > .CaptionCont {
	border: 1px solid var(--fc-border) !important;
	border-radius: 8px !important;
	background: var(--fc-card) !important;
	color: var(--fc-ink) !important;
	padding: 6px 12px !important;
}

/* ------------------------------------------------------------------ */
/* SWITCH SIDE BUTTON                                                  */
/* ------------------------------------------------------------------ */

body.view-flashcards #switcher {
	text-align: center;
	margin: 16px 0 0 0;
}

body.view-flashcards #switcher button,
body.view-flashcards .fc-switcher-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	background: transparent;
	color: var(--fc-brand-dark);
	border: 1px solid var(--fc-border);
	border-radius: 999px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 600;
	transition: background 0.12s ease, border-color 0.12s ease;
	font-family: inherit;
}

body.view-flashcards #switcher button:hover,
body.view-flashcards .fc-switcher-btn:hover {
	background: var(--fc-brand-soft);
	border-color: var(--fc-brand);
}

/* ------------------------------------------------------------------ */
/* DETAILS PANEL — definition + examples after flip                    */
/* ------------------------------------------------------------------ */

body.view-flashcards #defandexamples {
	margin-top: 26px;
	padding: 22px 24px;
	background: var(--fc-brand-tint);
	border: 1px solid var(--fc-border);
	border-radius: var(--fc-radius-sm);
	text-align: left;
}

body.view-flashcards .engdef_outer {
	font-size: 1rem;
	text-align: left;
	padding-bottom: 16px;
	border-bottom: 1px dashed var(--fc-border);
}

body.view-flashcards .engdef_inner {
	display: block;
	margin: 0;
	line-height: 1.55;
	color: var(--fc-ink);
}

body.view-flashcards .vocabwordexamples_outer {
	margin-top: 16px;
	font-size: 0.95rem;
	text-align: left;
}

body.view-flashcards .vocabwordexamples_inner {
	display: block;
	line-height: 1.6;
	color: var(--fc-ink);
}

body.view-flashcards #defandexamples hr {
	display: none; /* legacy markup uses an hr — we use a border instead */
}

/* Error panel */
body.view-flashcards #ERRORPANEL {
	margin-top: 12px;
}

body.view-flashcards #ERRORPANEL p {
	color: #c63838 !important;
	font-weight: 600;
	background: #fbe8e8;
	border: 1px solid #c63838;
	padding: 10px 14px;
	border-radius: var(--fc-radius-sm);
}

/* ------------------------------------------------------------------ */
/* NO-CARDS EMPTY STATE                                                */
/* ------------------------------------------------------------------ */

body.view-flashcards .fc-empty {
	padding: 38px 24px;
	text-align: center;
	background: var(--fc-brand-tint);
	border: 1px dashed var(--fc-border);
	border-radius: var(--fc-radius-sm);
	color: var(--fc-ink-soft);
	font-size: 1rem;
	margin: 0 auto;
	max-width: 540px;
}

body.view-flashcards .fc-empty i {
	display: block;
	font-size: 2rem;
	color: var(--fc-brand);
	margin-bottom: 12px;
}

/* ------------------------------------------------------------------ */
/* SIDEBAR                                                             */
/* ------------------------------------------------------------------ */

body.view-flashcards .fc-sidebar {
	display: block;
}

/* ------------------------------------------------------------------ */
/* RESPONSIVE                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
	body.view-flashcards .fc-content {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 720px) {
	body.view-flashcards .fc-hero {
		padding: 20px 22px 18px 22px;
		flex-direction: column;
		align-items: flex-start;
	}
	body.view-flashcards .fc-body {
		padding: 24px 22px 26px 22px;
	}
	body.view-flashcards .swcard {
		aspect-ratio: 4 / 3;
	}
	body.view-flashcards .swcard .front,
	body.view-flashcards .swcard .back {
		padding: 28px 24px 40px 24px;
	}
	body.view-flashcards #defandexamples {
		padding: 18px 18px;
	}
}
