@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #FF3366;
    --secondary: #FF9933;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2rem 5%;
    text-align: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}
header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Navigation */
nav {
    background: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: center;
    gap: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}
nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    transition: color 0.2s;
    white-space: nowrap;
}
nav a:hover {
    color: var(--primary);
}

/* Ad Spaces */
.ad-space {
    background: #EAEAEA;
    border: 2px dashed #BDBDBD;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 2rem auto;
    position: relative;
    overflow: hidden;
}
.ad-space::before {
    content: 'ADVERTISEMENT';
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 0.6rem;
    color: #AAA;
}
.ad-leaderboard {
    width: 100%;
    max-width: 728px;
    height: 90px;
}
.ad-rectangle {
    width: 300px;
    height: 250px;
    margin: 0 auto 2rem;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 5%;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

/* Tip Grid */
.tip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.tip-card {
    background: var(--surface);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.03);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
}
.tip-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 30px rgba(0,0,0,0.08);
}
.tip-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(45deg, #e0c3fc 0%, #8ec5fc 100%);
    object-fit: cover;
}
.tip-content {
    padding: 1.5rem;
    flex-grow: 1;
}
.tip-category {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: inline-block;
}
.tip-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.tip-excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Article Layout */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
}
@media (max-width: 900px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
}

.article-content {
    background: var(--surface);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.03);
}

.article-header h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1rem;
}
.article-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #EEE;
}

.article-body h2 {
    margin: 2rem 0 1rem;
    color: var(--primary);
}
.article-body p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text);
}
.article-body ul {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}
.article-body li {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 5rem;
}
.sidebar-widget {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.03);
    margin-bottom: 2rem;
}
.widget-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary);
}

/* Footer */
footer {
    text-align: center;
    padding: 3rem 5%;
    background: #1A1A1A;
    color: white;
    margin-top: 4rem;
}
footer p {
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Images */
.hero-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 16px 16px 0 0;
    margin-bottom: 2rem;
    margin-top: -3rem; 
    margin-left: -3rem;
    width: calc(100% + 6rem);
}
@media (max-width: 768px) {
    .hero-image {
        height: 250px;
        margin-top: -2rem;
        margin-left: -2rem;
        width: calc(100% + 4rem);
        border-radius: 16px 16px 0 0;
    }
    .article-content {
        padding: 2rem; /* Ensure padding matches the negative margins on mobile */
    }
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 768px) {
    .ad-leaderboard {
        height: auto;
        min-height: 50px;
    }
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    scrollbar-width: none; /* Firefox */
}
.category-filters::-webkit-scrollbar { display: none; }
.filter-btn {
    background: var(--surface);
    color: var(--text-light);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.2s;
}
.filter-btn:hover { background: var(--border); color: var(--text); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 10px rgba(255, 51, 102, 0.3); }

/* Newsletter Box */
.newsletter-box {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 10px 20px rgba(255, 51, 102, 0.2);
}
.newsletter-box h3 { margin-bottom: 0.5rem; font-size: 1.4rem; }
.newsletter-box p { font-size: 0.95rem; opacity: 0.9; margin-bottom: 1rem; }
.newsletter-box input { width: 100%; padding: 12px; border: none; border-radius: 8px; margin-bottom: 10px; font-family: 'Outfit'; }
.newsletter-box button { width: 100%; padding: 12px; border: none; border-radius: 8px; background: #111; color: white; font-weight: bold; cursor: pointer; transition: 0.2s; }
.newsletter-box button:hover { background: #333; }

/* Social Share */
.social-share {
    display: flex; gap: 10px; margin-top: 2rem; padding-top: 2rem; border-top: 1px solid var(--border);
}
.share-btn {
    flex: 1; padding: 12px; text-align: center; border-radius: 8px; text-decoration: none; color: white; font-weight: bold; font-size: 0.9rem; transition: 0.2s;
}
.share-btn:hover { filter: brightness(1.1); transform: translateY(-2px); }
.share-fb { background: #1877F2; }
.share-tw { background: #1DA1F2; }
.share-em { background: #333333; }

/* Read Next */
.read-next-section { margin-top: 4rem; }
.read-next-section h2 { margin-bottom: 1.5rem; }

/* --- New Frontend Features --- */
body.dark-mode {
    --background: #121212;
    --surface: #1e1e1e;
    --text: #ffffff;
    --text-light: #b0b0b0;
}

body.dark-mode nav {
    background: var(--surface);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body.dark-mode .filter-btn {
    background: #2a2a2a;
    color: var(--text-light);
}

body.dark-mode .filter-btn:hover {
    background: #3a3a3a;
}

body.dark-mode .filter-btn.active {
    background: var(--primary);
    color: white;
}

body.dark-mode .tip-card {
    background: var(--surface);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

body.dark-mode .article-content, body.dark-mode .sidebar {
    background: var(--surface);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

body.dark-mode input[type="email"], body.dark-mode input[type="text"] {
    background: #2a2a2a;
    color: white;
    border-color: #333;
}

/* Nav Controls (Search & Dark Mode) */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.search-bar {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
    background: var(--background);
    color: var(--text);
    transition: all 0.2s;
}

.search-bar:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,51,102,0.1);
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.theme-toggle:hover {
    background: rgba(0,0,0,0.05);
}

body.dark-mode .theme-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* Newsletter Success */
.newsletter-success {
    display: none;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-top: 1rem;
    font-weight: 600;
}

body.dark-mode .newsletter-success {
    background: #1b5e20;
    color: #a5d6a7;
}

.newsletter-box.subscribed form {
    display: none;
}
.newsletter-box.subscribed .newsletter-success {
    display: block;
}

/* Enhanced Search Bar */
.search-bar {
    padding: 0.6rem 1.2rem;
    padding-left: 2.5rem; /* Room for icon */
    border: 2px solid transparent;
    border-radius: 30px;
    outline: none;
    font-size: 0.95rem;
    background: var(--background) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23888" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>') no-repeat 12px center;
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    width: 200px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

body.dark-mode .search-bar {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23aaa" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
}

.search-bar:focus {
    width: 280px;
    border-color: var(--primary);
    background-color: var(--surface);
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.15);
}

.search-bar::placeholder {
    color: #999;
}

/* Enhanced Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--background);
    border: 2px solid transparent;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.theme-toggle:hover {
    transform: rotate(15deg) scale(1.1);
    background: var(--surface);
    border-color: #ddd;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

body.dark-mode .theme-toggle:hover {
    border-color: #444;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Fix Nav spacing */
nav {
    align-items: center;
}
nav a {
    position: relative;
    padding: 0.5rem 0;
}
nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}
nav a:hover::after {
    width: 100%;
}

/* Mobile Responsive Layout */
@media (max-width: 768px) {
    nav {
        flex-wrap: wrap;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-controls {
        width: 100%;
        margin-left: 0;
        justify-content: center;
    }
    
    .search-bar {
        flex: 1; /* Take up remaining space next to toggle */
        max-width: 300px;
    }
    
    .category-filters {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
        /* Hide scrollbar for a cleaner look */
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .category-filters::-webkit-scrollbar {
        display: none;
    }
    
    .filter-btn {
        flex-shrink: 0;
    }
    
    .tip-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem !important; /* Slightly smaller title on mobile */
    }
}
