/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #020817;
    background-color: #ffffff;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   MOBILE OVERLAY
   ============================================ */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.mobile-overlay.hidden {
    display: none;
}

/* ============================================
   SIDEBAR - DESKTOP
   ============================================ */
.sidebar-desktop {
    position: relative;
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    height: 100vh;
}

.sidebar-desktop.collapsed {
    width: 72px;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: absolute;
    right: -16px;
    top: 18px;
    width: 32px;
    height: 32px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.sidebar-toggle-btn:hover {
    background-color: #eff6ff;
}

.sidebar-toggle-icon {
    width: 16px;
    height: 16px;
    color: #4b5563;
}

@media (max-width: 767px) {
    .sidebar-toggle-btn {
        display: none;
    }
}

/* Sidebar Header */
.sidebar-header {
    padding-top: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    height: 63px;
}

.sidebar-logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 32px;
    justify-content: flex-start;
    line-height: 1;
}

.sidebar-desktop.collapsed .sidebar-logo-container {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

.sidebar-logo-img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 600;
}

/* Brand gradient - same as index.php */
.text-brand-gradient {
    background: linear-gradient(to right, rgba(0, 176, 239, 1), rgba(0, 88, 204, 1));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.sidebar-desktop.collapsed .sidebar-logo-text {
    display: none;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-content {
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Navigation Items */
.nav-item-wrapper {
    padding: 0 16px;
}

.nav-item-wrapper-collapsed {
    width: 100%;
    padding: 0 8px;
}

/* Navigation Buttons */
.nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 14px;
    border: none;
    background: transparent;
    color: rgb(113, 121, 133);
}

.nav-btn:hover {
    background-color: #f0f9ff;
    color: #020817;
}

.nav-btn-outline {
    border: 1px solid #d1d5db;
    background-color: transparent;
    justify-content: center;
    height: 40px;
    margin-bottom: 4px;
}

.nav-btn-active {
    background-color: #f0f9ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.nav-btn-active .nav-icon {
    color: #2563eb;
}

.nav-btn-ghost {
    justify-content: flex-start;
    align-items: center;
    height: 40px;
}

.nav-btn-between {
    justify-content: space-between;
}

.nav-btn-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-btn-collapsed {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
    color: rgb(113, 121, 133);
    height: 40px;
}

.nav-btn-collapsed:hover {
    background-color: #f0f9ff;
    color: #020817;
}

.nav-btn-collapsed-outline {
    border: 1px solid #d1d5db;
    background-color: transparent;
    margin-bottom: 4px;
}

.nav-search-btn {
    width: 32px;
    height: 32px;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-search-btn:hover {
    background-color: rgba(229, 231, 235, 0.5);
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: inherit;
}

.nav-text {
    flex: 1;
    text-align: left;
}

.nav-chevron {
    transition: transform 0.2s;
    transform: rotate(0deg);
}

/* Navigation Divider */
.nav-divider {
    margin: 12px 0;
    border-top: 1px solid #D0E0FF;
}

/* Navigation Submenu */
.nav-submenu {
    margin-left: 24px;
    margin-top: 4px;
    position: relative;
    padding-left: 8px;
    display: none;
}

.nav-submenu.expanded {
    display: block;
}

.nav-submenu::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e5e7eb;
}

.nav-submenu-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-submenu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-submenu-item:hover {
    background-color: #f9fafb;
}

.nav-submenu-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #e5e7eb;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.nav-submenu-text {
    font-size: 14px;
    color: rgb(113, 121, 133);
    flex: 1;
    text-align: left;
}

.nav-item-wrapper-pinned {
    margin-top: 16px;
}

/* Projects List */
.nav-projects-list {
    position: relative;
    margin-left: 24px;
    margin-top: 4px;
    padding-left: 8px;
}

.nav-projects-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #e5e7eb;
}

.nav-projects-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-project-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-project-item:hover {
    background-color: #f9fafb;
}

