:root {
    --atd-sys-page-bg: #F8F9FA; /* Off-white page background */
    --atd-sys-bg: #FFFFFF;      /* White card background */
    --atd-sys-text: #202124;
    --atd-sys-heading: #1A1F36;
    --atd-sys-primary: #1A73E8;
    --atd-sys-white: #FFFFFF;
    --atd-sys-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --atd-sys-max-w: 900px;
    --atd-sys-radius: 12px;
    --atd-sys-space: 40px;
    --atd-sys-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.02);
    --atd-sys-border: 1px solid #EAECEF;
}

/* Global Page Background for Tools */
body.single-tools, 
body.post-type-archive-tools, 
body.tax-tool-category {
    background-color: var(--atd-sys-page-bg) !important;
}

.wp-ai-tools-wrapper {
    font-family: var(--atd-sys-font);
    color: var(--atd-sys-text);
    line-height: 1.6;
    max-width: var(--atd-sys-max-w);
    margin: 40px auto;
    padding: 0 20px; /* Padding for the container itself on mobile */
    background: transparent; /* Wrapper is now transparent */
    -webkit-font-smoothing: antialiased;
}

/* Section Box Styling (The 'Card' look) */
.atd-main-header-box,
.atd-section {
    background: var(--atd-sys-bg);
    border-radius: var(--atd-sys-radius);
    border: var(--atd-sys-border);
    box-shadow: var(--atd-sys-shadow);
    padding: var(--atd-sys-space);
    margin-bottom: 24px; /* Gap between boxes */
}

/* Header & Intro inside the same box */
.atd-tool-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.atd-intro-text {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    margin-bottom: 0;
}

/* CTA containers should be centered and less bulky */
.atd-cta-container {
    text-align: center;
    margin-bottom: 32px;
}

.wp-ai-tools-wrapper h1, 
.wp-ai-tools-wrapper h2, 
.wp-ai-tools-wrapper h3 {
    color: var(--atd-sys-heading);
    margin-top: 0;
    margin-bottom: 0.5em;
    letter-spacing: -0.02em;
}

.wp-ai-tools-wrapper h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; }
.wp-ai-tools-wrapper h2 { 
    font-size: 1.6rem; 
    border-bottom: 1px solid #f1f3f4; 
    padding-bottom: 12px; 
    margin-bottom: 24px;
}
.atd-tool-header.centered {
    flex-direction: column;
    justify-content: center;
    text-align: center;
}
.atd-logo-wrapper {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}
.atd-tool-logo {
    max-width: 100%;
    height: auto;
    width: 64px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* CTA Button (Upgraded Design) */
.dynamic-tool-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--atd-sys-primary) 0%, #1557B0 100%);
    color: var(--atd-sys-white) !important;
    padding: 16px 36px;
    border-radius: 8px; /* Refined radius for better consistency with boxes */
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(26, 115, 232, 0.3);
    border: none;
    cursor: pointer;
}

.dynamic-tool-cta:hover,
.dynamic-tool-cta:focus {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(26, 115, 232, 0.4);
    background: linear-gradient(135deg, #1C7BFF 0%, #175FC4 100%);
    opacity: 1;
    outline: none;
}

.atd-btn-icon {
    flex-shrink: 0;
    stroke-width: 2.5px;
}

/* Pros and Limitations Grid */
.atd-pros-cons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 48px 0;
}

