/*
 * Mobile layout for the ad detail page (view=showad).
 * Loaded only on that page (see index.php) and every rule is scoped to
 * body.view-showad inside a max-width media query, so desktop and other
 * pages are unaffected.
 */
@media (max-width: 767px) {

	/* ---------- page frame ---------- */
	body.view-showad {
		font-size: 15px;
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}
	body.view-showad #header_warp,
	body.view-showad #content_warp {
		width: auto;
		max-width: 100%;
		padding-bottom: 0;
	}
	/* the 980px layout table becomes a single column */
	body.view-showad #content_warp > table,
	body.view-showad #content_warp > table > tbody,
	body.view-showad #content_warp > table > tbody > tr,
	body.view-showad #content_warp > table > tbody > tr > td {
		display: block;
		width: auto !important;
	}
	body.view-showad #sidebar_left,
	body.view-showad #sidebar_right,
	body.view-showad #sidebar_right_cities {
		display: none !important;
	}
	body.view-showad #contentcell {
		border-left: 0;
		border-right: 0;
	}
	body.view-showad #contentcell > table,
	body.view-showad #contentcell > table > tbody,
	body.view-showad #contentcell > table > tbody > tr,
	body.view-showad #contentcell > table > tbody > tr > td {
		display: block;
		width: auto !important;
	}
	body.view-showad #content {
		padding: 10px 12px;
	}

	/* ---------- header ---------- */
	/* logo keeps its native size so it lines up with the header background */
	body.view-showad #city_name {
		max-width: calc(100% - 205px);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	body.view-showad #google-plus-1,
	body.view-showad #top_banner,
	body.view-showad #top_banner_info {
		display: none;
	}
	body.view-showad #language_bar {
		top: 0;
		right: 8px;
	}
	body.view-showad ul#simple-menu {
		height: auto;
		display: flex;
		flex-wrap: wrap;
	}
	body.view-showad ul#simple-menu li {
		margin-right: 2px;
	}
	body.view-showad ul#simple-menu li a {
		padding: 0 10px 0 11px;
		font-size: 13px;
	}

	/* breadcrumb */
	body.view-showad #path td {
		padding: 8px 12px;
		line-height: 1.5;
	}

	/* ---------- ad header ---------- */
	body.view-showad .alert-big {
		font-size: 16px;
		padding: 10px 8px;
		line-height: 1.4;
	}
	body.view-showad table.adheader,
	body.view-showad table.adheader > tbody,
	body.view-showad table.adheader > tbody > tr,
	body.view-showad table.adheader > tbody > tr > td {
		display: block;
		width: auto;
	}
	body.view-showad .adheader .adtitle {
		font-size: 19px;
		line-height: 1.35;
		padding-bottom: 6px;
		word-wrap: break-word;
		overflow-wrap: anywhere;
	}
	body.view-showad .ad_subtitle {
		float: none;
		margin-bottom: 6px;
	}
	body.view-showad .adheader div[align="right"] {
		clear: both;
		text-align: left;
		line-height: 1.8;
	}
	body.view-showad .adheader .absuse_icon,
	body.view-showad .adheader .email_to_frieend_icon {
		white-space: nowrap;
	}

	/* ---------- photo + details: stack vertically ---------- */
	body.view-showad table.admain,
	body.view-showad table.admain > tbody,
	body.view-showad table.admain > tbody > tr,
	body.view-showad table.admain > tbody > tr > td {
		display: block;
		width: auto !important;
	}
	body.view-showad table.admain {
		margin: 6px 0;
	}
	body.view-showad table.admain > tbody > tr > td:first-child {
		text-align: center;
		margin-bottom: 10px;
	}
	/* main photo: the full image (via <picture>) at full column width, real proportions */
	body.view-showad table.admain picture {
		display: block;
	}
	body.view-showad table.admain img.adpic {
		width: 100%;
		max-width: 640px;
		height: auto;
		aspect-ratio: auto;
		box-sizing: border-box;
	}
	/* details (price, fields, hits) */
	body.view-showad table.admain table td {
		padding: 3px 4px 3px 0;
		vertical-align: top;
		line-height: 1.45;
	}
	body.view-showad table.admain table td[nowrap] {
		white-space: normal;
		width: 42%;
	}
	body.view-showad table.admain .adprice {
		font-size: 17px;
	}
	body.view-showad table.admain iframe,
	body.view-showad table.admain .fb_iframe_widget,
	body.view-showad table.admain .fb_iframe_widget span {
		max-width: 100% !important;
	}

	/* thumbnails grid */
	body.view-showad div.admain_pic {
		display: flex;
		flex-wrap: wrap;
		gap: 6px;
	}
	body.view-showad div.admain_pic img.adpic {
		width: 72px;
		height: 72px;
		object-fit: cover;
	}

	/* ---------- description ---------- */
	body.view-showad .ad {
		line-height: 1.6;
		word-wrap: break-word;
		overflow-wrap: anywhere;
	}
	body.view-showad .ad img,
	body.view-showad .ad video,
	body.view-showad .ad iframe,
	body.view-showad .ad table {
		max-width: 100% !important;
		height: auto;
	}
	body.view-showad .ad iframe {
		aspect-ratio: 16 / 9;
		width: 100% !important;
		height: auto !important;
	}
	body.view-showad .ad pre {
		white-space: pre-wrap;
	}

	/* ---------- contact form ---------- */
	body.view-showad table.contactform,
	body.view-showad table.contactform > tbody,
	body.view-showad table.contactform > tbody > tr,
	body.view-showad table.contactform > tbody > tr > td {
		display: block;
		width: auto;
	}
	body.view-showad table.contactform input[type="text"],
	body.view-showad table.contactform input:not([type]),
	body.view-showad table.contactform textarea {
		width: 100%;
		box-sizing: border-box;
		font-size: 16px; /* prevents iOS zoom on focus */
	}

	/* ---------- ad slots: never widen the page ---------- */
	body.view-showad .ads-center,
	body.view-showad .ads-bottom-wrap {
		max-width: 100%;
		overflow: hidden;
		box-sizing: border-box;
	}
	body.view-showad .ads-center ins,
	body.view-showad .ads-bottom-wrap ins {
		max-width: 100%;
	}

	/* ---------- footer ---------- */
	body.view-showad #main {
		padding-bottom: 0;
	}
	body.view-showad #footer {
		margin-top: 0;
		height: auto;
	}
	body.view-showad #footer_inner {
		width: auto;
		height: auto;
		padding: 12px;
		line-height: 1.7;
	}
}
