/* Amazon Quick - Exact QuickSight color scheme */
:root {
    --global-navbar-bg: #262626;
    --global-navbar-fg: #FFFFFF;
    --contextual-navbar-bg: #FFFFFF;
    --contextual-navbar-fg: #000000;
    --primary-bg: #FFFFFF;
    --primary-fg: #000000;
    --secondary-bg: #F8F8FA;
    --accent-bg: #4200DB;
    --accent-fg: #FFFFFF;
    --visualization-bg: #6842FF;
    --connection-bg: #FF4B14;
    --automation-bg: #D600BA;
    --insight-bg: #78008A;
    --danger-bg: #C82745;
    --success-bg: #27700E;
    --warning-bg: #FF9800;
    --info-bg: #2196F3;
    --measure-fg: #CB7600;
    --dimension-fg: #1B84BF;
    --border-color: #E8E8E8;
    --text-primary: #16191f;
    --text-secondary: #545b64;
    --text-muted: #879596;
    --font-family: "Amazon Ember","Helvetica Neue","Segoe UI",Helvetica,Arial,sans-serif;
    --sidebar-width: 236px;
    --navbar-height: 44px;
    --chat-panel-width: 360px;
    /* QuickSight gradient: the animated rainbow border */
    --q-gradient: linear-gradient(to top right, #6842FF 0%, #D600BA 50%, #FF4B14 100%);
    --q-gradient-animated: linear-gradient(259.56deg, #FF4B14 0%, #D600BA 14%, #78008A 28%, #6842FF 42%, #FF4B14 56%, #D600BA 70%, #78008A 84%, #6842FF 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--secondary-bg);
    overflow: hidden;
    height: 100vh;
}

/* ===== Global Navbar ===== */
.global-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-height);
    background: var(--global-navbar-bg);
    color: var(--global-navbar-fg);
    padding: 0 8px;
    z-index: 100;
    position: fixed;
    top: 0; left: 0; right: 0;
}
.navbar-left { display: flex; align-items: center; gap: 6px; }
.explore-btn {
    display: flex; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.2);
    color: white; padding: 3px 10px; border-radius: 4px;
    font-size: 11px; cursor: pointer; font-family: var(--font-family);
    font-weight: 500;
}
.explore-btn:hover { background: rgba(255,255,255,0.15); }
.navbar-brand {
    display: flex; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 600; padding: 0 8px;
    border-left: 1px solid rgba(255,255,255,0.2);
    margin-left: 4px;
}
.navbar-page-title {
    font-size: 13px; font-weight: 400; opacity: 0.8;
    padding-left: 8px; border-left: 1px solid rgba(255,255,255,0.2);
    margin-left: 4px;
}
.navbar-center { flex: 1; }
.search-bar { display: none; }
.search-bar {
    display: flex; align-items: center;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 4px; padding: 4px 8px; gap: 6px;
}
.search-bar:focus-within { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.3); }
.search-bar input {
    background: none; border: none; color: white;
    font-size: 12px; width: 100%; outline: none; font-family: var(--font-family);
}
.search-bar input::placeholder { color: rgba(255,255,255,0.5); }
.search-bar svg { opacity: 0.5; flex-shrink: 0; }
.navbar-right { display: flex; align-items: center; gap: 4px; }
.navbar-account { font-size: 11px; opacity: 0.7; margin-right: 4px; }
.nav-icon-btn {
    background: none; border: none; color: white;
    cursor: pointer; padding: 6px; border-radius: 4px;
    display: flex; align-items: center;
}
.nav-icon-btn:hover { background: rgba(255,255,255,0.1); }

/* Q Chat button with gradient */
.q-chat-btn {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: linear-gradient(to top right, #6842FF 0%, #D600BA 50%, #FF4B14 100%);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: opacity 0.2s;
}
.q-chat-btn:hover { opacity: 0.85; }
.q-chat-btn.active { box-shadow: 0 0 0 2px white; }

/* User avatar - gradient circle like QuickSight */
.user-avatar-circle {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, #FF4B14, #D600BA, #6842FF);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; cursor: pointer; margin-left: 4px;
}

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
}

