/* Modern StudyNet AI Guest Page Styles - Fixed Table Width Issue */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F5F5F7;
    color: #1A1A1A;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Color Scheme */
:root {
    --primary: #8B3A62;
    --primary-hover: #9D4470;
    --background: #F5F5F7;
    --sidebar-background: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #6B6B6B;
    --border: #E5E5E5;
}

/* Left Sidebar */
.sidebar {
    width: 240px;
    background: var(--sidebar-background);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 20px);
    position: fixed;
    left: 10px;
    top: 10px;
    z-index: 100;
    padding: 24px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    margin-bottom: 32px;
}

.brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: left;
}

.new-chat-btn {
    width: 100%;
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
}

.new-chat-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 58, 98, 0.4);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.chats-section {
    margin-bottom: 24px;
}

.chats-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: none;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.chat-item:hover {
    background: #F5F5F7;
}

.chat-item.search-chat {
    color: var(--text-secondary);
    font-style: italic;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-btn {
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-align: left;
}

.settings-btn:hover {
    background: #F5F5F7;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--background);
    position: relative;
    overflow-x: hidden;
}

.main-header {
    position: absolute;
    top: 24px;
    left: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.plan-badge {
    background: #FFFFFF;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--border);
}

.query-counter-badge {
    background: #38a169;
    color: #ffffff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(56, 161, 105, 0.2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-btn {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    transition: all 0.2s ease;
}

.login-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--text-primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.signup-btn {
    background: var(--primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.signup-btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
    transition: all 0.3s ease;
}

/* Center Content */
.center-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120px 24px 24px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-title {
    font-size: 48px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.2;
    text-align: center;
    animation: slideInLeft 1.2s ease-out 0.3s both;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.main-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 48px;
    line-height: 1.5;
    text-align: center;
    animation: popUp 1.2s ease-out 0.6s both;
}

@keyframes popUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Search Box */
.search-box-container {
    width: 100%;
    max-width: 720px;
    margin-bottom: 32px;
    animation: fadeInUp 1.5s ease-out 0.9s both;
}

.search-box {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(229, 229, 229, 0.3);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(139, 58, 98, 0.2), 0 0 0 3px rgba(139, 58, 98, 0.1);
    transform: translateY(-2px);
}

.search-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: 16px;
    pointer-events: none;
    z-index: 1;
}

.search-box textarea {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
    padding: 16px 20px;
    resize: none;
    min-height: 60px;
    line-height: 1.6;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 2;
}

.search-box textarea::placeholder {
    color: var(--text-secondary);
}

.search-actions {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.spacer {
    flex: 1;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
    font-size: 16px;
}

.send-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 58, 98, 0.5);
    transition: all 0.3s ease;
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Quick Links */
.quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    max-width: 900px;
    width: 100%;
}

.quick-link {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quick-link:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
}

.quick-link i {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.quick-link:hover i {
    color: #ffffff;
}

/* Main Footer */
.main-footer {
    position: absolute;
    bottom: 24px;
    right: 24px;
    padding: 24px;
}

/* Chat Interface */
.chat-interface {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 15px);
    margin-top: 20px;
    overflow-x: hidden;
}

.chat-messages {
    flex: 1;
    padding: 24px 0 120px 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 85vh;
    max-height: 85vh;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 58, 98, 0.3) transparent;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Message Input Area */
.message-input-area {
    padding: 16px 24px 32px 24px;
    background: transparent;
    position: sticky;
    bottom: 0;
    z-index: 100;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(229, 229, 229, 0.4);
    border-radius: 16px;
    padding: 16px 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    max-width: 800px;
    margin: 0 auto;
}

.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(139, 58, 98, 0.15), 0 0 0 3px rgba(139, 58, 98, 0.1);
    transform: translateY(-1px);
}

#messageInput {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

#messageInput::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
    font-size: 16px;
}

.chat-send-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 58, 98, 0.4);
}

