/* --- Dark Mode Toggle Styles --- */
.fixed-mode-btn {
    position: fixed !important;
    bottom: 25px !important;
    right: 25px !important;
    z-index: 99999 !important;
    background: #333 !important;
    color: white !important;
    border: 0px solid #fff !important;
    padding: 10px 18px !important;
    border-radius: 30px !important;
    cursor: pointer !important;
    font-weight: bold !important;
    display: block !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
}

.fixed-mode-btn:hover {
    background: #dc2626 !important;
    transform: scale(1.05);
}

/* --- THE FINAL DARK MODE FIX --- */
body.dark-mode, 
body.dark-mode .admin-layout {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
}

/* 1. Force Header & Logo to White */
body.dark-mode header {
    background: #1a1a1a !important;
    border-bottom-color: #333 !important;
}

body.dark-mode .logo h1, 
body.dark-mode .logo p,
body.dark-mode .admin-header h1 {
    color: #ffffff !important;
}

/* 2. Remove the "White Boxes" everywhere (Main site & Admin) */
body.dark-mode .main-content, 
body.dark-mode .sidebar-section,
body.dark-mode .admin-content,
body.dark-mode .article-item,
body.dark-mode .real-estate-ad,
body.dark-mode .form-section,
body.dark-mode .real-estate-ads,
body.dark-mode .korean-business-ad {
    background-color: #1e1e1e !important; /* Using a subtle dark gray instead of transparent */
    background: #1e1e1e !important;
    box-shadow: none !important;
    border: 1px solid #333 !important;
}

/* 3. Fix invisible Admin Form text */
body.dark-mode .form-group label,
body.dark-mode .form-section h3,
body.dark-mode .help-text {
    color: #ffffff !important;
}

body.dark-mode .form-control {
    background: #2d2d2d !important;
    color: #ffffff !important;
    border: 1px solid #444 !important;
}

/* 4. Fix Dashboard "Quick Access" box */
body.dark-mode div[style*="background: #f8f9fa"] {
    background-color: #252525 !important;
    color: #ffffff !important;
}

