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

:root {
    --primary-color: #1E90FF;
    --primary-dark: #1873cc;
    --secondary-color: #f0f0f0;
    --text-primary: #1f2937;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --bg-light: #ffffff;
    --bg-dark: #f9f9f9;
    --header-bg: #000000;
    --header-text: #ffffff;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --sidebar-width: 260px;
    --transition: all 0.3s ease;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Main Content Wrapper */
.main-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--header-text);
}

.logo-icon {
    font-size: 24px;
}

/* New Chat Button */
.new-chat-btn {
    margin: 15px;
    padding: 12px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex;
    gap: 0;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px 8px;
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-btn .icon {
    font-size: 16px;
}

.tab-btn .text {
    font-size: 11px;
    font-weight: 500;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Chat History */
.chat-history {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.chat-history h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 0 5px;
}

#chatHistoryList {
    list-style: none;
}

.chat-history-item {
    padding: 10px 12px;
    margin-bottom: 8px;
    background-color: var(--bg-light);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-history-item:hover {
    background-color: var(--secondary-color);
}

.chat-history-item.active {
    background-color: var(--primary-color);
    color: white;
}

.chat-history-empty {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.chat-history-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-history-item-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Stories List */
.stories-list {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.stories-list h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding: 0 5px;
}

#storiesList {
    list-style: none;
}

.story-item {
    padding: 12px;
    margin-bottom: 10px;
    background-color: var(--bg-light);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    transition: var(--transition);
    border-left: 3px solid var(--primary-color);
}

.story-item:hover {
    background-color: var(--secondary-color);
    transform: translateX(4px);
}

.story-item-title {
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-item-excerpt {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-item-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stories-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.stories-error {
    padding: 15px;
    background-color: #fee;
    border-radius: 6px;
    color: var(--error-color);
    font-size: 12px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

.settings-btn {
    width: 100%;
    padding: 10px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.settings-btn:hover {
    background-color: var(--secondary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }

    .nav-actions {
        display: none;
    }

    .main-wrapper {
        position: relative;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        height: calc(100vh - 60px);
        width: var(--sidebar-width);
        z-index: 999;
        transform: translateX(-100%);
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
        transition: transform 0.3s ease;
        background-color: var(--bg-light);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .chat-container {
        flex: 1;
    }

    /* Add overlay when sidebar is open */
    .main-wrapper::before {
        content: '';
        position: fixed;
        left: 0;
        top: 60px;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: rgba(0, 0, 0, 0);
        z-index: 998;
        pointer-events: none;
        transition: background-color 0.3s ease;
    }

    .main-wrapper.sidebar-open::before {
        background-color: rgba(0, 0, 0, 0.5);
        pointer-events: auto;
    }
}

@media (max-width: 480px) {
    .nav-logo-text {
        font-size: 16px;
    }

    .nav-logo-icon {
        font-size: 24px;
    }

    .sidebar {
        width: 100%;
        max-width: 280px;
    }

    .nav-container {
        padding: 0 15px;
    }
}

