/* =========================================
   THEME VARIABLES (Light & Dark)
========================================= */
:root {
    --primary-text: #ffffff;
    --secondary-text: #b3b3b3;
    --bg-gradient: linear-gradient(135deg, #0f172a, #1e293b, #0f172a);
    --surface-color: #111827; 
    --card-bg: rgba(255, 255, 255, 0.05); 
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Top Toggle variables */
    --toggle-active-bg: #ffffff;
    --toggle-active-text: #000000;
    
    /* Floating Nav Dark Mode */
    --nav-float-bg: #1a1e29;
    --nav-float-text: #8b92a5;
    --nav-float-active-bg: #1a4f4c;
    --nav-float-active-text: #4ade80;
    
    /* Popover UI */
    --popover-bg: #1e293b;
    --popover-text: #ffffff;
    --popover-border: rgba(255,255,255,0.1);
}

[data-theme="light"] {
    --primary-text: #111827;
    --secondary-text: #4b5563;
    --bg-gradient: linear-gradient(135deg, #f6f8fd, #f1f5f9, #e2e8f0);
    --surface-color: #ffffff; 
    --card-bg: #ffffff; 
    --border-color: #e5e7eb;
    
    /* Top Toggle variables (Light active background, Dark text) */
    --toggle-active-bg: #ffffff;
    --toggle-active-text: #111827;

    /* Floating Nav Light Mode */
    --nav-float-bg: #ffffff;
    --nav-float-text: #6b7280;
    --nav-float-active-bg: #e0f2fe;
    --nav-float-active-text: #0284c7;
    
    /* Popover UI (Like image_3c9ffe.png) */
    --popover-bg: #ffffff;
    --popover-text: #111827;
    --popover-border: #e5e7eb;
}

html { background-color: #0f172a; transition: background-color 0.3s ease; }
html[data-theme="light"] { background-color: #f6f8fd; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, sans-serif; }

body { background: var(--bg-gradient); background-attachment: fixed; color: var(--primary-text); min-height: 100vh; padding-top: 76px; padding-bottom: 90px; }
a { text-decoration: none; color: inherit; }

/* =========================================
   NAVBAR (Decluttered)
========================================= */
.navbar { position: fixed; top: 0; left: 0; width: 100%; height: 76px; display: flex; justify-content: space-between; align-items: center; padding: 0 2rem; background: var(--surface-color); border-bottom: 1px solid var(--border-color); z-index: 2000; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.navbar-hidden { transform: translateY(-100%); }
.nav-left { display: flex; align-items: center; gap: 1rem; }
.hamburger-btn { font-size: 1.4rem; cursor: pointer; color: var(--primary-text); background: none; border: none; }
.logo { font-size: 1.5rem; font-weight: bold; }
.nav-right { display: flex; align-items: center; gap: 1.2rem; }

/* SEARCH & CATEGORIES IN BODY */
.body-search-container { max-width: 100%; margin: 0; padding: 0.5rem 1.5rem; position: sticky; top: 76px; z-index: 1000; background: transparent; pointer-events: none; transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease; }
.navbar-hidden-search { top: 20px; padding-top: 0; }
.search-bar { display: flex; align-items: center; background: var(--surface-color); border-radius: 24px; padding: 0.8rem 1.5rem; width: 100%; max-width: 800px; margin: 0 auto; border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.1); pointer-events: auto; }
.search-bar i { color: var(--secondary-text); font-size: 1.2rem; }
.search-bar input { border: none; background: transparent; width: 100%; padding: 0.2rem 0.8rem; color: var(--primary-text); outline: none; font-size: 1.1rem; }

.category-scroll-container { display: flex; justify-content: center; gap: 0.8rem; overflow-x: auto; padding: 0.5rem 1.5rem 1.5rem; max-width: 1400px; margin: 0 auto; -ms-overflow-style: none; scrollbar-width: none; }
.category-scroll-container::-webkit-scrollbar { display: none; }
.category-pill { background: var(--card-bg); color: var(--primary-text); border: 1px solid var(--border-color); padding: 0.5rem 1.2rem; border-radius: 20px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: 0.2s; }
.category-pill:hover { background: var(--primary-text); color: var(--surface-color); }

/* ANIMATED SUN/MOON THEME SWITCH */
.theme-switch { position: relative; display: inline-block; width: 54px; height: 28px; }
.theme-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 34px; display: flex; align-items: center; justify-content: space-between; padding: 0 6px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.slider i { font-size: 12px; z-index: 1; }
.slider .fa-moon { color: #f8fafc; }
.slider .fa-sun { color: #f59e0b; }
.slider:before { position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; z-index: 2; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background-color: #334155; }
input:checked + .slider:before { transform: translateX(26px); }

/* SMALL SWITCH FOR SETTINGS */
.theme-switch-sm { position: relative; display: inline-block; width: 44px; height: 24px; }
.theme-switch-sm input { opacity: 0; width: 0; height: 0; }
.slider-sm { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 34px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.slider-sm:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider-sm { background-color: #3b82f6; }
input:checked + .slider-sm:before { transform: translateX(20px); }

/* Buttons */
.btn-secondary { background: transparent; color: var(--primary-text); border: 1.5px solid var(--primary-text); padding: 0.5rem 1.2rem; border-radius: 20px; cursor: pointer; font-weight: 600; font-size: 0.95rem; transition: 0.3s; }
.btn-secondary:hover { background: var(--primary-text); color: var(--surface-color); }
.btn-primary { background: var(--primary-text); color: var(--surface-color); border: none; padding: 0.8rem 1.2rem; border-radius: 8px; cursor: pointer; font-weight: bold; }
.btn-secondary-solid { background: rgba(128,128,128,0.2); color: var(--primary-text); border: none; padding: 0.8rem 1.2rem; border-radius: 8px; cursor: pointer; font-weight: bold; }
.fav-top-btn { background: transparent; border: none; color: var(--primary-text); font-size: 1.4rem; cursor: pointer; transition: 0.3s; padding: 0.2rem; display: flex; align-items: center; justify-content: center; }
.fav-top-btn:hover, .fav-top-btn.active { color: #ef4444; transform: scale(1.1); }

/* =========================================
   POPOVER MENU
========================================= */
.popover-menu { visibility: hidden; opacity: 0; position: absolute; top: 70px; left: 2rem; background: var(--popover-bg); color: var(--popover-text); border-radius: 12px; border: 1px solid var(--popover-border); z-index: 1001; transition: all 0.3s ease; box-shadow: 0 10px 40px rgba(0,0,0,0.15); width: 750px; max-width: 90vw; overflow: hidden; }
.popover-scroll-content { max-height: 80vh; overflow-y: auto; }
.popover-scroll-content::-webkit-scrollbar { width: 6px; }
.popover-scroll-content::-webkit-scrollbar-track { background: transparent; }
.popover-scroll-content::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 3px; }
.popover-menu.show { visibility: visible; opacity: 1; transform: translateY(5px); }
.close-popover { position: absolute; top: 1rem; right: 1.5rem; font-size: 2rem; cursor: pointer; color: var(--secondary-text); transition: 0.2s; z-index: 10; line-height: 1; }
.close-popover:hover { color: var(--popover-text); }

.popover-grid { display: grid; grid-template-columns: repeat(3, 1fr); padding: 2rem; gap: 2rem; }
.popover-col h4 { font-size: 1.1rem; margin-bottom: 1.5rem; display: flex; gap: 10px; align-items: center; font-weight: 700; }
.popover-col ul { list-style: none; }
.popover-col li { margin-bottom: 1.2rem; }
.popover-col li a { color: var(--secondary-text); font-size: 0.95rem; transition: 0.2s; }
.popover-col li a:hover { color: var(--popover-text); }
.social-icons { display: flex; gap: 15px; margin-top: 1.5rem; }
.social-icons a { color: var(--secondary-text); font-size: 1.2rem; }
.social-icons a:hover { color: var(--popover-text); }

.popover-footer { border-top: 1px solid var(--popover-border); padding: 1.5rem 2rem; display: flex; gap: 2.5rem; background: rgba(128,128,128,0.03); border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.popover-footer a { color: var(--secondary-text); font-size: 0.9rem; font-weight: 500; }
.popover-footer a:hover { color: var(--popover-text); }

/* =========================================
   STATIC TOP TOGGLE 
========================================= */
.toggle-container { display: flex; justify-content: center; padding: 1.5rem 0; }
.toggle-bg { background: rgba(128,128,128,0.2); border-radius: 30px; padding: 0.3rem; display: flex; }
.toggle-btn { border: none; background: transparent; padding: 0.6rem 2rem; border-radius: 25px; cursor: pointer; font-weight: bold; color: var(--secondary-text); }
.toggle-btn.active { 
    background: var(--toggle-active-bg); 
    color: var(--toggle-active-text); 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* =========================================
   GALLERY & FLOATING NAV
========================================= */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.2rem; padding: 1rem 1.5rem; max-width: 1400px; margin: 0 auto; }
.gallery-item { background: var(--card-bg); padding: 8px; border-radius: 16px; height: 380px; position: relative; cursor: pointer; border: 1px solid var(--border-color); }
.image-wrapper { position: relative; width: 100%; height: 100%; border-radius: 10px; overflow: hidden; }
.image-wrapper img, .image-wrapper video { width: 100%; height: 100%; object-fit: cover; }
.fav-btn { position: absolute; top: 12px; right: 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255,255,255,0.2); color: white; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; backdrop-filter: blur(5px); z-index: 10; transition: 0.2s; }
.fav-btn.liked { color: #ef4444; background: white; }

/* 5-Item Floating Nav */
.floating-nav { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: var(--nav-float-bg); padding: 8px 12px; border-radius: 50px; display: flex; gap: 5px; box-shadow: 0 15px 35px rgba(0,0,0,0.15); z-index: 1000; border: 1px solid var(--border-color); transition: background 0.3s; }
.nav-item { background: transparent; border: none; color: var(--nav-float-text); display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; padding: 10px 15px; border-radius: 30px; transition: 0.3s; min-width: 65px; }
.nav-item.active { background: var(--nav-float-active-bg); color: var(--nav-float-active-text); }
.nav-item i { font-size: 1.2rem; }
.nav-item span { font-size: 0.7rem; font-weight: 600; }

/* Pro Item Style */
.pro-item { color: #f59e0b; }
.pro-item i { background: linear-gradient(45deg, #fbbf24, #f59e0b); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* =========================================
   FULLSCREEN & MODALS
========================================= */
.fs-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; z-index: 3000; justify-content: center; align-items: center; flex-direction: column; }
.fs-modal.active { display: flex; }
.close-fs { position: absolute; top: 20px; left: 20px; font-size: 2.5rem; color: white; cursor: pointer; text-shadow: 0 2px 10px rgba(0,0,0,0.8); z-index: 3010; }
.fs-content { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
.fs-content img, .fs-content video { max-width: 100%; max-height: 100vh; object-fit: contain; }
.fs-action-bar { position: absolute; bottom: 40px; display: flex; gap: 24px; background: var(--surface-color); padding: 12px 28px; border-radius: 40px; box-shadow: 0 10px 40px rgba(0,0,0,0.4); border: 1px solid var(--border-color); z-index: 3010; opacity: 0.95; }
.fs-action-bar button { display: flex; flex-direction: column; align-items: center; gap: 6px; background: transparent; border: none; color: var(--primary-text); cursor: pointer; transition: 0.2s; min-width: 60px; }
.fs-action-bar button i { font-size: 1.3rem; }
.fs-action-bar button span { font-size: 0.7rem; font-weight: 600; opacity: 0.8; }
.fs-action-bar button:hover { color: #4ade80; transform: scale(1.05); }
.fs-action-bar button:hover span { opacity: 1; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 4000; justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: var(--surface-color); padding: 2rem; border-radius: 16px; width: 95%; max-width: 900px; position: relative; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.3); border-radius: 3px; }
.close-modal { position: absolute; top: 1rem; right: 1.5rem; font-size: 2rem; cursor: pointer; color: var(--secondary-text); z-index: 10; transition: 0.2s; line-height: 1; }
.close-modal:hover { color: var(--primary-text); }
.editor-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-top: 1.5rem; flex: 1; overflow: hidden; min-height: 0; }
.canvas-container { background: #000; display: flex; justify-content: center; align-items: center; border-radius: 8px; overflow: hidden; min-height: 0; }
canvas { max-width: 100%; max-height: 100%; object-fit: contain; }
.controls { display: flex; flex-direction: column; gap: 1rem; padding-right: 10px; }
.controls input[type="text"] { padding: 0.8rem; border: 1px solid var(--border-color); border-radius: 8px; background: rgba(128,128,128,0.1); color: var(--primary-text); }

/* =========================================
   MOBILE RESPONSIVENESS
========================================= */
@media (max-width: 768px) {
    .navbar { padding: 0.6rem 0.5rem; }
    .logo { font-size: 1.1rem; }
    .nav-left { gap: 0.4rem; }
    .nav-right { gap: 0.6rem; }
    
    .body-search-container { padding: 1rem 1rem 0.5rem; margin: 0; }
    .search-bar { padding: 0.6rem 1rem; max-width: 100%; }
    .search-bar input { padding: 0.2rem; font-size: 0.95rem; }
    .fav-top-btn { font-size: 1.2rem; }
    
    .category-scroll-container { justify-content: flex-start; padding: 0.5rem 1rem 1rem; }
    .category-pill { padding: 0.4rem 1rem; font-size: 0.85rem; }
    
    .popover-menu { left: 1rem; right: 1rem; width: auto; }
    .popover-grid { grid-template-columns: 1fr; padding: 2.5rem 1.5rem 1.5rem 1.5rem; gap: 1.5rem; }
    .popover-footer { flex-wrap: wrap; gap: 1rem; padding: 1rem 1.5rem; }

    .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 0.5rem; gap: 0.8rem; }
    .gallery-item { height: 260px; padding: 5px; border-radius: 12px; }
    
    .floating-nav { bottom: 20px; width: calc(100% - 32px); justify-content: space-between; padding: 8px 12px; }
    .nav-item { padding: 8px 5px; min-width: 55px; }
    .nav-item i { font-size: 1.1rem; }
    .nav-item span { font-size: 0.65rem; }

    .modal-content { padding: 3rem 1.2rem 1.5rem 1.2rem; }
    .close-modal { top: 0.8rem; right: 1.2rem; }
    .editor-layout { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.5rem; flex: 1; min-height: 0; }
    .canvas-container { min-height: 0; flex: 1; }
    .fs-action-bar { bottom: 20px; padding: 10px 20px; gap: 15px; }
}

/* HERO SECTION STYLES */
.hero-section {
    position: relative;
    width: calc(100% - 2rem);
    max-width: 1400px;
    height: 450px;
    margin: 1rem auto 2rem;
    border-radius: 12px;
    overflow: hidden;
    background: url('https://images.unsplash.com/photo-1518173946687-a4c8892bbd9f?auto=format&fit=crop&w=1600&q=80') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
    padding: 0 2rem;
}

.hero-content h1 {
    color: #ffffff;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.hero-top-pills {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.hero-top-pills::-webkit-scrollbar {
    display: none;
}

.hero-pill {
    background: transparent;
    color: #ffffff;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transition: background 0.3s, color 0.3s;
}

.hero-pill:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hero-pill.active {
    background: #ffffff;
    color: #111827;
    text-shadow: none;
}

.hero-content .body-search-container {
    position: relative;
    top: auto;
    padding: 0;
    margin: 0 auto;
    max-width: 800px;
}

.hero-content .search-bar {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.hero-content .search-bar input {
    background: transparent;
}

.hero-bottom-pills {
    justify-content: center;
    margin-top: 1rem;
}

.hero-bottom-pills .category-pill {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

.hero-bottom-pills .category-pill:hover {
    background: rgba(255, 255, 255, 0.3);
}

.hero-author-info {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: #ffffff;
}

.hero-author-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.hero-author-info .author-name {
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.hero-author-info .author-subtitle {
    font-size: 0.8rem;
    opacity: 0.8;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.hero-license-info {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2;
    color: #ffffff;
    font-size: 0.8rem;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.hero-license-info a {
    text-decoration: underline;
    font-weight: 600;
}

@media (max-width: 768px) {
    .hero-section {
        border-radius: 0;
        width: 100%;
        height: auto;
        padding: 3rem 0 1.5rem;
    }
    .hero-content {
        padding: 0 1rem;
    }
    .hero-content h1 {
        font-size: 1.35rem;
        margin-bottom: 0.8rem;
    }
    .hero-top-pills {
        display: none;
    }
    .hero-bottom-pills {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }
    .hero-author-info, .hero-license-info {
        display: none;
    }
}


