/* Durak Social — responsive + RTL */

/* Prevent off-canvas theme chrome from expanding page scrollWidth on ≤320px. */
body.is-social-page {
	overflow-x: clip;
	max-width: 100%;
}

/* Keep focused event CTAs above the fixed bottom nav on mobile.
   --ds-bottom-h lives on .durak-social; viewport scroll uses 68px fallback. */
@media (max-width: 767px) {
	body.is-social-page,
	#durak-social-app.durak-social {
		scroll-padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px) + 0.75rem);
	}

	.ds-event-detail,
	.ds-event__rsvp,
	.ds-event-detail__actions,
	.ds-empty__actions,
	.ds-btn {
		scroll-margin-bottom: calc(68px + env(safe-area-inset-bottom, 0px) + 0.75rem);
	}
}

#durak-social-app.durak-social {
	overflow-x: clip;
	max-width: 100%;
}

.ds-bottomnav {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 45;
	display: none;
	align-items: center;
	justify-content: space-around;
	gap: 0.15rem;
	height: var(--ds-bottom-h);
	padding: 0.25rem 0.4rem calc(0.25rem + env(safe-area-inset-bottom, 0));
	background: rgba(253, 248, 242, 0.94);
	backdrop-filter: blur(12px);
	border-top: 1px solid var(--ds-border);
}

.ds-bottomnav__item {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--ds-muted);
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.1rem;
	min-width: 56px;
	min-height: 48px;
	padding: 0.25rem;
	font: inherit;
	font-size: 0.68rem;
	font-weight: 700;
	cursor: pointer;
}

.ds-bottomnav__item.is-current,
.ds-bottomnav__item[aria-current="page"] {
	color: var(--ds-orange-deep);
}

.ds-bottomnav__fab {
	appearance: none;
	border: 0;
	width: 3.1rem;
	height: 3.1rem;
	min-width: 48px;
	min-height: 48px;
	margin-top: -1.1rem;
	border-radius: 999px;
	background: var(--ds-orange);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 10px 20px rgba(249, 115, 22, 0.35);
	cursor: pointer;
}

/* Tablet: two columns */
@media (max-width: 1024px) {
	.ds-shell {
		grid-template-columns: 220px minmax(0, 1fr);
	}

	.ds-aside--presence {
		position: fixed;
		top: 0;
		inset-inline-end: 0;
		bottom: 0;
		width: min(320px, 88vw);
		z-index: 60;
		transform: translateX(110%);
		transition: transform 0.22s ease;
		border-inline: 0;
		border-inline-start: 1px solid var(--ds-border);
		box-shadow: var(--ds-shadow);
		overflow-y: auto;
		background: var(--ds-cream);
	}

	html[dir="rtl"] .ds-aside--presence {
		transform: translateX(-110%);
	}

	.ds-aside--presence.is-open {
		transform: translateX(0);
	}

	.ds-header {
		grid-template-columns: 1fr auto;
	}

	.ds-topnav {
		grid-column: 1 / -1;
		order: 3;
	}
}

/* Mobile app layout */
@media (max-width: 767px) {
	.durak-social {
		--ds-header-h: 56px;
		padding-bottom: calc(var(--ds-bottom-h) + env(safe-area-inset-bottom, 0px));
	}

	.ds-only-mobile {
		display: inline-flex;
	}

	.ds-shell {
		grid-template-columns: 1fr;
		min-height: calc(100vh - var(--ds-header-h) - var(--ds-bottom-h));
	}

	.ds-aside--rooms,
	.ds-aside--presence {
		position: fixed;
		top: 0;
		bottom: 0;
		width: min(340px, 90vw);
		z-index: 60;
		padding-top: 0.75rem;
		overflow-y: auto;
		background: var(--ds-cream);
		box-shadow: var(--ds-shadow);
		transition: transform 0.22s ease;
	}

	.ds-aside--rooms {
		inset-inline-start: 0;
		transform: translateX(-110%);
		border-inline-end: 1px solid var(--ds-border);
	}

	.ds-aside--presence {
		inset-inline-end: 0;
		transform: translateX(110%);
		border-inline-start: 1px solid var(--ds-border);
	}

	html[dir="rtl"] .ds-aside--rooms {
		transform: translateX(110%);
	}

	html[dir="rtl"] .ds-aside--presence {
		transform: translateX(-110%);
	}

	.ds-aside--rooms.is-open,
	.ds-aside--presence.is-open {
		transform: translateX(0);
	}

	.ds-header {
		grid-template-columns: 1fr auto;
		gap: 0.5rem;
		padding-inline: 0.75rem;
	}

	.ds-topnav {
		display: none;
	}

	.ds-brand__title {
		font-size: 1.15rem;
	}

	.ds-main {
		padding: 0.85rem 0.75rem 1rem;
	}

	.ds-pulse__title {
		font-size: 1.45rem;
	}

	.ds-pulse-rail {
		grid-auto-columns: minmax(148px, 168px);
	}

	.ds-camera {
		grid-template-columns: 1fr;
	}

	.ds-bottomnav {
		display: flex;
	}

	.ds-composer {
		bottom: calc(var(--ds-bottom-h) + env(safe-area-inset-bottom, 0px));
	}

	.ds-rooms-brand {
		display: none;
	}
}

