/* assets/css/style.css */
:root {
    --primary-color: #ff3366;
    --primary-hover: #e62e5c;
    --bg-color: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #eeeeee;
    --card-bg: #ffffff;
    --header-bg: #ffffff;
    --footer-bg: #f8f9fa;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --container-width: 1200px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #f5f5f5;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --card-bg: #1e1e1e;
    --header-bg: #1e1e1e;
    --footer-bg: #1a1a1a;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

main {
    flex: 1;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Layout */
.header-wrapper {
    width: 100%;
    z-index: 100;
}

.main-sticky-header {
    background-color: var(--header-bg);
    box-shadow: var(--shadow-sm);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 101;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.main-sticky-header.scrolled {
    transform: translateY(0);
}

.main-sticky-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 75px;
    gap: 20px;
}

.mobile-top-header {
    display: none;
    /* Hidden on desktop */
}

.desktop-only-element {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.logo img {
    height: 40px;
}

.logo .site-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-left: 10px;
}

/* Header Search */
.header-search {
    flex: 1;
    max-width: 450px;
    margin: 0 10px;
}

.header-search form {
    display: flex;
    position: relative;
    align-items: center;
}

.header-search input {
    width: 100%;
    padding: 10px 45px 10px 20px;
    border-radius: 30px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.header-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 51, 102, 0.1);
}

.header-search button {
    position: absolute;
    right: 5px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s;
}

.header-search button:hover {
    background: var(--primary-hover);
}

/* Desktop Navigation */
.nav-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-btn {
    color: var(--text-color);
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Modern Theme Toggle */
.modern-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.toggle-track {
    width: 60px;
    height: 32px;
    background: #e0e0e0;
    border-radius: 30px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: background 0.3s, border-color 0.3s;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .toggle-track {
    background: #2a2a2a;
    border-color: #444;
}

.toggle-sun,
.toggle-moon {
    font-size: 13px;
    z-index: 1;
}

.toggle-thumb {
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    left: 3px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 2;
}

[data-theme="dark"] .toggle-thumb {
    transform: translateX(28px);
    background: #1a1a1a;
    box-shadow: inset 0 0 0 2px #f1c40f;
}

/* Mobile Navigation Bar */
.header-bottom-mobile {
    display: none;
}

/* Hero Section */
.hero {
    padding: 60px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 51, 102, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-box {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 30px;
    border: 2px solid var(--border-color);
    font-size: 1rem;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 51, 102, 0.1);
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 0 20px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.search-box button:hover {
    background: var(--primary-hover);
}

/* Grid & Cards */
.filters {
    padding: 20px 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.card-img-wrap {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

[data-theme="dark"] .card-img-wrap {
    background: #2a2a2a;
}

.card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.card:hover img {
    transform: scale(1.05);
}

.card-body {
    padding: 15px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge-new {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #2ecc71;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 10;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-link.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Footer */
footer {
    background: var(--footer-bg);
    padding: 40px 0;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* Ads Box */
.ad-slot {
    margin: 20px 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.02);
    padding: 10px;
    border-radius: 4px;
}

/* Base Color Selector Desktop Defaults */
.color-selectors {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Single Post Specifics */
.post-right .card {
    padding: 25px;
}

/* Single Post Specifics */
.post-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-top: 40px;
    margin-bottom: 60px;
}

@media (max-width: 768px) {

    /* Reveal Mobile First Header */
    .mobile-top-header {
        display: block;
        background-color: var(--header-bg);
        border-bottom: 1px solid var(--border-color);
        padding: 15px 0;
    }

    .mobile-top-inner {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 5px;
        /* Extremely tight gap between logo and nav on mobile */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    .mobile-top-inner::-webkit-scrollbar {
        display: none;
    }

    .mobile-top-inner .nav-buttons {
        gap: 5px;
        /* Reduced gap between nav buttons */
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    .mobile-top-inner .nav-btn {
        padding: 6px 10px;
        /* Reduced padding on mobile */
        font-size: 0.85rem;
        /* Smaller font on mobile */
    }

    .logo img {
        height: 32px;
        /* Slightly smaller logo on mobile */
    }

    .logo .site-name {
        font-size: 1.1rem;
        margin-left: 5px;
    }

    /* Hide Desktop Duplicates */
    .desktop-only-element {
        display: none !important;
    }

    /* Style the Sticky Secondary Header */
    .main-sticky-inner {
        height: auto;
        padding: 12px 10px;
        gap: 10px;
        justify-content: center;
    }

    .header-search {
        flex: 1;
        margin: 0;
    }

    .modern-theme-toggle {
        margin-left: 5px;
    }

    .hero {
        padding: 40px 20px;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .post-layout {
        grid-template-columns: 1fr;
    }

    /* Color Filters Horizontal Scroll for Mobile */
    .color-filters-carousel,
    .color-selectors {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
        padding-bottom: 5px;
        justify-content: flex-start !important;
        width: 100%;
        max-width: calc(100vw - 40px);
        gap: 8px !important;
        /* Force smaller gap on mobile */
    }

    .color-filters-carousel::-webkit-scrollbar,
    .color-selectors::-webkit-scrollbar {
        display: none;
        /* Safari and Chrome */
    }

    .color-filters-carousel a,
    .color-selectors a {
        flex: 0 0 auto;
        /* Prevent shrinking */
    }

    .color-circle {
        width: 30px !important;
        height: 30px !important;
    }

    .post-right .card {
        padding: 18px;
        /* Slightly less padding on mobile */
    }
}