/* style.css */

:root {
    --primary-color: #00cc00; /* A green */
    --secondary-color: #111;
    --background-color: #f4f4f9;
    --text-color: #333;
    --ai-message-bg: #fff;
    --user-message-bg: #e2f0e3;
    --border-color: #ccc;
    --font-family: 'Ubuntu', sans-serif;
    --input-bg-color: #fff;
}

/* FIX: Universal reset for padding and margin */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* FIX: Remove overflow-x, and let the correct layout handle it */
}

/* FIX: Navbar padding for mobile */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--secondary-color);
    color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-left .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    /* Adjust margin-left for navigation links to accommodate search bar */
    gap: 20px; /* Use gap for spacing between nav items including search */
}

.nav-right a {
    color: #fff;
    text-decoration: none;
    font-weight: 400;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-right a svg {
    margin-right: 5px;
}

.nav-right a:hover {
    color: var(--primary-color);
}

.hamburger {
    display: none;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #fff;
    margin: 5px 0;
    transition: all 0.3s ease-in-out;
}

/* Search Bar Styling */
.search-bar-container {
    display: flex;
    align-items: center;
    background-color: #fff;
    border-radius: 20px;
    padding: 5px 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 250px; /* Adjust width as needed */
    transition: width 0.3s ease;
}

.search-input {
    border: none;
    outline: none;
    padding: 5px;
    flex-grow: 1;
    font-size: 0.9rem;
    color: var(--text-color);
    background-color: transparent;
}

.search-input::placeholder {
    color: #888;
}

.search-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color); /* Magnifier icon color */
    transition: color 0.3s ease;
}

.search-icon-btn:hover {
    color: var(--secondary-color);
}

/* Site Intro Section Styling */
.site-intro-section {
    background-color: var(--background-color); /* Use a light background */
    padding: 2rem;
    text-align: center;
    margin: 2rem auto; /* Center the section and give some vertical margin */
    max-width: 1200px; /* Match container max-width */
    width: 100%;
}

.intro-line {
    border-bottom: 1px solid var(--primary-color); /* Thin green line */
    width: 80%; /* Adjust width as needed */
    margin: 0 auto 1.5rem auto; /* Center and add space below */
}

.intro-line.top-line {
    margin-top: 0; /* No top margin for the very first line */
    margin-bottom: 1.5rem; /* Space below the top line */
}

.intro-line.bottom-line {
    margin-top: 1.5rem; /* Space above the bottom line */
    margin-bottom: 0; /* No bottom margin for the very last line */
}

.intro-heading {
    font-size: 2.2rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.intro-text {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.6;
    max-width: 800px; /* Limit text width for readability */
    margin: 0 auto; /* Center the text */
}


/* Main Content Layout */
.container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem; /* Consistent padding */
}

.content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.chat-column {
    padding: 2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.blog-ad-column {
    padding: 2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

h1 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.tagline {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg-color);
    overflow: hidden;
}

#chat-history {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-message {
    align-self: flex-end;
    background-color: var(--user-message-bg);
    color: var(--text-color);
}

.ai-message {
    align-self: flex-start;
    background-color: var(--ai-message-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.ai-message ul, .ai-message ol {
    margin: 10px 0 10px 20px;
}

.ai-message li {
    margin-bottom: 5px;
}

.input-box-container {
    display: flex;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

#user-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    resize: none; /* Disable manual resizing */
    min-height: 40px; /* Ensure it's not too small */
    max-height: 120px; /* Prevent it from growing too large */
    overflow-y: auto; /* Add scrollbar if content exceeds max-height */
    font-family: var(--font-family);
    background-color: var(--input-bg-color);
    transition: border-color 0.3s ease;
}

#user-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#send-btn {
    background-color: var(--primary-color);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.3s ease;
}

#send-btn svg {
    color: #fff;
}

#send-btn:hover {
    background-color: #00cc00;
}

/* Temporary Loading Message Style */
.loading-message {
    background-color: #00FF00;
    color: #000;
    font-weight: bold;
    border: none;
    animation: pulse-message 1.5s infinite;
}

@keyframes pulse-message {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
    }
}

/* Blog & Ad Grid for Right Column */
.blog-ad-grid-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.blog-ad-grid-header h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    text-align: center;
}

.blog-ad-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: 70vh;
    overflow-y: auto;
}

.blog-ad-item {
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background-color: #f9f9f9;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    min-height: 150px;
    display: flex;
    flex-direction: column;
}

.blog-ad-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.blog-ad-item a {
    text-decoration: none;
    color: var(--primary-color);
    display: block;
    height: 100%;
}

.blog-ad-item a:hover {
    text-decoration: underline;
}

.blog-ad-content {
    padding: 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-ad-content h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.blog-ad-content p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
}

/* Footer Styles */
.footer {
    background-color: #000;
    color: #fff;
    height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    margin-top: 3rem;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.footer-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s ease;
}

.footer-nav a:hover {
    color: var(--primary-color);
}

.footer-copyright {
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.4;
}

.footer-copyright a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer-copyright a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1024px) {
    /* FIX: Adjust padding on the main container for smaller screens */
    .container {
        padding: 1rem;
    }
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .blog-ad-column {
        margin-top: 1rem;
    }

    .chat-column, .blog-ad-column {
        padding: 1.5rem;
    }

    .blog-ad-grid {
        height: auto; /* Remove fixed height when stacked */
        overflow-y: visible;
    }

    .blog-ad-grid-header {
        grid-template-columns: 1fr; /* Stack header titles */
    }

    /* Adjust search bar width for smaller screens */
    .search-bar-container {
        width: 180px; /* Smaller width for tablets */
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    .nav-right {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--secondary-color);
        position: absolute;
        top: 60px;
        left: 0;
        padding: 1rem 0;
        text-align: center;
        box-shadow: 0 4px 5px rgba(0, 0, 0, 0.1);
    }

    .nav-right.active {
        display: flex;
    }

    .nav-right a {
        margin: 10px 0;
    }

    .hamburger {
        display: block;
    }

    /* Adjust search bar for mobile menu */
    .search-bar-container {
        width: 90%; /* Full width within mobile menu */
        margin: 10px auto; /* Center it */
    }
}

/* FIX: Universal responsive rules to prevent overflow on mobile */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem; /* Adjust padding to give a small margin on the sides */
    }
    /* This rule is a more aggressive fix to contain all child elements */
    .container * {
        max-width: 100%;
        box-sizing: border-box;
    }
    .content-wrapper {
        display: block; /* Change grid to block to remove grid gap issues */
        overflow-x: hidden;
    }
    .chat-column, .blog-ad-column {
        width: 100%;
        margin-bottom: 1rem;
        padding: 1.5rem;
    }
}
