/* 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: 432px;
    /* 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;
}
.navbar-left { display: flex; align-items: center; gap: 6px; }
.explore-btn {
    display: flex; align-items: center; gap: 4px;
    background: transparent;
    border: 1.5px solid transparent;
    border-radius: 14px;
    color: white; padding: 3px 12px; 
    font-size: 11px; cursor: pointer; font-family: var(--font-family);
    font-weight: 500;
    position: relative;
}
.explore-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1.5px;
    background: linear-gradient(90deg, #5B3FD1, #a855f7, #FF4B14);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.explore-btn:hover { background: rgba(255,255,255,0.08); }
.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; margin-right: -4px; }
.navbar-account { font-size: 11px; color: #ffffff; margin-right: 4px; }
.navbar-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.2); margin: 0 6px; }
.navbar-breadcrumb { font-size: 12px; color: #ffffff; font-weight: 400; }
.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: 40px; height: 40px; border-radius: 6px; 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 { opacity: 1; }

/* 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));
}

/* ===== 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: #1a1a2e;
    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);
    position: relative;
}
/* Gradient items (Chat agents, Spaces, Flows, Research) get circle icon bg */
.nav-item[data-gradient] svg {
    background: #f0eaf8;
    border-radius: 50%;
    padding: 6px;
    width: 28px; height: 28px;
}
.nav-item:hover {
    background: linear-gradient(90deg, rgba(255,75,20,0.1) 0%, rgba(214,0,186,0.06) 40%, transparent 100%);
    color: #1a1a2e;
    border-radius: 24px;
    border-left-color: transparent;
}
.nav-item:hover::after {
    content: none;
}
.nav-item[data-page="spaces"]:hover::after,
.nav-item[data-page="flows"]:hover::after {
    content: '+';
    position: absolute;
    right: 12px;
    font-size: 16px;
    font-weight: 400;
    color: #1a1a2e;
}
/* Active state for gradient items */
.nav-item[data-gradient].active svg {
    background: linear-gradient(135deg, #d4145a, #7b2ff7);
    padding: 6px;
    border-radius: 50%;
}
.nav-item[data-gradient].active svg path,
.nav-item[data-gradient].active svg circle {
    fill: white !important;
    stroke: white !important;
}
.nav-item.active {
    background: linear-gradient(90deg, rgba(255,200,220,0.4) 0%, rgba(240,200,255,0.15) 50%, transparent 100%);
    color: #1a1a2e;
    border-left-color: transparent;
    font-weight: 500;
    border-radius: 24px;
}
.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 {
    padding: 4px 6px 8px;
}
.nav-connector-icons img {
    display: block;
    width: 100%;
    height: 28px;
}
.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);
}
.conn-circle {
    width: 24px; height: 24px; border-radius: 50%;
    border: 1px solid #dedee3;
    background: #ffffff;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    overflow: hidden;
}
.conn-circle svg { display: block; }

/* ===== Main Content ===== */
.main-content {
    flex: 1; overflow-y: auto; padding: 20px 32px;
    background: radial-gradient(ellipse at 0% 0%, #ffffff 0%, transparent 50%),
                radial-gradient(ellipse at 35% 25%, #E6E6E6 0%, transparent 60%),
                linear-gradient(135deg, #f0f0f0 0%, #BFA4E7 35%, #F0C2DE 65%, #e8e8e8 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); overflow: visible; }
.chat-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-bottom: 1px solid var(--border-color);
    background: var(--primary-bg); min-height: 38px;
}
.chat-panel-title { display: flex; align-items: center; gap: 6px; font-size: 12px; 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: 4px; border-radius: 4px; display: flex; align-items: center;
}
.chat-action-btn:hover { background: #f3f3f7; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 12px 32px; display: flex; flex-direction: column; gap: 10px; }
.chat-input-area { padding: 0; border-top: none; background: var(--primary-bg); overflow: visible; position: relative; }
.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;
}
.chat-input-wrapper:focus-within { border-color: #6842FF; }
.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: #8c8c94; }
.send-btn-gradient {
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: linear-gradient(to top right, #6842FF, #D600BA, #FF4B14);
    cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.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: #8c8c94; }
.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: 24px; height: 24px; border-radius: 50%;
    background: linear-gradient(to top right, #6842FF, #D600BA, #FF4B14);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: white;
}
.message.user .message-avatar { display: none; }
.message-bubble { padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5; max-width: 85%; word-wrap: break-word; }
.message.user .message-bubble { background: #6842FF; 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; }
.typing-indicator { display: flex; gap: 4px; padding: 6px 12px; }
.typing-indicator span { width: 5px; height: 5px; border-radius: 50%; background: #8c8c94; 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; } }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }
