/*
Theme Name: ZenNav
Theme URI: https://example.com/zennav
Author: ZenNav Team
Author URI: https://example.com
Description: A clean, modern navigation theme with sidebar and AI search.
Version: 4.6
*/

/* =========================================
   1. Variables & Reset
   ========================================= */
:root {
    --primary-color: #2f80ed;
    --primary-light: #eaf2fd;
    --bg-color: #f4f6f8;
    --sidebar-bg: #ffffff;
    --text-main: #333333;
    --text-secondary: #666666;
    --border-color: #e1e4e8;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --transition-speed: 0.3s;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* =========================================
   2. Layout Structure
   ========================================= */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
}

.logo img {
    max-height: 40px;
    width: auto;
}

.sidebar.collapsed .logo span,
.sidebar.collapsed .logo img {
    display: none;
}

.toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-color);
    background: var(--primary-light);
    border-right: 3px solid var(--primary-color);
}

.nav-item i {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 10px 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
    width: calc(100% - var(--sidebar-width));
}

.sidebar.collapsed+.main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* Page Container - holds content-area and sidebar-right */
.page-container {
    display: flex;
    flex-direction: row;
    flex: 1;
    width: 100%;
}

/* Content Area - main content column */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Categories Wrapper */
.categories-wrapper {
    padding: 0 40px 40px;
}

/* Right Sidebar */
.sidebar-right {
    width: 300px;
    padding: 20px;
    background: var(--bg-color);
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.sidebar-right .widget {
    margin-bottom: 20px;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.sidebar-right .widget-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.sidebar-right ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-right ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.6;
}

.sidebar-right ul li:last-child {
    border-bottom: none;
}

.sidebar-right a {
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
    pointer-events: auto;
    display: inline-block;
    text-decoration: none;
    position: relative;
}

.sidebar-right a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Widget specific styles */
.sidebar-right .widget p {
    margin: 10px 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

.sidebar-right .widget select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 40px;
}

.search-container {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.search-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.search-tab {
    background: none;
    border: none;
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    padding-bottom: 8px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.search-tab.active {
    color: var(--text-main);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.search-tab.ai-tab.active {
    color: var(--primary-color);
}

.search-box {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 4px 25px rgba(47, 128, 237, 0.15);
}

#search-input {
    flex: 1;
    border: none;
    padding: 15px;
    font-size: 16px;
    outline: none;
    background: transparent;
}

.search-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.search-btn:hover {
    transform: scale(1.05);
}

/* AI Prompts */
.ai-prompts {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.prompt-chip {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

/* AI Result Area */
.ai-result-container {
    width: 100%;
    margin-top: 20px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    display: none;
    border: 1px solid var(--border-color);
}

.ai-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.ai-result-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-main);
    white-space: pre-wrap;
}

/* =========================================
   4. Content Area (Grid)
   ========================================= */
.category-section {
    margin-bottom: 40px;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.section-title i {
    color: var(--primary-color);
    width: 20px;
    height: 20px;
}

.view-more-btn {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}

.view-more-btn:hover {
    color: var(--primary-color);
}

/* Cards Grid */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.site-card {
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    box-shadow: var(--card-shadow);
    height: 80px;
}

.site-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--primary-light);
}

.site-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
}

.site-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.site-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-desc {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* =========================================
   5. Responsive Design
   ========================================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .page-container {
        flex-direction: column;
    }

    .mobile-menu-btn {
        display: block;
    }

    .categories-wrapper {
        padding: 0 20px 20px;
    }

    .sidebar-right {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    #sidebar-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .search-container {
        padding: 0 10px;
    }

    .sites-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .site-card {
        padding: 12px;
        height: auto;
        flex-direction: row;
        text-align: left;
        align-items: center;
    }

    .site-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 0;
        margin-right: 12px;
    }

    .site-info {
        width: auto;
        flex: 1;
    }

    .site-desc {
        display: block;
        font-size: 12px;
        margin-top: 2px;
    }

    .search-tabs {
        gap: 15px;
        overflow-x: auto;
        width: 100%;
        justify-content: flex-start;
        padding-bottom: 5px;
    }

    .search-tab {
        white-space: nowrap;
    }
}