/* Discord-inspired ByteBees Theme */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force word wrapping for all text content */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

:root {
    /* Discord Color Palette */
    --discord-dark: #2c2f33;
    --discord-darker: #23272a;
    --discord-darkest: #1e2124;
    --discord-light: #36393f;
    --discord-lighter: #40444b;
    --discord-text: #dcddde;
    --discord-text-muted: #8e9297;
    --discord-accent: #7289da;
    --discord-accent-hover: #677bc4;
    --discord-success: #43b581;
    --discord-warning: #faa61a;
    --discord-error: #f04747;
    --discord-online: #43b581;

    /* ByteBees Brand Colors */
    --bee-yellow: #ffb000;
    --bee-orange: #ff8c00;
    --bee-black: #2d1810;

    /* Fonts */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Monaco', 'Consolas', 'Ubuntu Mono', 'Liberation Mono', monospace;

    /* Spacing */
    --sidebar-width: 240px;
    --header-height: 72px;
}

/* Body and Layout */
body {
    font-family: var(--font-primary);
    background-color: var(--discord-darkest);
    color: var(--discord-text);
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--discord-darker);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid var(--discord-dark);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--discord-dark);
    margin-bottom: 16px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--discord-text);
    font-weight: 600;
    font-size: 18px;
    transition: all 0.2s ease;
}

.logo:hover {
    color: var(--bee-yellow);
}

.logo-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.logo:hover .logo-image {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Legacy support for emoji icon */
.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--bee-yellow), var(--bee-orange));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
}

.nav-section {
    padding: 0 8px;
}

.nav-header {
    color: var(--discord-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 24px 8px 8px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin: 2px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 8px;
    color: var(--discord-text-muted);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.15s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--discord-light);
    color: var(--discord-text);
}

.nav-item.active .nav-link {
    background-color: var(--discord-accent);
    color: white;
}

.nav-icon {
    width: 20px;
    color: var(--discord-text-muted);
    margin-right: 8px;
    font-weight: 600;
}

.nav-item.active .nav-icon {
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background-color: var(--discord-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

/* Content Header */
.content-header {
    background-color: var(--discord-light);
    border-bottom: 1px solid var(--discord-dark);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--discord-text);
    display: flex;
    align-items: center;
    margin: 0;
}

.title-hash {
    color: var(--discord-text-muted);
    margin-right: 8px;
    font-weight: 400;
}

.page-description {
    color: var(--discord-text-muted);
    margin: 4px 0 0;
    font-size: 14px;
}

.page-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.meta-item {
    display: flex;
    align-items: center;
    color: var(--discord-text-muted);
    font-size: 14px;
    background-color: var(--discord-dark);
    padding: 6px 12px;
    border-radius: 12px;
}

.meta-icon {
    margin-right: 6px;
}

/* Content Body */
.content-body {
    flex: 1;
    padding: 24px;
    max-width: none;
    width: 100%;
    overflow-x: hidden;
}

.message-container {
    background-color: var(--discord-dark);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.message-content {
    padding: 24px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    box-sizing: border-box;
}

/* Typography */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    color: var(--discord-text);
    margin: 24px 0 16px;
    font-weight: 600;
}

.message-content h1 {
    font-size: 2em;
    border-bottom: 2px solid var(--discord-accent);
    padding-bottom: 8px;
}

.message-content h2 {
    font-size: 1.5em;
    color: var(--bee-yellow);
}

.message-content h3 {
    font-size: 1.25em;
}

.message-content p {
    margin: 16px 0;
    line-height: 1.6;
    max-width: 100%;
}

.message-content ul,
.message-content ol {
    margin: 16px 0;
    padding-left: 24px;
    max-width: 100%;
}

.message-content li {
    margin: 8px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-content a {
    color: var(--discord-accent);
    text-decoration: none;
}

.message-content a:hover {
    color: var(--discord-accent-hover);
    text-decoration: underline;
}

/* Code Blocks */
.message-content code {
    background-color: var(--discord-darkest);
    color: var(--bee-yellow);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    font-feature-settings: "liga" 1, "calt" 1; /* Enable ligatures for Fira Code */
}

.message-content pre {
    background-color: var(--discord-darkest);
    border: 1px solid var(--discord-darker);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: var(--discord-text);
    font-family: var(--font-mono);
    font-feature-settings: "liga" 1, "calt" 1; /* Enable ligatures for Fira Code */
}

/* Blockquotes */
.message-content blockquote {
    border-left: 4px solid var(--discord-accent);
    background-color: var(--discord-darker);
    padding: 16px 20px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

/* Tables */
.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background-color: var(--discord-darker);
    border-radius: 8px;
    overflow: hidden;
}

.message-content th,
.message-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--discord-dark);
}

.message-content th {
    background-color: var(--discord-darkest);
    font-weight: 600;
    color: var(--bee-yellow);
}