.chat-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Message Styling */
.message {
    margin-bottom: 24px;
    display: flex;
    animation: messageSlideIn 0.3s ease;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 24px;
    overflow-x: hidden;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.message.user .message-content {
    align-items: flex-end;
    max-width: 65%;
}

.message.assistant .message-content {
    align-items: flex-start;
    max-width: 100%;
}

.message-bubble {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    word-wrap: break-word;
    transition: all 0.2s ease;
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
}

.message.user .message-bubble {
    background: rgba(156, 31, 99) !important;
    color: #ffffff !important;
    border-color: rgba(156, 31, 99, 0.5);
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

.message.user .message-bubble,
.message.user .message-bubble * {
    color: #ffffff !important;
}

/* Message animations */
.message {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.message.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.message.user.fade-in {
    animation: slideInFromRight 0.5s ease-out;
}

.message.assistant.fade-in {
    animation: slideInFromLeft 0.5s ease-out;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Typing indicator animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    margin: 0 auto;
    min-height: 52px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.typing-bubble {
    transition: all 0.3s ease;
    overflow: hidden;
}

.typing-bubble .typing-indicator {
    transition: all 0.3s ease;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* New Message Indicator */
.new-message-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(139, 58, 98, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    animation: slideInUp 0.3s ease-out;
    transition: all 0.3s ease;
}

.new-message-indicator:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(139, 58, 98, 0.4);
}

.new-message-indicator i {
    font-size: 12px;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Rainbow Button */
.rainbow-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 32px;
    font-weight: 500;
    font-size: 14px;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    background: linear-gradient(90deg, #8B3A62, #9D4470, #B85A8A, #8B3A62, #9D4470);
    background-size: 200% 100%;
    animation: rainbow 2s infinite linear;
    box-shadow: 0 4px 15px rgba(139, 58, 98, 0.3);
    text-decoration: none;
}

.rainbow-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 58, 98, 0.4);
}

.rainbow-button:active {
    transform: translateY(0);
}

.rainbow-button::before {
    content: '';
    position: absolute;
    bottom: -20%;
    left: 50%;
    z-index: -1;
    height: 20%;
    width: 60%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #8B3A62, #9D4470, #B85A8A, #8B3A62, #9D4470);
    background-size: 200% 100%;
    animation: rainbow 2s infinite linear;
    filter: blur(12px);
    opacity: 0.6;
}

.rainbow-button i {
    margin-right: 8px;
    font-size: 12px;
}

@keyframes rainbow {
    0% {
        background-position: 0%;
    }
    100% {
        background-position: 200%;
    }
}

.message.assistant .message-bubble {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e5e5e5;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-sources {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 12px;
    color: #0369a1;
}

.message-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    text-align: center;
    color: var(--primary);
}

.loading-spinner i {
    font-size: 32px;
    margin-bottom: 16px;
    animation: spin 1s linear infinite;
}

.loading-spinner p {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Token Limit Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    font-size: 48px;
    color: #ef4444;
    margin-bottom: 16px;
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.modal-content p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.modal-btn.primary {
    background: var(--primary);
    color: white;
}

.modal-btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.modal-btn.secondary {
    background: #f3f4f6;
    color: var(--text-primary);
}

.modal-btn.secondary:hover {
    background: #e5e7eb;
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Table Styling - FIXED: Prevents tables from expanding conversation width */
.table-container {
    overflow-x: auto;
    overflow-y: visible;
    margin: 16px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    width: 100%;
    display: block;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
    table-layout: auto;
    display: table;
}

.data-table th {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    font-weight: 600;
    padding: 16px 20px;
    text-align: left;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th:first-child {
    border-top-left-radius: 12px;
}

.data-table th:last-child {
    border-top-right-radius: 12px;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
    transition: all 0.2s ease;
    position: relative;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 300px;
}

/* Keep specific columns nowrap */
.data-table td:first-child {
    white-space: nowrap;
}

.data-table tr:hover td {
    background: #f8fafc;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.data-table a:hover {
    background: #dbeafe;
    color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.data-table a::after {
    content: "↗";
    font-size: 10px;
    opacity: 0.7;
}

.markdown-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
    margin: 16px 0;
    display: table;
}

.markdown-table th,
.markdown-table td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
}

.markdown-table th {
    background: #f8f9fa;
    font-weight: 600;
    white-space: nowrap;
}

.markdown-table tr:nth-child(even) {
    background: #f9fafb;
}

/* Chunked Messages */
.chunked-message {
    margin-bottom: 8px;
}

.chunked-message.first-chunk {
    margin-top: 16px;
}

.chunked-message.last-chunk {
    margin-bottom: 24px;
}

.chunked-message:not(.last-chunk) .message-meta {
    display: none;
}

.chunked-message .message-bubble {
    border-radius: 16px;
}

.chunked-message:not(.first-chunk) .message-bubble {
    border-top-left-radius: 4px;
}

.chunked-message:not(.last-chunk) .message-bubble {
    border-bottom-left-radius: 4px;
}

/* Suggested Actions */
.suggested-actions {
    display: none !important;
}

.actions-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.action-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.1);
}

.action-btn i {
    color: var(--primary);
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* "You might also want to know" Section Styling */
.you-might-know-section {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.you-might-know-header {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.you-might-know-header i {
    color: #fbbf24;
    font-size: 14px;
}

.you-might-know-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.you-might-know-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
    cursor: default;
}

.you-might-know-item::before {
    display: none;
}

.you-might-know-item.clickable {
    cursor: pointer;
}

.you-might-know-item.clickable:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 58, 98, 0.1);
}

.you-might-know-item i {
    color: var(--primary);
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.you-might-know-item.non-clickable i {
    color: var(--text-secondary);
}

.you-might-know-item.non-clickable {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

/* Modern Content Styling */
.content-p {
    margin: 0 0 16px 0;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 15px;
}

.content-h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 12px 0;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-strong {
    font-weight: 600;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.content-em {
    font-style: italic;
    color: var(--text-secondary);
}

.content-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.content-link:hover {
    background: #dbeafe;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.content-link::after {
    content: "↗";
    font-size: 12px;
    opacity: 0.7;
}

.content-list {
    margin: 16px 0;
    padding-left: 0;
    list-style: none;
}

.content-li {
    margin: 8px 0;
    padding: 8px 16px;
    background: #f8fafc;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    position: relative;
    transition: all 0.2s ease;
}

.content-li:hover {
    background: #f1f5f9;
    transform: translateX(4px);
}

.content-li::before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 8px;
}

.content-hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 24px 0;
}

.code-block {
    background: #1f2937;
    border-radius: 12px;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.code-block pre {
    margin: 0;
    padding: 20px;
    overflow-x: auto;
}

.code-block code {
    color: #f9fafb;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.inline-code {
    background: #f1f5f9;
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.mobile-menu-header {
    margin-bottom: 32px;
}

.mobile-menu-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.mobile-menu-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: #f5f5f7;
    color: var(--text-primary);
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mobile-login-btn,
.mobile-signup-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mobile-login-btn {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}

.mobile-login-btn:hover {
    background: #f8f9fa;
    border-color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-signup-btn {
    background: var(--primary);
    color: white;
}

.mobile-signup-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 58, 98, 0.4);
}

/* Desktop-only elements */
.desktop-only {
    display: block;
}

/* Mobile Header Branding */
.mobile-header-branding {
    display: none;
}

.mobile-brand {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content {
        margin-left: 260px;
    }
    
    .main-title {
        font-size: 40px;
    }
    
    .quick-links {
        flex-direction: column;
        align-items: center;
    }
    
    .quick-link {
        width: 100%;
        max-width: 400px;
    }
}

/* Tablet View (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .desktop-only {
        display: block;
    }
    
    .mobile-header-branding {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 12px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
    }
    
    .mobile-menu-toggle:hover {
        background: var(--primary-hover);
    }
    
    .main-header {
        top: 16px;
        left: 16px;
        right: 16px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .header-actions {
        display: flex;
        align-items: center;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    /* Hide desktop elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile elements */
    .mobile-header-branding {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        left: 0;
        top: 0;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-title {
        font-size: 32px;
    }
    
    .main-subtitle {
        font-size: 16px;
    }
    
    .main-header {
        top: 16px;
        left: 16px;
        right: 16px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .header-left {
        display: none;
    }

    .header-actions {
        display: none;
    }
    
    .main-footer {
        bottom: 16px;
        right: 16px;
    }
    
    .center-content {
        padding: 24px 16px;
        padding-bottom: 120px;
    }
    
    .search-box-container {
        margin-bottom: 24px;
    }
    
    .quick-links {
        gap: 8px;
    }
    
    .quick-link {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        background: var(--primary);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 12px;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(139, 58, 98, 0.3);
    }
    
    .mobile-menu-toggle:hover {
        background: var(--primary-hover);
    }
    
    /* Mobile Chat Interface */
    .chat-interface {
        height: calc(100vh - 80px);
        margin-top: 0;
    }
    
    .chat-messages {
        padding: 16px 16px 100px 16px;
        max-width: 100%;
        margin: 0;
    }
    
    /* Mobile Message Styling */
    .message {
        padding: 0 16px;
        max-width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .message.assistant .message-content {
        max-width: 100%;
    }
    
    /* Mobile Message Input Area - Fixed to Bottom */
    .message-input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: transparent;
        z-index: 1000;
    }
    
    .input-container {
        max-width: 100%;
        margin: 0;
        border-radius: 24px;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid var(--border);
    }
    
    .input-container:focus-within {
        background: white;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(139, 58, 98, 0.1);
    }
    
    #messageInput {
        font-size: 16px;
        padding: 8px 0;
    }
    
    .chat-send-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
    }
    
    /* Mobile Search Box - Bottom Style */
    .search-box-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: transparent;
        z-index: 1000;
        margin-bottom: 0;
    }
    
    .search-box {
        border-radius: 24px;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid var(--border);
        min-height: auto;
        flex-direction: row;
        align-items: center;
    }
    
    .search-box:focus-within {
        background: white;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(139, 58, 98, 0.1);
    }
    
    .search-box textarea {
        font-size: 16px;
        padding: 8px 0;
        min-height: auto;
    }
    
    .search-actions {
        padding: 0;
        margin-left: 12px;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
    }
    
    /* Mobile-specific optimizations */
    .main-title {
        font-size: 28px;
        line-height: 1.2;
    }
    
    .main-subtitle {
        font-size: 14px;
        margin-bottom: 32px;
    }
    
    .center-content {
        padding-top: 80px;
    }
    
    .message-bubble {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    /* Mobile quick links */
    .quick-links {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .quick-link {
        width: 100%;
        text-align: left;
        justify-content: flex-start;
    }
    
    /* Mobile table fixes */
    .table-container {
        margin-top: 12px;
        margin-bottom: 12px;
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 10px;
        max-width: calc(100% + 32px);
        border-radius: 0;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .suggested-actions {
        margin-top: 12px;
        padding: 12px;
    }
    
    .action-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .content-h1 {
        font-size: 20px;
        margin: 16px 0 12px 0;
    }
    
    .content-h2 {
        font-size: 18px;
        margin: 16px 0 10px 0;
        padding: 10px 12px;
    }
    
    .content-h3 {
        font-size: 16px;
        margin: 12px 0 6px 0;
    }
    
    .content-p {
        font-size: 14px;
        margin: 0 0 12px 0;
    }
    
    .content-li {
        padding: 6px 12px;
        margin: 6px 0;
    }
    
    /* Mobile "You might also want to know" section */
    .you-might-know-section {
        margin-top: 16px;
        padding: 12px;
    }
    
    .you-might-know-item {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .you-might-know-item i {
        font-size: 12px;
        width: 14px;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 28px;
    }
    
    .main-subtitle {
        font-size: 14px;
    }

    .search-box {
        min-height: 100px;
    }
    
    .search-box textarea {
        font-size: 14px;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
    }
    
    .quick-link {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .chat-messages {
        padding: 16px 12px 120px 12px;
        max-width: 100%;
    }
    
    .message {
        padding: 0 12px;
    }
    
    .input-container {
        max-width: 100%;
        margin: 0;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 58, 98, 0.3);
    border-radius: 3px;
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 58, 98, 0.5);
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(139, 58, 98, 0.2);
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 58, 98, 0.4);
}

/* Table container scrollbar */
.table-container::-webkit-scrollbar {
    
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(139, 58, 98, 0.4);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 58, 98, 0.6);
}