/* --- UNIVERSAL LOGO COLOR FIX --- */
body.dark-mode header .logo h1,
body.dark-mode header .logo p,
body.dark-mode .admin-sidebar h2,
body.dark-mode .admin-header h1 {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Remove the specific white backgrounds shown in your screenshots */
body.dark-mode .real-estate-ads,
body.dark-mode .admin-content,
body.dark-mode div[style*="background: white"],
body.dark-mode div[style*="background: #ffffff"] {
    background-color: #1a1a1a !important;
    border: 1px solid #333 !important;
}

/* Add these at the bottom of your <style> tag */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode .article-content, 
body.dark-mode .related-item {
    background: #1e1e1e !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

body.dark-mode .article-title,
body.dark-mode .related-content h4 a {
    color: #ffffff !important;
}

body.dark-mode .article-body,
body.dark-mode .related-summary {
    color: #cccccc !important;
}

body.dark-mode .article-header {
    border-bottom-color: #333;
}

body.dark-mode .article-navigation {
    border-top-color: #333 !important;
}

body.dark-mode .article-navigation a div,
body.dark-mode .article-navigation span {
    color: #ffffff !important;
}

body.dark-mode .article-navigation div div:first-child {
    color: #aaa !important; /* PREVIOUS/NEXT labels */
}

@font-face {
    font-family: 'CR';
    src: url('/fonts/CR.woff2') format('woff2'),
         url('/fonts/CR.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: white;
    color: black;
    padding: 20px 0;
    border-bottom: 0px solid #eee;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.logo {
    text-align: center;
    padding: 5x 0;
}

.logo h1 {
    font-family: 'CR', 'Times New Roman', serif !important;
    font-size: 3.5rem !important;
    margin-bottom: -15px !important;
    color: black !important;
    font-weight: bold !important;
}

.logo p {
    opacity: 0.7;
    margin-bottom: 0;
    color: black;
    font-size: 1.2rem;
    font-style: italic;
}

.maple-leaf-icon {
    width: 0.7em;  /* Smaller than 0.8em */
    height: 0.7em;
    vertical-align: 2px;  /* Keep the same height position */
    margin: 0 4px;
    display: inline-block;
}

/* Navigation */
nav {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    padding: 15px 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    position: relative; /* Default position */
}

nav.fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
}

/* Add body class when nav is fixed */
body.nav-fixed {
    padding-top: 70px; /* Adjust this value to match your nav height */
}

/* Main Layout - Add consistent top spacing */
main {
    padding: 40px 0;
    min-height: calc(100vh - 200px); /* Prevent content jumping */
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 15px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.page-btn:hover {
    border-color: #dc2626;
    color: #dc2626;
    background: #fff5f5;
}

.page-btn.active {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

/* Dark Mode Support */
body.dark-mode .page-btn {
    background: #1e1e1e;
    border-color: #333;
    color: #eee;
}

body.dark-mode .page-btn:hover {
    background: #2a2a2a;
    border-color: #dc2626;
}

body.dark-mode .page-btn.active {
    background: #dc2626;
    color: white;
}

/* IMPORTANT FIX: Add spacing between nav and content */
.content-layout {
    display: grid;
    grid-template-columns: 2fr 300px;
    gap: 30px;
    align-items: start;
    margin-top: 20px; /* This adds the missing space at the top */
}

/* Alternative solution: Always add top spacing */
.content-wrapper {
    margin-top: 20px; /* Consistent spacing from navigation */
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
    justify-content: center;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 0px;
    font-weight: 500;
}

nav a:hover {
    background: rgba(255,255,255,0.1);
}

/* Main Layout - Articles on left/center, ads on right */
main {
    padding: 40px 0;
}

.content-layout {
    display: grid;
    grid-template-columns: 2fr 300px;
    gap: 30px;
    align-items: start;
}

/* Main Content - Now takes up more space */
.main-content {
    background: white;
    border-radius: 0px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.section-header {
    margin-bottom: 30px;
    border-bottom: 3px solid #dc2626;
    padding-bottom: 15px;
}

.section-header h2 {
    color: #333 !important;
    font-size: 1.8rem;
}

/* Override for Dark Mode */
body.dark-mode .section-header h2 {
    color: #ffffff !important;
}

/* Articles List */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 0px !important; /* Reduced from 25px to 10px for minimal spacing */
}

.article-item {
    display: flex;
    gap: 10px;
    padding: 15px !important;
    border: none !important ; /* Keep subtle border */
    border-radius: 0px !important;
    transition: all 0.3s;

    height: 180px !important; 
    overflow: hidden;
}

/* Remove the red border from featured articles */
.article-item.featured {
    background: #fff;
    /* Optional: Add a subtle indicator for featured articles instead */
    position: relative;
}

.article-image {
    flex-shrink: 0;
    width: 200px;
    height: 130px !important;
    overflow: hidden;
    border-radius: 0px !important;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 !important;
}

.article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.category {
    background: #dc2626;
    color: white;
    padding: 3px 8px;
    border-radius: 0px;
    font-size: 0.75rem;
    font-weight: 500;
}

.date, .views {
    color: #666;
}

.article-content h3 {
    margin-bottom: 10px;
    line-height: 1.4;
}

.article-content h3 a {
    color: #333;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
}

/* This targets the clickable titles inside the articles */
body.dark-mode .article-content h3 a {
    color: #ffffff !important;
}

body.dark-mode .article-content h3 a:hover {
    color: #dc2626 !important; /* A brighter red so it's easier to see on dark backgrounds */
}

.article-content h3 a:hover {
    color: #dc2626;
}

.summary {
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
    flex: 1;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.author {
    color: #888;
}

.read-more {
    color: #dc2626;
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

/* Trending Section Bar */
.trending-middle-bar {
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px;
    background: white;
    border: 1px solid #eee;
    display: grid;
    grid-template-columns: 1fr 1fr; /* Side-by-side lists */
    gap: 50px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Dark Mode adjustment */
body.dark-mode .trending-middle-bar {
    background: #1e1e1e;
    border-color: #333;
    box-shadow: none;
}

.trending-column h3 {
    color: #dc2626;
    font-size: 1.2rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #dc2626;
    padding-bottom: 10px;
    font-weight: bold;
}

.trending-middle-bar .news-list {
    list-style: none;
    padding: 0;
}

.trending-middle-bar .news-list li {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f5;
}

body.dark-mode .trending-middle-bar .news-list li {
    border-bottom-color: #2a2a2a;
}

.trending-middle-bar .news-rank {
    color: #dc2626;
    font-weight: 900;
    margin-right: 15px;
    width: 20px;
}

.trending-middle-bar .news-list li a {
    text-decoration: none;
    color: #333;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .trending-middle-bar .news-list li a {
    color: #eee;
}

.trending-middle-bar .news-list li a:hover {
    color: #dc2626;
}

/* Mobile: Stack the columns */
@media (max-width: 768px) {
    .trending-middle-bar {
        grid-template-columns: 1fr;
        gap: 30px;
        margin: 20px auto;
    }
}

/* 1. Default Styles (Light Mode) */
.trending-tabs-box {
    background: #ffffff; /* White background */
    border: 1px solid #ddd;
    overflow: hidden;
    width: 100%;
    margin-top: 20px;
}

.trending-tabs-box .tabs-header {
    display: flex;
    background: #f5f5f5; /* Light grey header */
    border-bottom: 1px solid #ddd;
}

.trending-tabs-box .tab-btn {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    color: #666; /* Subtle grey for inactive */
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: 0.3s;
}

.trending-tabs-box .tab-btn.active {
    color: #dc2626; /* Brand Red */
    border-bottom: 3px solid #dc2626;
    background: #fff;
}

.trending-list li {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
}

.trending-list .rank {
    color: #dc2626;
    font-weight: 900;
    width: 35px;
    font-size: 1.1rem;
}

.trending-list li a {
    color: #333; /* Dark text for light background */
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 2. Dark Mode Overrides (Triggered by .dark-mode class) */
body.dark-mode .trending-tabs-box {
    background: #1e1e1e;
    border-color: #333;
}

body.dark-mode .trending-tabs-box .tabs-header {
    background: #252525;
    border-bottom: 1px solid #333;
}

body.dark-mode .trending-tabs-box .tab-btn {
    color: #888;
}

body.dark-mode .trending-tabs-box .tab-btn.active {
    color: #fff;
    background: rgba(220, 38, 38, 0.1);
}

body.dark-mode .trending-list li {
    border-bottom: 1px solid #2a2a2a;
}

body.dark-mode .trending-list li a {
    color: #eee;
}

/* Right Sidebar - Ads only */
.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-section {
    background: white;
    border-radius: 0px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-section h3 {
    color: #dc2626;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 0px solid #dc2626;
    padding-bottom: 8px;
    text-align: center;
}

/* Ad Sections */
.ad-section {
    text-align: center;
}

.ad-banner {
    margin-top: 15px;
}

.ad-placeholder {
    background: #f0f0f0;
    border: 2px dashed #ccc;
    padding: 40px 20px;
    border-radius: 0px;
    color: #888;
}

.ad-placeholder p {
    font-weight: bold;
    margin-bottom: 5px;
}

/* Real Estate Ads Section at Bottom */
.real-estate-ads {
    margin-top: 50px;
    background: white;
    border-radius: 0px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.real-estate-ads h2 {
    color: #000000 !important;
    font-size: 1.8rem;
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 3px solid #dc2626;
    padding-bottom: 15px;
}

/* Dark Mode Override (Keep White) */
body.dark-mode .real-estate-ads h2 {
    color: #ffffff !important;
}

.real-estate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.real-estate-ad {
    border: 1px solid #eee;
    border-radius: 0px;
    overflow: hidden;
    transition: all 0.3s;
    background: #fafafa;
}

/* Update the container to have a fixed height */
.real-estate-image {
    width: 100%;
    height: 200px; /* This keeps all house boxes the same height */
    overflow: hidden;
    background: #f0f0f0;
    border-bottom: 1px solid #eee;
    display: block; /* Remove flex since we aren't centering text anymore */
}

/* Make the link tag act as a container for the image */
.real-estate-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Ensure the image fills the space without stretching or distorting */
.real-estate-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This is the key fix */
    display: block;
    transition: transform 0.3s ease;
}

.real-estate-content {
    padding: 20px;
}

.real-estate-content h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.real-estate-content p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 10px;
}

.real-estate-price {
    color: #dc2626;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
}

/* Korean Business Ads */
/* --- Clean Business Ads (Minimalist) --- */

/* Fix the sidebar container background for these ads */
body.dark-mode .sidebar-section,
.sidebar-section {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* This is the box for the ad */
.ad-link {
    display: block !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    text-decoration: none !important;
}

/* This forces the full image to be visible */
.ad-link img {
    width: 100% !important;
    height: auto !important; /* Let height adjust naturally */
    max-height: 180px !important; /* Limits how "tall" the ad can get */
    object-fit: contain !important; /* SHOWS THE WHOLE PHOTO */
    display: block !important;
    background-color: transparent !important; /* Removes any dark boxes behind the photo */
    border-radius: 0px;
}

/* Non-clickable ad container */
.ad-link-no-click {
    display: block !important;
    width: 100% !important;
    margin-bottom: 20px !important;
}

.ad-link-no-click img {
    width: 100% !important;
    height: auto !important;
    max-height: 180px !important;
    object-fit: contain !important;
    display: block !important;
    border-radius: 0px;
    cursor: default; /* Shows it's not clickable */
}

/* --- Tighter Sidebar Ad Spacing --- */

/* --- UNIVERSAL SIDEBAR ADS (Matching Index) --- */

.uniform-ad-column {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important; /* Space between ads */
    width: 100% !important;
}

.uniform-ad-item {
    width: 100% !important;
}

.ad-link-wrapper {
    display: block !important;
    width: 100% !important;
    line-height: 0; /* Removes bottom ghost padding */
    text-decoration: none !important;
}

.ad-link-wrapper img {
    width: 100% !important;
    height: auto !important; /* Let the height be determined by the image ratio */
    display: block !important;
    border-radius: 0px;
    transition: opacity 0.2s ease;
}

.ad-link-wrapper:hover img {
    opacity: 0.9;
}

/* Remove or Comment Out the old .ad-link { height: 160px } rule 
   if it exists elsewhere, as it forces the "Too Big/Stretched" look */
.ad-link, .ad-link-no-click {
    display: block !important;
    width: 100% !important;
    /* Ensure no margin-bottom is pushing ads away */
    margin-bottom: 0 !important; 
}

.ad-link img, .ad-link-no-click img {
    width: 100% !important;
    height: auto !important;
    max-height: 180px !important;
    object-fit: contain !important;
    display: block !important;
}

/* Dark Mode adjustment for the subtle border */
body.dark-mode .ad-link {
    border-color: #333;
}

/* --- UNIVERSAL LINK RESET --- */

/* 1. Remove blue color and underlines from ALL ad links */

/* 2. Specifically force the Title to be Red (Light Mode) */
.business-name a, 
.real-estate-content h3 a {
    color: #dc2626 !important; /* Original Red */
    font-weight: bold !important;
}

/* 3. Specifically force the Title to be Lighter Red (Dark Mode) */
body.dark-mode .business-name a, 
body.dark-mode .real-estate-content h3 a {
    color: #ff4d4d !important; /* Lighter red for visibility on black */
}

/* 4. Fix for other text (address, phone) so they don't turn blue if wrapped in <a> */
.business-contact a,
.real-estate-contact a {
    color: inherit !important;
    text-decoration: none !important;
}

/* Responsive Design */
@media (max-width: 1024px) {
    /* 1. Set the main layout to flex-column */
    .content-layout {
        display: flex;
        flex-direction: column;
    }

    /* 2. Show Articles FIRST */
    .main-content {
        order: 1;
        width: 100%;
    }

    /* 3. Show Real Estate Ads SECOND */
    /* This targets the section directly */
    .real-estate-ads {
        order: 2;
        width: 100%;
        margin-top: 40px;
    }

    /* 4. Show Sidebar LAST */
    .right-sidebar {
        order: 3;
        position: static;
        display: flex;
        flex-direction: column;
        width: 100%;
        margin-top: 40px;
    }

    /* Override any previous "order: -1" rules */
    .right-sidebar {
        order: 3 !important;
    }
}

@media (max-width: 768px) {
    /* Ensure the grid doesn't break on small screens */
    .real-estate-grid {
        grid-template-columns: 1fr;
    }

    /* Make article images full width on mobile */
    .article-item {
        flex-direction: column;
    }
    
    .article-image {
        width: 100%;
        height: 200px;
    }
}@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    
    .right-sidebar {
        order: -1;
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Ensure the title has enough space from the image */
.business-content {
    padding: 20px !important; /* Adds the padding you like from the homepage */
}

.business-name {
    margin-bottom: 8px; /* Gap between name and category */
}

@media (max-width: 768px) {
    .article-item {
        flex-direction: column;
    }
    
    .article-image {
        width: 100%;
        height: 200px;
    }
    
    .real-estate-grid {
        grid-template-columns: 1fr;
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    nav a {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    nav .container {
        flex-direction: column; /* Stack links and search bar vertically on mobile */
        gap: 15px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px; /* Tighter gap for mobile */
    }
    
    .search-bar-container {
        width: 100%;
        justify-content: center;
    }
}

/* Remove shadows from article boxes in dark mode */
body.dark-mode .article-item,
body.dark-mode .article-content {
    box-shadow: none !important;
    background-color: #1e1e1e !important; /* Keep the subtle dark gray background */
    margin-bottom: 0px !important;      /* Keep your 2mm gap */
    outline: none !important;
    background: transparent !important;
    border: none !important;
}

body.dark-mode .article-content {
    background: transparent !important;
    border: none !important;
}

body.dark-mode .article-item.featured {
    border: none !important;
}

/* If the line is specifically at the bottom of the content */
body.dark-mode .article-footer {
    border-top: none !important;
}

/* Ensure the outer box has a clean, dark border instead */
body.dark-mode .article-item {
    margin-bottom: 15px;
}

/* 1. Change Height to Min-Height */
.article-item {
    min-height: 180px !important; /* Minimum uniform size */
    height: auto !important;      /* Allows it to grow if text is long */
    display: flex;
    align-items: stretch;         /* Makes text and image area match height */
    padding: 20px !important;
    overflow: visible !important; /* Prevents the "slicing" effect */
}

/* 2. Fix the Text Area */
.article-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-left: 20px;
    /* Ensure no hidden overflow here */
    overflow: visible; 
}

/* 3. Improved Line Clamping */
.summary {
    display: -webkit-box;
    -webkit-line-clamp: 2;         /* Show exactly 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;              /* This handles the "..." correctly */
    
    line-height: 1.6;              /* Better spacing for Korean text */
    /* REMOVE max-height entirely to prevent slicing */
    
    margin-top: 10px;
    margin-bottom: 15px !important;
    color: #aaa !important;
}

/* 4. Ensure the footer stays at the bottom */
.article-footer {
    margin-top: auto; /* Pushes "자세히 보기" to the bottom of the box */
    padding-top: 10px;
}

.view-more-ads-btn {
    display: inline-block;
    padding: 12px 35px;
    background: transparent;
    color: #dc2626;
    border: 2px solid #dc2626;
    border-radius: 0px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.view-more-ads-btn:hover {
    background: #dc2626;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(220, 38, 38, 0.3);
}

/* Dark mode adjustment */
body.dark-mode .view-more-ads-btn {
    color: #ff4d4d;
    border-color: #ff4d4d;
}

body.dark-mode .view-more-ads-btn:hover {
    background: #ff4d4d;
    color: #fff;
}

/* --- Force Sidebar to stay on the right --- */
.content-layout {
    display: grid !important;
    /* This creates two columns: the first one takes remaining space, the second is 300px */
    grid-template-columns: 1fr 300px !important; 
    gap: 30px;
    align-items: start;
}

/* Ensure the sidebar container has width */
.right-sidebar {
    width: 300px !important;
    display: block !important;
}

/* On Mobile, stack them instead of hiding */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr !important;
    }
    .right-sidebar {
        width: 100% !important;
    }
}

/* --- FINAL CLEAN SIDEBAR ADS --- */
/* 1. Reset the layout to ensure it's on the right */
.content-layout {
    display: grid !important;
    grid-template-columns: 1fr 300px !important; 
    gap: 30px;
    align-items: start;
    width: 100%;
}

/* 2. Ensure the sidebar container is visible */
.right-sidebar {
    width: 300px !important;
    display: block !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

/* 3. The Ad Column */
.uniform-ad-column {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
}

/* 4. The Individual Ad Tile */
.ad-link {
    display: block !important;
    width: 100%;
    height: 160px; /* Force uniform height */
    overflow: hidden;
    border-radius: 0px;
    background: #252525; /* Dark placeholder if image fails */
    border: 1px solid #333; /* Clean border for dark mode */
}

.ad-link img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important; /* Crops image to fit the tile perfectly */
    display: block !important;
    opacity: 1 !important; /* Force visibility */
    visibility: visible !important;
}

.ad-link:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
    transition: all 0.3s ease;
}

/* Mobile Fix */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr !important;
    }
    .right-sidebar {
        width: 100% !important;
        margin-top: 30px;
    }
}

/* Enhanced Modal Styles */
.modal-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000; /* Dark background for the image frame */
    min-height: 300px;
}

.full-res-ad {
    max-width: 100%;
    height: auto;
    display: block;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.modal-footer-hint {
    padding: 15px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

body.dark-mode .modal-footer-hint {
    background: #252525;
    border-top: 1px solid #333;
    color: #888;
}

.modal-footer-hint p {
    font-size: 0.85rem;
    margin: 0;
    color: #666;
}

/* Animation for the popup */
.modal-content {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- UNIVERSAL WEATHER WIDGET STYLES --- */
.weather-star-style {
    position: absolute;
    top: 15px; 
    left: 20px;
    display: flex;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1;
    z-index: 100;
    
    /* DEFAULT (Light Mode Colors) */
    color: #1a1a1a; 
}

#weather-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important; /* Forces the space to stay open */
    margin-right: 8px;
    vertical-align: middle;
}

#weather-icon img {
    width: 100% !important;
    height: 100% !important;
    display: block !important;

    filter: drop-shadow(0px 0px 1px rgba(0,0,0,0.5)) 
            drop-shadow(0px 1px 2px rgba(0,0,0,0.15)) !important;
    
    transition: filter 0.3s ease;
}

.city-label {
    font-size: 1rem;
    color: #333; /* Dark Gray for Light Mode */
    margin-right: 4px;
}

.weather-temp {
    font-size: 1rem;
    color: #000000; /* Black for Light Mode */
}

.separator {
    color: #ccc; /* Subtle gray bar */
    margin: 0 12px;
    font-weight: 300;
}

.date-text {
    font-size: 1rem;
    color: #666; /* Medium gray for Light Mode */
    letter-spacing: -0.2px;
}

/* --- DARK MODE OVERRIDES --- */
body.dark-mode .city-label {
    color: #eeeeee !important;
}

body.dark-mode .weather-temp {
    color: #ffffff !important;
}

body.dark-mode .date-text {
    color: #aaaaaa !important;
}

body.dark-mode .separator {
    color: #444444 !important;
}

body.dark-mode #weather-icon img {
    filter: brightness(1) invert(0); /* Reset filter for dark background */
}

@media (max-width: 768px) {
    /* 1. Reset the Header Container */
    header .container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding-top: 10px !important;
    }

    /* 2. Bring the Widget Back & Center It */
    .weather-star-style {
        position: relative !important; /* Removes it from the "invisible" corner */
        top: 0 !important;
        left: 0 !important;
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        margin: 0 auto 10px auto !important; /* Space between widget and logo */
        
        /* THE COLOR FIX: Make sure we can see it on white background */
        color: #1a1a1a !important; 
        transform: scale(0.85); /* Keeps it from being too bulky */
    }

    /* Force visibility for all text parts in light mode */
    .weather-star-style span, 
    .weather-star-style .city-label,
    .weather-star-style .weather-temp,
    .weather-star-style .date-text {
        color: #333 !important;
    }

    /* DARK MODE MOBILE: Flip colors back to white */
    body.dark-mode .weather-star-style span,
    body.dark-mode .weather-star-style .city-label,
    body.dark-mode .weather-star-style .weather-temp,
    body.dark-mode .weather-star-style .date-text {
        color: #ffffff !important;
    }

    /* 3. Logo & Tagline Adjustments */
    .logo h1 {
        font-size: 2.0rem !important;
        margin-bottom: 0 !important;
    }

    .logo p {
        font-size: 0.8rem !important; /* Smaller tagline as requested */
        margin-top: 2px !important;
        opacity: 0.7;
    }

    header {
        padding: 10px 0 !important;
    }
}