.nav-project-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #6b7280;
}

.nav-project-text {
    font-size: 14px;
    color: rgb(113, 121, 133);
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Collapsed Sidebar Styles */
.sidebar-desktop.collapsed .sidebar-expanded-content {
    display: none !important;
}

/* Ensure collapsed content is visible when sidebar is collapsed */
.sidebar-desktop.collapsed .sidebar-collapsed-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding-bottom: 1rem !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
}

.sidebar-desktop.collapsed .sidebar-collapsed-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding-bottom: 1rem !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
}

.sidebar-desktop:not(.collapsed) .sidebar-collapsed-content {
    display: none !important;
}

/* ============================================
   SIDEBAR - MOBILE
   ============================================ */
.sidebar-mobile {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 260px;
}

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

@media (min-width: 768px) {
    .sidebar-mobile {
        display: none;
    }
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px 11px 23px;
    border-bottom: 1px solid #e5e7eb;
    background-color: #ffffff;
    min-height: 63px;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-start;
}

/* Hide mobile logo container on desktop by default */
.mobile-logo-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

.mobile-logo-img,
.mobile-logo-text {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure it's hidden on desktop */
@media (min-width: 768px) {
    .mobile-logo-container,
    .mobile-logo-img,
    .mobile-logo-text {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }
}

.mobile-menu-btn {
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    display: none;
}

.mobile-menu-btn:hover {
    background-color: #f3f4f6;
}

@media (max-width: 767px) {
    .mobile-menu-btn {
        display: block;
    }
}

.llm-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.llm-selector-btn:hover {
    background-color: #f3f4f6;
}

.llm-icon {
    height: 16px;
    width: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.llm-name {
    color: #595959;
    font-size: 14px;
    display: none;
    white-space: nowrap;
}

.llm-chevron {
    width: 16px;
    height: 16px;
    color: #4b5563;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .llm-name {
        display: inline;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.notification-wrapper {
    position: relative;
}

.notification-btn {
    position: relative;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-btn:hover {
    background-color: #f0f9ff;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background-color: #ef4444;
    color: #ffffff;
    font-size: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    z-index: 10;
    border: 2px solid #ffffff;
}

.notification-badge.hidden {
    display: none;
}

.user-menu-wrapper {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 8px;
    transition: background-color 0.2s;
    border: none;
    background: transparent;
    cursor: pointer;
}

.user-menu-btn:hover {
    background-color: #f9fafb;
}

.user-avatar {
    height: 32px;
    width: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content-area {
    flex: 1;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background-color: #ffffff;
    min-height: 0;
}

.main-content-area::before,
.main-content-area::after {
    display: none !important;
    content: none !important;
}

/* Ensure no logos or images appear in main content */
.main-content-area img,
.main-content-area [src*="67acd1"],
.main-content-area [src*="logo"],
.main-content-area [alt*="logo"],
.main-content-area [alt*="Logo"],
.main-content-area [id*="empty-state"],
.main-content-area [id*="chat-container"],
.main-content-area [class*="chat-interface"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Hide chat-interface component completely */
[class*="chat-interface"],
[id*="chat-container"],
[id*="empty-state"] {
    display: none !important;
    visibility: hidden !important;
}

@media (min-width: 768px) {
    .main-content-area {
        align-items: stretch;
    }
}

/* ============================================
   FOOTER
   ============================================ */
.main-footer {
    border-top: 1px solid #e5e7eb;
    padding: 0 24px;
    margin-top: auto;
    background-color: #ffffff;
    margin-left: 0;
    margin-right: 0;
    padding-top: 14px;
    padding-bottom: 14px;
}

@media (max-width: 767px) {
    .main-footer {
        display: none;
    }
}

.footer-content {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #6b7280;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.footer-link {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-link:hover {
    color: #374151;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-logo {
    width: 48px;
    height: 16px;
    object-fit: contain;
    margin-bottom: 4px;
}
