body {
    font-family: Arial, sans-serif;
    background-color: #f8f8f8; /* Light gray background */
    color: #333; /* Dark gray text */
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    background-color: #fff; /* White content background */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    text-align: center;
}

h1 {
    color: #222; /* Darker title */
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px; /* Adjusted margin */
}

input[type="text"] {
    width: 70%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus {
    border-color: #a0a0a0; /* Slightly darker gray on focus */
}

button {
    padding: 12px 25px;
    background-color: #555; /* Dark gray button */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #333; /* Even darker gray on hover */
}

.nav-links {
    margin-bottom: 30px;
    font-size: 1.1em;
}

.nav-links a {
    color: #007bff; /* Blue link */
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #0056b3; /* Darker blue on hover */
    text-decoration: underline;
}

/* Loading Spinner */
.hidden {
    display: none;
}

#loading {
    margin-top: 20px;
    font-style: italic;
    color: #666;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #333;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results Area */
.results-container {
    text-align: left;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.results-container h2 {
    color: #333;
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.results-container p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.last-updated {
    font-size: 0.85em;
    color: #777;
    margin-top: 25px;
    text-align: right;
}

/* Ad Placeholder Styling */
.ad-placeholder {
    width: 100%;
    height: 150px; /* Standard ad banner height */
    background-color: #e0e0e0; /* Light gray for ad background */
    border: 1px dashed #bbb;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-weight: bold;
    margin: 20px auto; /* Spacing around ads */
    border-radius: 5px;
    font-size: 0.9em;
    text-align: center;
}

/* Styling for browse_pages.php */
.browse-list, .search-history ul {
    list-style: none;
    padding: 0;
    text-align: left;
    max-height: 60vh; /* Limit height for scrollability */
    overflow-y: auto; /* Enable scrolling */
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 15px;
    background-color: #fcfcfc;
}

.browse-list li, .search-history li {
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f0f0;
}

.browse-list li:last-child, .search-history li:last-child {
    border-bottom: none;
}

.browse-list a, .search-history a {
    color: #333;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease;
}

.browse-list a:hover, .search-history a:hover {
    color: #007bff;
    text-decoration: underline;
}

/* Search History & Popular Searches Sections */
.search-history {
    margin-top: 20px;
    margin-bottom: 40px;
    text-align: center;
}

.search-history h2 {
    font-size: 1.3em;
    color: #444;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

/* Share Buttons */
.share-buttons {
    margin-top: 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.share-buttons a, .refresh-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    color: white;
    font-weight: bold;
    transition: opacity 0.3s ease;
    font-size: 0.9em;
}

.share-buttons a:hover, .refresh-button:hover {
    opacity: 0.8;
}

.share-twitter { background-color: #1DA1F2; }
.share-facebook { background-color: #1877F2; }
.share-linkedin { background-color: #0A66C2; }
.share-copy { background-color: #6c757d; }

.refresh-button {
    background-color: #28a745; /* Green for refresh */
    margin-top: 15px;
}

/* Did You Mean */
.did-you-mean {
    margin-top: 20px;
    padding: 15px;
    background-color: #fff3cd; /* Light yellow background */
    border: 1px solid #ffeeba;
    border-radius: 5px;
    color: #856404; /* Dark yellow text */
    text-align: left;
}

.did-you-mean p {
    margin-bottom: 10px;
}

.did-you-mean a {
    color: #0056b3;
    font-weight: bold;
    text-decoration: underline;
}

/* Sources Section Styling */
.sources-section {
    margin-top: 40px; /* More space from content above */
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: left;
    font-size: 0.95em;
    color: #555;
}

.sources-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.sources-section p {
    margin-bottom: 10px;
}

.sources-section a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

.sources-section a:hover {
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .search-box {
        flex-direction: column;
    }
    input[type="text"], button {
        width: 100%;
    }
    .share-buttons {
        flex-direction: column;
        align-items: center;
    }
    .share-buttons a, .refresh-button {
        width: 80%; /* Make buttons wider on small screens */
        justify-content: center;
    }
}