/* Responsive Media Elements */
.message-content img,
.message-content video,
.message-content iframe {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.message-content pre {
    overflow-x: auto;
    max-width: 100%;
    word-wrap: normal;
    overflow-wrap: normal;
    word-break: normal;
}

/* Force text wrapping for specific elements */
.message-content strong,
.message-content em,
.message-content span,
.message-content div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Footer */
.content-footer {
    background-color: var(--discord-darker);
    border-top: 1px solid var(--discord-dark);
    margin-top: auto;
    padding: 32px 24px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    max-width: 800px;
}

.footer-section h3,
.footer-section h4 {
    color: var(--bee-yellow);
    margin-bottom: 12px;
    font-weight: 600;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin: 8px 0;
}

.footer-links a {
    color: var(--discord-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--discord-text);
}

.footer-bottom {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--discord-dark);
    text-align: center;
    color: var(--discord-text-muted);
    font-size: 14px;
}

/* Large screen optimizations */
@media (min-width: 1440px) {
    .main-content {
        max-width: calc(100vw - var(--sidebar-width));
    }

    .content-body {
        max-width: 1200px;
        margin: 0 auto;
        padding: 32px 24px;
    }

    .message-container {
        max-width: 100%;
        margin: 0 auto;
    }
}

/* Mobile Menu Button */
.mobile-menu-button {
    display: none;
    background: var(--discord-dark);
    border: 1px solid var(--discord-lighter);
    color: var(--discord-text);
    font-size: 18px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-button:hover {
    background-color: var(--discord-lighter);
    border-color: var(--discord-accent);
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

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

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 100;
    }

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

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        position: relative;
        box-sizing: border-box;
    }

    .content-header {
        padding: 8px 12px;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .header-info {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .page-title {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .logo-image {
        width: 28px;
        height: 28px;
    }

    .page-meta {
        display: none;
    }

    .content-body {
        padding: 12px 8px;
        min-height: calc(100vh - 120px);
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .message-content {
        padding: 12px;
        overflow-x: hidden;
        word-break: break-word;
        hyphens: auto;
        font-size: 14px;
        line-height: 1.5;
    }

    /* Make images responsive */
    .message-content img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    /* Responsive video embeds */
    .message-content iframe,
    .message-content video {
        max-width: 100%;
        height: auto;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Typography adjustments for mobile */
    .message-content h1 {
        font-size: 1.5em;
        word-wrap: break-word;
        hyphens: auto;
        margin: 16px 0 12px;
    }

    .message-content h2 {
        font-size: 1.3em;
        word-wrap: break-word;
        hyphens: auto;
        margin: 14px 0 10px;
    }

    .message-content h3 {
        font-size: 1.15em;
        word-wrap: break-word;
        hyphens: auto;
        margin: 12px 0 8px;
    }

    .message-content p {
        margin: 12px 0;
        word-wrap: break-word;
        hyphens: auto;
    }

    /* Table responsiveness */
    .message-content table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .message-content th,
    .message-content td {
        padding: 8px 12px;
        min-width: 120px;
    }
}

/* Tablet adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .main-content {
        width: calc(100% - var(--sidebar-width));
        max-width: 100%;
        overflow-x: hidden;
    }

    .content-body {
        padding: 20px 16px;
        max-width: 100%;
    }

    .message-content {
        padding: 20px;
        max-width: none;
    }

    .message-container {
        margin: 0 auto;
        max-width: 100%;
    }

    .page-meta {
        gap: 12px;
    }

    .meta-item {
        font-size: 13px;
        padding: 4px 10px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    :root {
        --sidebar-width: 280px;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        max-width: 100vw;
        min-width: 0;
        overflow-x: hidden;
    }

    .content-header {
        padding: 8px 12px;
        min-height: 60px;
    }

    .page-title {
        font-size: 18px;
    }

    .content-body {
        padding: 8px 6px;
        min-height: calc(100vh - 100px);
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .message-content {
        padding: 10px;
        font-size: 13px;
        line-height: 1.4;
        word-break: break-word;
        hyphens: auto;
    }

    .message-container {
        border-radius: 6px;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .message-content h1 {
        font-size: 1.5em;
    }

    .message-content h2 {
        font-size: 1.3em;
    }

    .message-content pre {
        padding: 12px;
        overflow-x: auto;
    }

    .message-content code {
        font-size: 0.85em;
    }

    /* Stack footer items vertically on very small screens */
    .footer-content {
        gap: 16px;
    }
}

/* Extra small mobile devices (iPhone 14 Pro Max etc) */
@media (max-width: 430px) {
    .content-header {
        padding: 6px 8px;
        min-height: 50px;
    }

    .mobile-menu-button {
        font-size: 16px;
        padding: 6px 8px;
        min-width: 36px;
        height: 36px;
    }

    .page-title {
        font-size: 16px;
    }

    .content-body {
        padding: 6px 4px;
    }

    .message-content {
        padding: 8px;
        font-size: 12px;
        line-height: 1.3;
    }

    .message-content h1 {
        font-size: 1.3em;
        margin: 12px 0 8px;
    }

    .message-content h2 {
        font-size: 1.2em;
        margin: 10px 0 6px;
    }

    .message-content h3 {
        font-size: 1.1em;
        margin: 8px 0 4px;
    }

    .message-content p {
        margin: 8px 0;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--discord-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--discord-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--discord-lighter);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-container {
    animation: fadeIn 0.3s ease;
}

/* Selection */
::selection {
    background-color: var(--discord-accent);
    color: white;
}