@media (min-width: 1280px) {
	.ds-shell {
		grid-template-columns: 270px minmax(0, 1fr) 300px;
	}
}

@media (min-width: 1440px) {
	.ds-main {
		padding-inline: 1.5rem;
	}
}

@media (min-width: 1920px) {
	.ds-shell {
		max-width: 1720px;
	}
}

/* Small phones */
@media (max-width: 390px) {
	.ds-brand__subtitle {
		display: none;
	}

	.ds-header__actions .ds-icon-btn:nth-child(1),
	.ds-header__actions .ds-icon-btn:nth-child(2) {
		display: none;
	}
}

/* RTL refinements */
html[dir="rtl"] .ds-card__actions,
html[dir="rtl"] .ds-header__actions,
html[dir="rtl"] .ds-header__brand,
html[dir="rtl"] .ds-person,
html[dir="rtl"] .ds-chat-item,
html[dir="rtl"] .ds-event,
html[dir="rtl"] .ds-room {
	flex-direction: row;
}

html[dir="rtl"] .ds-poll__bar {
	inset: 0 0 0 auto;
}

[data-theme="dark"] .ds-bottomnav {
	background: rgba(26, 23, 20, 0.94);
}

@media (max-width: 768px) {
	.durak-social {
		min-height: 100dvh;
	}

	.ds-thread,
	.ds-dm-thread,
	[data-ds-thread] {
		max-height: calc(100dvh - var(--ds-header-h) - var(--ds-bottom-h));
	}

}

body.durak-social-panel-open {
	overflow: hidden;
}

/* Phase 2 dialogs / auth on small screens */
@media (max-width: 640px) {
	.ds-dialog,
	.ds-dialog--wide {
		width: 100vw;
		max-width: 100vw;
		height: 100vh;
		height: 100dvh;
		max-height: 100vh;
		max-height: 100dvh;
		border-radius: 0;
		margin: 0;
	}
	.ds-header__auth .ds-btn--ghost {
		/* Keep login reachable on narrow screens (was fully hidden). */
		padding-inline: 0.55rem;
		font-size: 0.85rem;
	}
	.ds-verify-banner {
		flex-direction: column;
		align-items: stretch;
	}
}

.ds-flash {
	margin: 0.5rem 1rem 0;
	padding: 0.75rem 1rem;
	border-radius: 10px;
	font-size: 0.92rem;
	line-height: 1.4;
}
.ds-flash--ok {
	background: color-mix(in srgb, #1f7a4d 12%, transparent);
	border: 1px solid color-mix(in srgb, #1f7a4d 35%, transparent);
}
.ds-flash--err {
	background: color-mix(in srgb, #b42318 10%, transparent);
	border: 1px solid color-mix(in srgb, #b42318 30%, transparent);
}
.ds-verify-banner__email,
.ds-composer__verify code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.9em;
}
.ds-composer__verify {
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
	align-items: flex-start;
	text-align: start;
}
.ds-verify-banner__feedback,
.ds-composer__verify-hint {
	margin: 0.35rem 0 0;
	font-size: 0.85rem;
}
.ds-verify-banner__feedback.is-error,
.ds-composer__verify-hint.is-error {
	color: #b42318;
}
.ds-rt-connection {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}
