/*
 * Shorts Sentences — Widget Styles
 * @package ElementorWidgets
 */

/* ============================================================
   Design tokens
   ============================================================ */
.ew-shorts-sentences {
	--ew-ss-red:        #BA412C;
	--ew-ss-ink:        #1a1008;
	--ew-ss-tip-bg:     #1a1008;
	--ew-ss-tip-border: rgba(186,65,44,0.35);
	--ew-ss-tip-cream:  #f5ede0;
	--ew-ss-tip-muted:  #c8b89a;
	--ew-ss-font-cn:    'Noto Serif SC','STSong','SimSun',Georgia,serif;
	--ew-ss-font-latin: 'Fira Sans',system-ui,sans-serif;
	--ew-ss-divider:    rgba(0,0,0,0.08);
}

/* ============================================================
   Widget max-width
   ============================================================  */
.ew-shorts-sentences {
	width: 100%; 
}

/* ============================================================
   Bar wrapper
   ============================================================ */
.ew-ss-bar-wrap {
	display: flex;
	justify-content: flex-start; /* overridden by Elementor bar_align control */
	margin-bottom: 28px;         /* overridden by Elementor */
}

/* ============================================================
   Bar
   ============================================================ */
.ew-ss-bar {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	justify-content: space-between;      /* overridden by Elementor items-distribution control */
	gap: 20px;                           /* overridden by Elementor */
	padding: 8px 20px;                   /* overridden by Elementor */
	border-radius: 999px;                /* overridden by Elementor */
	border: 1px solid rgba(0,0,0,0.08); /* overridden by Elementor */
	background: rgba(245,237,224,0.85); /* overridden by Elementor */
	box-shadow: 0 2px 8px rgba(0,0,0,0.06); /* overridden by Elementor */
	box-sizing: border-box;
}

/* ============================================================
   Separator
   ============================================================ */
.ew-ss-sep {
	display: block;
	width: 1px;
	height: 12px;
	background: rgba(0,0,0,0.12); /* overridden by Elementor */
	flex-shrink: 0;
	align-self: center;
}

/* ============================================================
   Toggle switch — W3Schools pattern, scoped to .ew-switch
   ============================================================ */

/* Label wrapper: flex so switch + text sit on one line */
.ew-sw {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	flex-shrink: 0;
}

/* The switch container (relative-positioned box) */
.ew-switch {
	position: relative;
	display: inline-block;
	width: 38px;
	height: 22px;
	flex-shrink: 0;
}

/* Hide the native checkbox — !important prevents theme overrides */
.ew-switch input[type="checkbox"] {
	opacity: 0   !important;
	width:   0   !important;
	height:  0   !important;
	position: absolute !important;
	margin:  0   !important;
	padding: 0   !important;
	border:  none !important;
}

/* The visual pill (slider) */
.ew-slider {
	position: absolute;
	cursor: pointer;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.18);
	-webkit-transition: background .3s;
	transition: background .3s;
}

/* The thumb */
.ew-slider:before {
	position: absolute;
	content: "";
	height: 16px;
	width:  16px;
	left:   3px;
	bottom: 3px;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.28);
	-webkit-transition: transform .3s;
	transition: transform .3s;
}

/* Checked → colour the pill */
.ew-switch input[type="checkbox"]:checked + .ew-slider {
	background: var(--ew-ss-red); /* overridden by Elementor */
}

/* Checked → slide the thumb */
.ew-switch input[type="checkbox"]:checked + .ew-slider:before {
	-webkit-transform: translateX(16px);
	-ms-transform:     translateX(16px);
	transform:         translateX(16px);
}

/* Round pill + round thumb */
.ew-round        { border-radius: 22px; }
.ew-round:before { border-radius: 50%; }

/* Label text */
.ew-sw-label {
	font-family: var(--ew-ss-font-latin);
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--ew-ss-ink); /* overridden by Elementor */
	white-space: nowrap;
}

/* ============================================================
   PDF button — reset theme button styles
   button.ew-ss-pdf-btn (0,1,1) beats theme [type=button] (0,1,0)
   ============================================================ */
button.ew-ss-pdf-btn,
button.ew-ss-pdf-btn:hover,
button.ew-ss-pdf-btn:focus,
button.ew-ss-pdf-btn:active {
	background: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
	padding: 0;
	outline: none;
	text-decoration: none;
	color: rgba(26,16,8,0.65); /* overridden by Elementor */
}

