/*
Theme Name: AI Business Insights
Theme URI: https://yourwebsite.com/
Author: Your Name
Author URI: https://yourwebsite.com/
Description: A Gemini-driven theme focused on AI in business. Includes a built-in content generator and dark mode.
Version: 2.9
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, ai, business, clean, modern, dark-mode
Text Domain: aibusinessinsights
*/

/* --- CSS Variables for Theming --- */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --heading-color: #1a2b48;
    --card-bg-color: #ffffff;
    --border-color: #e9ecef;
    --link-color: #0056b3;
    --link-hover-color: #003d82;
    --subtle-text-color: #6c757d;
    --header-bg-color: #ffffff;
    --hero-overlay-color: rgba(26, 43, 72, 0.6);
    --cta-bg-color: #007bff;
    --cta-hover-bg-color: #0056b3;
}

body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --card-bg-color: #1e1e1e;
    --border-color: #333333;
    --link-color: #4dabf7;
    --link-hover-color: #82c9ff;
    --subtle-text-color: #a0a0a0;
    --header-bg-color: #1e1e1e;
    --hero-overlay-color: rgba(0, 0, 0, 0.7);
    --cta-bg-color: #4dabf7;
    --cta-hover-bg-color: #82c9ff;
}


/* --- Global Styles & Typography --- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    margin: 0;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    color: var(--heading-color);
    font-weight: 700;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
}

/* --- Header --- */
.site-header {
    background-color: var(--header-bg-color);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    position: relative;
    z-index: 10;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 15px;
}

.site-logo {
    max-height: 90px;
    width: auto;
}