.atd-list-wrapper ul,
.atd-list-wrapper ol {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.atd-list-wrapper li {
    list-style: none !important;
    list-style-type: none !important;
    background-image: none !important;
    position: relative;
    padding-left: 32px !important;
    margin: 0 0 14px 0 !important;
    font-size: 0.95rem;
}

.atd-pros-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2334A853' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.atd-cons-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23EA4335' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* FAQ Accordion */
.atd-faq-section details {
    border-bottom: 1px solid #f1f3f4;
    padding: 20px 0;
}

/* Responsive Video (16:9) */
.atd-video-container {
    position: relative;
    padding-bottom: 56.25%; /* Aspect Ratio 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.atd-video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.atd-faq-section summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 32px;
    font-size: 1.1rem;
    outline: none;
}
.atd-faq-section summary::-webkit-details-marker {
    display: none;
}
.atd-faq-section summary::after {
    content: "+";
    position: absolute;
    right: 0;
    font-size: 1.4rem;
    color: var(--atd-sys-primary);
    line-height: 1;
    transition: transform 0.2s ease;
}
.atd-faq-section details[open] summary::after {
    content: "+";
    transform: rotate(45deg);
    color: var(--atd-sys-heading);
}
.atd-faq-content {
    padding-top: 16px;
    color: #5f6368;
    font-size: 1rem;
}

/* Mobile Sticky CTA */
.atd-mobile-sticky-cta {
    display: none;
}

@media (max-width: 768px) {
    .wp-ai-tools-wrapper {
        margin: 15px 10px; /* Slightly tighter margins for mobile */
        padding: 0;        /* Wrapper padding not needed for section-by-section */
    }

    .atd-main-header-box,
    .atd-section,
    .atd-archive-header,
    .atd-tool-card {
        padding: 20px;     /* Uniform padding inside all boxed sections */
        margin-bottom: 16px; /* Tighter gaps on mobile */
    }

    .atd-tool-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }

    .atd-pros-cons-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .atd-mobile-sticky-cta {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--atd-sys-white);
        padding: 12px 20px;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
        display: flex;
        justify-content: center;
        z-index: 9999;
        border-top: 1px solid #f1f3f4;
    }
    
    .atd-hide-on-mobile {
        display: none !important;
    }

    .atd-mobile-sticky-cta .dynamic-tool-cta {
        margin: 0;
        width: 100%;
        padding: 16px;
    }
    
    body {
        padding-bottom: 90px;
    }
}

/* Archive Grid Styles */
.atd-archive-header {
    background: var(--atd-sys-bg);
    border-radius: var(--atd-sys-radius);
    border: var(--atd-sys-border);
    box-shadow: var(--atd-sys-shadow);
    padding: var(--atd-sys-space);
    margin-bottom: 40px;
    text-align: center;
}
.atd-tools-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 24px;
}
.atd-tool-card {
	background: var(--atd-sys-bg);
	border-radius: var(--atd-sys-radius);
	border: var(--atd-sys-border);
	box-shadow: var(--atd-sys-shadow);
	padding: 30px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	transition: box-shadow 0.3s ease, transform 0.3s ease;
	position: relative; /* Support stretched link */
}
.atd-tool-card:hover {
	box-shadow: 0 12px 30px rgba(0,0,0,0.08);
	transform: translateY(-5px);
}
.atd-tool-card-content {
	display: flex;
	align-items: flex-start;
	gap: 20px;
}
.atd-card-logo {
	width: 60px;
	height: 60px;
	border-radius: 10px;
	object-fit: contain;
	background: #f8f9fa;
	flex-shrink: 0;
	border: 1px solid #eee;
}
.atd-card-text {
	flex: 1;
}
.atd-card-text h3 {
	margin: 0;
	font-size: 1.3rem;
	line-height: 1.3;
}
.atd-card-title-link {
	color: var(--atd-sys-heading);
	text-decoration: none;
}
.atd-card-title-link:hover {
	color: var(--atd-sys-primary);
}
/* Stretched Link: Makes the whole card clickable */
.atd-card-title-link::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1;
}
.atd-card-category {
	display: inline-block;
	font-size: 0.75rem;
	color: #70757a;
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	font-weight: 600;
}
.atd-card-snippet {
	font-size: 0.9rem;
	color: #5f6368;
	margin: 12px 0;
	line-height: 1.6;
}
.atd-read-more {
	font-size: 0.9rem;
	color: var(--atd-sys-primary);
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.atd-tool-card:hover .atd-read-more {
	text-decoration: underline;
}

@media (max-width: 480px) {
	.atd-tools-grid {
		grid-template-columns: 1fr;
	}
}
