/**
 * TurfNet Ad Manager — Frontend Styles
 *
 * @package TurfNet_Ad_Manager
 * @since   1.11.0
 */

.turfnet-ad-image {
	max-width: 100%;
	height: auto;
}

.turfnet-ad-title {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #999;
	margin-bottom: 4px;
	line-height: 1.2;
}

.turfnet-ad-description {
	font-size: 10px;
	color: #aaa;
	margin-top: 6px;
	line-height: 1.4;
	text-align: center;
}

/* ---------------------------------------------------------------------------
 * Sidebar Ad Cards
 *
 * Match the theme's .sidebar .widget card styling so sidebar ads look like
 * native widget cards. Targets any wrapper whose class contains
 * "sidebar-shortcode" (e.g. news-sidebar-shortcode, podcast-sidebar-shortcode).
 * Non-sidebar positions (archive-top, content-bottom, etc.) are unaffected.
 * --------------------------------------------------------------------------- */
[class*="sidebar-shortcode"] {
	background: #fff;
	border: 1px solid #f5f5f5;
	border-radius: 12px;
	box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.04);
	padding: 16px;
	margin: 6px 0 25px 0;
	overflow: hidden;
	text-align: center;
}

/* Title bar — matches .sidebar .widget-title header style */
[class*="sidebar-shortcode"] > .turfnet-ad-title {
	font-size: 15px;
	font-weight: 400;
	color: #111827;
	text-transform: none;
	letter-spacing: normal;
	background: #f9fafb;
	border-bottom: 1px solid #e9e9e9;
	margin: -16px -16px 16px -16px;
	padding: 14px 14px 14px 20px;
	line-height: 1.4;
}

/* Description bar — footer treatment matching widget-title header style */
[class*="sidebar-shortcode"] > .turfnet-ad-description {
    font-size: 15px;
    color: #353c41;
    text-align: left;
    background: #f9fafb;
    border-top: 1px solid #e9e9e9;
    margin: 16px -16px -16px -16px;
    padding: 10px 14px 10px 20px;
    line-height: 1.5;
}

/* First sidebar ad card — align with content top edge.
 * The theme sets .content margin-top per context but not .sidebar.
 * Mirror those values on the first ad card so they start at the same line. */
[class*="sidebar-shortcode"]:first-child {
	margin-top: 0;
}

.full-width-content.single .sidebar [class*="sidebar-shortcode"]:first-child {
	margin-top: 45px;
}

/* Ad content — constrain width and center */
[class*="sidebar-shortcode"] img {
	max-width: 100%;
	height: auto;
}

/* ---------------------------------------------------------------------------
 * Top & Bottom Banner Ad Cards
 *
 * Content-area ads above and below the main content. Uses the same card
 * treatment as sidebar ads but full-width within the content column.
 * Selector excludes sidebar positions (which already have their own styles)
 * via :not([class*="sidebar"]).
 *
 * Wrapper classes:  {type}-archive-top-shortcode, {type}-single-top-shortcode,
 *   {type}-page-top-shortcode, {type}-archive-bottom-shortcode(-2),
 *   {type}-single-bottom-shortcode(-2), {type}-page-bottom-shortcode(-2),
 *   directorist-custom-section(-top|-2)
 * --------------------------------------------------------------------------- */
[class*="-top-shortcode"]:not([class*="sidebar"]),
[class*="-bottom-shortcode"],
[class*="directorist-custom-section"] {
	background: #fff;
	border: 1px solid #f5f5f5;
	border-radius: 12px;
	box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.04);
	padding: 16px;
	margin: 20px 0;
	overflow: hidden;
	text-align: center;
}

[class*="-top-shortcode"]:not([class*="sidebar"]) {
	margin: 0 0 20px;
}


/* Title bar — same widget-title header style as sidebar cards */
[class*="-top-shortcode"]:not([class*="sidebar"]) > .turfnet-ad-title,
[class*="-bottom-shortcode"] > .turfnet-ad-title,
[class*="directorist-custom-section"] > .turfnet-ad-title {
	font-size: 15px;
	font-weight: 400;
	color: #111827;
	text-transform: none;
	letter-spacing: normal;
	background: #f9fafb;
	border-bottom: 1px solid #e9e9e9;
	margin: -16px -16px 16px -16px;
	padding: 14px 14px 14px 20px;
	line-height: 1.4;
}

/* Description bar — footer treatment for banner/bottom cards */
[class*="-top-shortcode"]:not([class*="sidebar"]) > .turfnet-ad-description,
[class*="-bottom-shortcode"] > .turfnet-ad-description,
[class*="directorist-custom-section"] > .turfnet-ad-description {
	font-size: 11px;
	color: #6b7280;
	background: #f9fafb;
	border-top: 1px solid #e9e9e9;
	margin: 16px -16px -16px -16px;
	padding: 10px 14px 10px 20px;
	text-align: left;
}

/* Constrain ad images within banner cards */
[class*="-top-shortcode"]:not([class*="sidebar"]) img,
[class*="-bottom-shortcode"] img,
[class*="directorist-custom-section"] img {
	max-width: 100%;
	height: auto;
}

/* ---------------------------------------------------------------------------
 * Grouped Ad Cards
 *
 * When consecutive ads share a position group (Sidebar 1-3, Bottom 1-2,
 * Directorist listing sections), merge them into a single visual card
 * with subtle separator lines between each ad. Uses :has(+) to detect
 * the first card in a run and + to detect subsequent cards.
 * --------------------------------------------------------------------------- */

/* Card followed by a sibling in the same group — open bottom edge */
[class*="sidebar-shortcode"]:has(+ [class*="sidebar-shortcode"]),
[class*="-bottom-shortcode"]:has(+ [class*="-bottom-shortcode"]),
[class*="directorist-custom-section"]:has(+ [class*="directorist-custom-section"]) {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	margin-bottom: 0;
	border-bottom: none;
}

/* Card preceded by a sibling in the same group — open top edge, add separator */
[class*="sidebar-shortcode"] + [class*="sidebar-shortcode"],
[class*="-bottom-shortcode"] + [class*="-bottom-shortcode"],
[class*="directorist-custom-section"] + [class*="directorist-custom-section"] {
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	margin-top: 0;
	border-top-color: #e9e9e9;
	box-shadow: none;
}