.site-description-container {
    background-color: var(--bg-color);
    text-align: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.site-description {
    color: var(--subtle-text-color);
    margin: 0;
    font-size: 1rem;
}

/* --- Main Navigation --- */
.main-navigation {
    display: flex;
    align-items: center;
}

.main-menu {
    display: flex;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.main-menu a {
    padding: 8px 16px;
    border-radius: 20px;
    background-color: var(--bg-color);
    color: var(--link-color);
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.main-menu a:hover {
    background-color: var(--link-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

body.dark-mode .main-menu a {
    background-color: #2a2a2a;
    border-color: #444;
}

body.dark-mode .main-menu a:hover {
    color: #121212;
}

/* --- Dark Mode Toggle --- */
.theme-switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
}
.theme-switch-label {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    font-weight: bold;
}
.theme-switch-wrapper {
    position: relative;
}
.theme-switch {
    display: inline-block;
    height: 26px;
    position: relative;
    width: 50px;
}
.theme-switch input {
    display:none;
}
.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}
.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 18px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 18px;
}
input:checked + .slider {
    background-color: #0056b3;
}
input:checked + .slider:before {
    transform: translateX(24px);
}
.slider.round {
    border-radius: 26px;
}
.slider.round:before {
    border-radius: 50%;
}


/* --- Main Content & Posts --- */
.main-content {
    background-color: var(--card-bg-color);
    border-radius: 8px;
    margin-top: 2rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transition: background-color 0.3s ease;
    padding: 2.5rem;
}

.post {
    padding: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.post:last-child {
    border-bottom: none;
}

.post-title {
    font-size: 2.25rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-title a {
    color: var(--heading-color);
}

.post-meta {
    color: var(--subtle-text-color);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.post-content {
    font-size: 1.1rem;
}

.post-content p {
    margin-bottom: 1.5em;
}

/* --- Footer --- */
.site-footer {
    padding: 3rem 1.5rem;
    margin-top: 2rem;
    background: var(--card-bg-color);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-widgets {
    display: flex;
    justify-content: space-around;
    text-align: left;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-contact, .footer-important-links {
    flex: 1;
    min-width: 250px;
}

.footer-contact h4, .footer-important-links h4 {
    color: var(--heading-color);
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.footer-contact p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-color);
}

.footer-contact a, .footer-important-links a {
    color: var(--link-color);
    text-decoration: none;
}

.footer-contact a:hover, .footer-important-links a:hover {
    text-decoration: underline;
}

.footer-important-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-important-links li {
    margin-bottom: 0.5rem;
}

.site-info {
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    color: var(--subtle-text-color);
    font-size: 0.9rem;
}

.site-info p {
    margin: 0.25rem 0;
}


/* --- Homepage Specific Styles --- */
.homepage-hero {
    position: relative;
    height: 60vh;
    min-height: 400px;
    background-size: cover;
    background-position: center center;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--hero-overlay-color);
    transition: background-color 0.3s ease;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    margin-bottom: 2rem;
}

.homepage-main {
    padding: 3rem 2rem;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-top: 0;
    margin-bottom: 2rem;
    color: var(--heading-color);
}

.featured-content {
    margin-bottom: 4rem;
}

.ai-content-box {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 8px;
    font-size: 1.15rem;
    line-height: 1.8;
    text-align: center;
    max-width: 750px;
    margin: 0 auto;
    transition: background-color 0.3s ease;
}

/* --- Latest Insights Side-Scroller --- */
.posts-scroller-container {
    overflow-x: auto;
    padding-bottom: 1rem; /* Space for scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--link-color) var(--bg-color);
}

.posts-scroller {
    display: flex;
    gap: 1.5rem;
    width: max-content;
}

.posts-scroller .post-card {
    width: 320px; /* Fixed width for each card */
    flex-shrink: 0; /* Prevent cards from shrinking */
}

.post-card {
    background: var(--card-bg-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.post-card-thumbnail img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.post-card-content {
    padding: 1.5rem;
}

.post-card-title {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.post-card-title a {
    color: var(--heading-color);
}

.post-card-excerpt {
    font-size: 0.95rem;
    color: var(--text-color);
    margin-bottom: 1rem;
}

.read-more-link {
    font-weight: bold;
    font-size: 0.9rem;
}

.view-all-posts-container {
    text-align: center;
    margin-top: 2.5rem;
}

.view-all-posts-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--link-color);
    color: #ffffff;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.view-all-posts-button:hover {
    background-color: var(--link-hover-color);
    color: #ffffff;
    transform: translateY(-2px);
}

body.dark-mode .view-all-posts-button {
    background-color: var(--link-color);
}

body.dark-mode .view-all-posts-button:hover {
    background-color: var(--link-hover-color);
}

/* --- Page & Post Styles --- */
.page-header, .post-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* --- All Posts Page & Pagination --- */
.all-posts-page .posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.pagination {
    margin-top: 3rem;
    text-align: center;
}

.pagination .page-numbers {
    padding: 8px 15px;
    margin: 0 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--link-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.pagination .page-numbers:hover {
    background-color: var(--link-color);
    color: var(--header-bg-color);
    border-color: var(--link-color);
}

.pagination .page-numbers.current {
    background-color: var(--link-color);
    color: var(--header-bg-color);
    border-color: var(--link-color);
    cursor: default;
}

/* --- AdSense Styles --- */
.in-content-ad {
    margin: 2rem 0;
    text-align: center;
}

.post-thumbnail-single {
    margin-bottom: 1.5rem;
}

.post-thumbnail-single img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --- About Us Page --- */
.about-us-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: center;
}

@media (min-width: 768px) {
    .about-us-content {
        grid-template-columns: 2fr 1fr;
    }
}

.about-us-text h2 {
    margin-top: 0;
    font-size: 2rem;
}

.about-us-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* --- AI in the News Section --- */
.ai-news-section {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.news-article {
    background-color: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-article:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.news-title {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.news-source {
    font-size: 0.85rem;
    color: var(--subtle-text-color);
    font-weight: bold;
    margin-bottom: 1rem;
    display: block;
}

.news-snippet {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* --- Chatbot Page --- */
.chatbot-page {
    padding: 0; /* FIX: Override default padding for the chatbot container */
}

.chatbot-page .page-subtitle {
    text-align: center;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    color: var(--subtle-text-color);
}

#chatbot-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#chat-window {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--bg-color);
}

#chat-log {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
}

.chat-message p {
    margin: 0;
}

.user-message {
    background-color: var(--cta-bg-color);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background-color: var(--border-color);
    color: var(--text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.bot-message.error {
    background-color: #e74c3c;
    color: #fff;
}

.typing-indicator span {
    display: inline-block;
    animation: bounce 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

#chat-form-container {
    border-top: 1px solid var(--border-color);
    padding: 10px;
    background-color: var(--card-bg-color);
}

#chat-form {
    display: flex;
    gap: 10px;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 1rem;
    background-color: var(--bg-color);
    color: var(--text-color);
}

#chat-submit-button {
    background-color: var(--link-color);
    border: none;
    color: white;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#chat-submit-button:hover {
    background-color: var(--link-hover-color);
}

/* --- AI Art Studio Page --- */
.art-studio-page {
    padding: 0; /* Override default padding */
}

.art-studio-page .page-subtitle {
    text-align: center;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    color: var(--subtle-text-color);
}

#art-studio-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#art-studio-form {
    padding: 1.5rem;
    background-color: var(--card-bg-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#art-prompt-input {
    width: 100%;
    min-height: 80px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: vertical;
    box-sizing: border-box;
}

#generate-art-button {
    padding: 12px 30px;
    background-color: var(--cta-bg-color);
    color: #ffffff;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    align-self: center;
}

#generate-art-button:hover:not(:disabled) {
    background-color: var(--cta-hover-bg-color);
    transform: translateY(-2px);
}

#generate-art-button:disabled {
    background-color: var(--subtle-text-color);
    cursor: not-allowed;
}

#art-display-area {
    background-color: var(--bg-color);
    padding: 2rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#art-loading-spinner {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--subtle-text-color);
}

#art-loading-spinner .spinner-icon {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top-color: var(--link-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#art-result-container img {
    max-width: 100%;
    max-height: 60vh;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.art-error {
    color: #e74c3c;
    font-weight: bold;
}


/* --- Responsive Styles --- */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1.5rem;
    }

    .main-navigation {
        order: 3; /* Move nav below branding and switch */
    }

    .theme-switch-container {
        order: 2;
    }

    .main-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }
}

/* --- Pillar Page Styles --- */
.pillar-page-header {
    background: #1a2b48; /* FIX: Use a specific color to avoid dark mode conflict */
    color: #fff;
    padding: 4rem 2rem;
    text-align: center;
}

.pillar-page-title {
    color: #fff;
    font-size: 3rem;
    margin-top: 0;
    margin-bottom: 1rem;
}

.pillar-page-excerpt {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 700px;
    margin: 0 auto;
}

.pillar-page-content {
    padding-top: 2rem;
}

.pillar-page-content h2 {
    font-size: 2.25rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--link-color);
    padding-bottom: 0.5rem;
}

.pillar-page-content p {
    font-size: 1.15rem;
    line-height: 1.8;
}
/* --- Recommended Products Page --- */
.recommended-products-page .page-subtitle {
    text-align: center;
    margin-top: -1.5rem;
    margin-bottom: 2rem;
    color: var(--subtle-text-color);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.products-section {
    margin-bottom: 4rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.product-card {
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.product-image {
    padding: 1rem;
    background: #fff;
    text-align: center;
}

.product-image img {
    max-width: 100%;
    height: 250px;
    object-fit: contain;
}

.product-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 1.2rem;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.product-author {
    font-size: 0.9rem;
    color: var(--subtle-text-color);
    margin-bottom: 1rem;
}

.product-description {
    font-size: 0.95rem;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.product-button {
    display: block;
    text-align: center;
    padding: 10px 20px;
    background-color: var(--link-color);
    color: #fff;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.product-button:hover {
    background-color: var(--link-hover-color);
    color: #fff;
}