/* ===== Left Sidebar ===== */
.left-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--primary-bg);
    border-right: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto; overflow-x: hidden;
    z-index: 50;
}
.sidebar-search {
    position: relative;
    margin: 12px 12px 8px;
}
.sidebar-search input {
    background: var(--primary-bg); border: 1px solid #dedee3; border-radius: 4px;
    font-size: 13px; padding: 7px 32px 7px 10px;
    width: 100%; outline: none; color: var(--text-primary);
    font-family: var(--font-family);
}
.sidebar-search input::placeholder { color: #8c8c94; }
.sidebar-search input:focus { border-color: #4200DB; }
.sidebar-search svg {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    opacity: 0.5; pointer-events: none;
}
.sidebar-nav { padding: 0; display: flex; flex-direction: column; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    color: #545b64;
    text-decoration: none; font-size: 13px; font-weight: 400;
    border-left: 3px solid transparent;
    cursor: pointer; white-space: nowrap;
    transition: background 0.15s;
    font-family: var(--font-family);
}
.nav-item:hover { background: #f3f3f7; color: #16191f; }
.nav-item.active {
    background: #e8e6ff;
    color: #4200DB;
    border-left-color: #4200DB;
    font-weight: 500;
}
.nav-item svg { flex-shrink: 0; width: 16px; height: 16px; }
.nav-item h4, .nav-item span { font-size: 13px; font-weight: inherit; margin: 0; }
.nav-separator { height: 1px; background: #dedee3; margin: 6px 0; }
.nav-section-header {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10px; font-weight: 600; color: #8c8c94;
    padding: 14px 12px 6px; letter-spacing: 0.5px; text-transform: uppercase;
    cursor: pointer;
}
.nav-section-header::after {
    content: '';
    width: 0; height: 0;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid #8c8c94;
}
.nav-connector-icons {
    display: flex; gap: 2px; padding: 2px 12px 8px; flex-wrap: wrap; align-items: center;
}
.connector-dot {
    width: 20px; height: 20px; border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.12);
    background: white;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1; overflow-y: auto; padding: 24px 32px;
    background: linear-gradient(180deg, #f8f8fa 0%, #f3f0ff 40%, #faf8ff 100%);
}

/* ===== Right Chat Panel ===== */
.chat-panel {
    width: 0; min-width: 0;
    background: var(--primary-bg);
    border-left: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    transition: width 0.25s ease, min-width 0.25s ease;
    overflow: hidden;
    box-shadow: -2px 0 8px rgba(0,0,0,0.04);
}
.chat-panel.open { width: var(--chat-panel-width); min-width: var(--chat-panel-width); }
.chat-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border-color);
    background: var(--primary-bg); min-height: 42px;
}
.chat-panel-title {
    display: flex; align-items: center; gap: 8px;
    font-weight: 600; font-size: 13px; color: var(--text-primary);
}
.chat-panel-actions { display: flex; gap: 2px; }
.chat-action-btn {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; padding: 5px; border-radius: 4px;
    display: flex; align-items: center;
}
.chat-action-btn:hover { background: #F0F0F5; }

/* Q icon gradient - small */
.q-icon-gradient-sm {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--q-gradient);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
/* Q icon gradient - large */
.q-icon-gradient-lg {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--q-gradient);
    display: flex; align-items: center; justify-content: center;
}

/* Chat Messages */
.chat-messages {
    flex: 1; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 10px;
}
.chat-welcome {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 28px 14px; gap: 10px;
}
.chat-welcome h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.chat-welcome p { font-size: 12px; color: var(--text-secondary); max-width: 280px; line-height: 1.5; }
.welcome-suggestions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.suggestion-chip {
    background: var(--secondary-bg); border: 1px solid var(--border-color);
    border-radius: 14px; padding: 5px 12px; font-size: 11px;
    color: var(--visualization-bg); cursor: pointer;
    font-family: var(--font-family); transition: all 0.15s;
}
.suggestion-chip:hover { background: #EDE7F6; border-color: var(--visualization-bg); }

/* Message bubbles */
.message { display: flex; gap: 8px; max-width: 100%; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message.user { flex-direction: row-reverse; }
.message-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.message.user .message-avatar { display: none; }
.message.assistant .message-avatar {
    background: var(--q-gradient);
    color: white;
}
.message-bubble {
    padding: 8px 12px; border-radius: 10px;
    font-size: 13px; line-height: 1.5; max-width: 88%; word-wrap: break-word;
}
.message.user .message-bubble {
    background: var(--visualization-bg); color: white;
    border-bottom-right-radius: 3px;
}
.message.assistant .message-bubble {
    background: #F5F5F5; color: var(--text-primary);
    border-bottom-left-radius: 3px;
}
.message-bubble pre {
    background: #1e1e1e; color: #d4d4d4;
    padding: 8px; border-radius: 5px; overflow-x: auto;
    margin: 6px 0; font-size: 11px;
}
.message-bubble code { font-family: 'Consolas','Monaco',monospace; }
.typing-indicator { display: flex; gap: 4px; padding: 6px 12px; }
.typing-indicator span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--text-muted); animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%,60%,100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Chat Input */
.chat-input-area { padding: 10px 14px; border-top: 1px solid var(--border-color); background: var(--primary-bg); }
.chat-input-wrapper {
    display: flex; align-items: flex-end;
    background: var(--secondary-bg); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 6px 10px; gap: 6px;
    transition: border-color 0.15s;
}
.chat-input-wrapper:focus-within { border-color: var(--visualization-bg); }
.chat-input-wrapper textarea {
    flex: 1; border: none; background: none;
    font-family: var(--font-family); font-size: 12px;
    resize: none; outline: none; max-height: 100px;
    line-height: 1.4; color: var(--text-primary);
}
.chat-input-wrapper textarea::placeholder { color: var(--text-muted); }
.send-btn-gradient {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: var(--q-gradient);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: opacity 0.15s;
}
.send-btn-gradient:hover { opacity: 0.85; }
.send-btn-gradient:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-input-footer { text-align: center; margin-top: 4px; }
.powered-by { font-size: 10px; color: var(--text-muted); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