button.ew-ss-pdf-btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
	font-family: var(--ew-ss-font-latin);
	font-size: 0.875rem;
	font-weight: 500;
	white-space: nowrap;
	flex-shrink: 0;
	-webkit-appearance: none;
	appearance: none;
}

/* ============================================================
   Show / hide driven by JS
   ============================================================ */
.ew-shorts-sentences.ew-hide-pinyin     .ew-ss-pinyin      { display: none !important; }
.ew-shorts-sentences.ew-hide-translation .ew-ss-translation { display: none !important; }

/* ============================================================
   Sentence items
   ============================================================ */
.ew-ss-item {
	margin-bottom: 2rem;
	padding-bottom: 2rem;
	border-bottom: 1px solid var(--ew-ss-divider);
}
.ew-ss-item:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }

.ew-ss-chinese {
	font-family: var(--ew-ss-font-cn);
	font-size: 1.45rem;
	line-height: 2;
	margin: 0 0 0.4rem;
	color: var(--ew-ss-ink);
	word-break: keep-all;
}

.ew-ss-pinyin {
	font-family: var(--ew-ss-font-latin);
	font-size: 0.875rem;
	line-height: 1.6;
	color: #6b5e54;
	font-style: italic;
	margin: 0 0 0.2rem;
}

.ew-ss-translation {
	font-family: var(--ew-ss-font-latin);
	font-size: 0.9375rem;
	line-height: 1.6;
	color: #3d2c1e;
	margin: 0;
}

.ew-ss-empty { padding: 1.5rem; text-align: center; color: #999; font-style: italic; }

/* ============================================================
   Highlighted symbol
   ============================================================ */
.ew-cn-highlight {
	position: relative;
	display: inline;
	color: var(--ew-ss-red);
	cursor: help;
	outline: none;
	text-decoration: underline;
	text-decoration-style: dotted;
	text-decoration-color: var(--ew-ss-red);
	text-underline-offset: 4px;
}

.ew-cn-highlight::before {
	content: '';
	position: absolute;
	inset: -2px -3px;
	border-radius: 3px;
	background: rgba(186,65,44,0);
	transition: background 0.15s ease;
	pointer-events: none;
}
.ew-cn-highlight:hover::before,
.ew-cn-highlight:focus::before,
.ew-cn-highlight.ew-active::before { background: rgba(186,65,44,0.1); }

/* ============================================================
   Tooltip
   ============================================================ */
.ew-cn-tooltip {
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%) translateY(6px);
	background: var(--ew-ss-tip-bg);
	border: 1px solid var(--ew-ss-tip-border);
	border-radius: 6px;
	padding: 9px 13px 10px;
	min-width: 120px;
	max-width: 240px;
	white-space: nowrap;
	text-align: center;
	font-family: var(--ew-ss-font-latin);
	font-style: normal;
	font-size: 0.78rem;
	line-height: 1.5;
	color: var(--ew-ss-tip-cream);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease, transform 0.15s ease;
	z-index: 9999;
	box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.ew-cn-tooltip::after {
	content: '';
	position: absolute;
	top: 100%; left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: var(--ew-ss-tip-bg);
}
.ew-cn-highlight:hover   > .ew-cn-tooltip,
.ew-cn-highlight:focus   > .ew-cn-tooltip,
.ew-cn-highlight.ew-active > .ew-cn-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

.ew-cn-tip-sym { display: block; font-family: var(--ew-ss-font-cn); font-size: 1.25rem; line-height: 1.3; color: var(--ew-ss-red); margin-bottom: 3px; }
.ew-cn-tip-pin { display: block; font-style: italic; color: var(--ew-ss-tip-muted); font-size: 0.8rem; line-height: 1.4; }
.ew-cn-tip-def { display: block; color: var(--ew-ss-tip-cream); font-size: 0.78rem; margin-top: 3px; line-height: 1.4; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
	.ew-cn-tooltip { bottom: auto; top: calc(100% + 10px); transform: translateX(-50%) translateY(-6px); }
	.ew-cn-tooltip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ew-ss-tip-bg); }
	.ew-cn-highlight:hover > .ew-cn-tooltip,
	.ew-cn-highlight:focus > .ew-cn-tooltip,
	.ew-cn-highlight.ew-active > .ew-cn-tooltip { transform: translateX(-50%) translateY(0); }
}
