/* ==========================================================================
   demo-rag/style.css - NotebookLM Style RAG Demo
   Theme: Premium Dark (White, Blue, Gold, Purple, Black, Green)
   ========================================================================== */

:root {
    --color-bg-base: #0a0a0c;
    --color-bg-panel: rgba(20, 20, 25, 0.6);
    --color-text-main: #ffffff;
    --color-text-dim: #a0a0a8;
    --color-border: rgba(255, 255, 255, 0.1);

    --color-blue: #0066ff;
    --color-gold: #ffcc00;
    --color-purple: #9933ff;
    --color-green: #00e676;

    --font-sans: 'Inter', sans-serif;
    --font-thai: 'Prompt', sans-serif;
}

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

body.app-body {
    background-color: var(--color-bg-base);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(0, 102, 255, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(153, 51, 255, 0.05), transparent 25%);
    color: var(--color-text-main);
    font-family: var(--font-thai);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Typography Utilities */
.text-gradient {
    background: linear-gradient(90deg, #fff, var(--color-blue));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-blue {
    color: var(--color-blue);
}

.text-gold {
    color: var(--color-gold);
}

.text-purple {
    color: var(--color-purple);
}

.text-green {
    color: var(--color-green);
}

/* Top Navigation */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--color-border);
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.app-title {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-purple {
    background: rgba(153, 51, 255, 0.2);
    color: #c280ff;
    border: 1px solid rgba(153, 51, 255, 0.4);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--color-text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: white;
}

.btn-outline-small {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-outline-small:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* App Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar: Sources */
.sidebar-sources {
    width: 320px;
    background: rgba(20, 20, 25, 0.4);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

.btn-add-source {
    background: rgba(0, 102, 255, 0.1);
    color: var(--color-blue);
    border: 1px solid rgba(0, 102, 255, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-source:hover {
    background: rgba(0, 102, 255, 0.2);
}

.source-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.source-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.source-item.active {
    background: rgba(0, 102, 255, 0.1);
    border-color: rgba(0, 102, 255, 0.3);
}

.source-icon {
    font-size: 1.5rem;
}

.source-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow: hidden;
}

.source-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-meta {
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.storage-info {
    font-size: 0.75rem;
    color: var(--color-text-dim);
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-blue);
}

/* Main Chat Area */
.main-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-base);
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.chat-message {
    display: flex;
    gap: 1rem;
    max-width: 85%;
}

.chat-message.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble {
    background: var(--color-bg-panel);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    line-height: 1.6;
}

.user-message .message-bubble {
    background: rgba(0, 102, 255, 0.15);
    border-color: rgba(0, 102, 255, 0.3);
}

.system-message .greeting {
    margin-bottom: 1.5rem;
}

.system-message h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-dim);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: rgba(0, 102, 255, 0.1);
    border-color: var(--color-blue);
    color: white;
}

/* Citations */
.citation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(153, 51, 255, 0.2);
    border: 1px solid var(--color-purple);
    color: #c280ff;
    font-size: 0.7rem;
    border-radius: 50%;
    margin-left: 4px;
    cursor: pointer;
    vertical-align: super;
    transition: all 0.2s;
}

.citation:hover {
    background: var(--color-purple);
    color: white;
    transform: scale(1.1);
}

/* Input Area */
.chat-input-wrapper {
    padding: 1.5rem 2rem;
    background: linear-gradient(to top, var(--color-bg-base) 80%, transparent);
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(30, 30, 35, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    transition: border-color 0.3s;
}

.chat-input-container:focus-within {
    border-color: var(--color-blue);
    box-shadow: 0 0 15px rgba(0, 102, 255, 0.1);
}

.btn-attach {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--color-text-dim);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.btn-attach:hover {
    color: white;
}

#chatInput {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    padding: 0.8rem 0;
    resize: none;
    outline: none;
    line-height: 1.5;
}

.btn-send {
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-send:hover {
    background: #3385ff;
    transform: scale(1.05);
}

.btn-send:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-dim);
    cursor: not-allowed;
    transform: none;
}

.privacy-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-dim);
    margin-top: 0.8rem;
}

/* Right Sidebar: Document Viewer */
.sidebar-document {
    width: 350px;
    background: rgba(20, 20, 25, 0.95);
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.viewer-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
}

.viewer-header h4 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-blue);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-close {
    background: none;
    border: none;
    color: var(--color-text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

.viewer-body {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.mock-document {
    background: white;
    color: #333;
    padding: 2rem;
    border-radius: 4px;
    min-height: 400px;
    font-size: 0.9rem;
    line-height: 1.8;
}

.doc-page h5 {
    font-size: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.highlighted-text {
    background-color: rgba(255, 204, 0, 0.3);
    padding: 0.2rem 0;
    border-radius: 2px;
    font-weight: 500;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.glass-panel {
    background: rgba(30, 30, 35, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.modal {
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    position: relative;
}

.btn-close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-dropzone:hover {
    border-color: var(--color-blue);
    background: rgba(0, 102, 255, 0.05);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.cta-button.primary {
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.cta-button.glow-hover:hover {
    box-shadow: 0 0 15px rgba(0, 102, 255, 0.5);
}

/* Typing Indicator Animation */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 4px 8px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--color-text-dim);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

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

    .sidebar-document {
        position: fixed;
        right: 0;
        height: 100vh;
    }

    .chat-message {
        max-width: 95%;
    }
}

/* ==========================================================================
   Dashboard View Styles
   ========================================================================== */

.hidden {
    display: none !important;
}

.chat-wrapper {
    width: 100%;
    height: 100%;
}

.dashboard-view {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    background: var(--color-bg-base);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1.5rem;
}

.dash-title h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.dash-title p {
    color: var(--color-text-dim);
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--color-text-dim);
}

.search-bar input {
    background: rgba(30, 30, 35, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    color: white;
    font-family: inherit;
    width: 250px;
    transition: all 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--color-blue);
    width: 300px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.project-table {
    width: 100%;
    border-collapse: collapse;
}

.project-table th,
.project-table td {
    padding: 1.2rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.project-table th {
    color: var(--color-text-dim);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.project-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.project-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.project-name-cell {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.project-table td {
    color: var(--color-text-dim);
    font-size: 0.95rem;
}

.project-table td strong {
    color: white;
    font-weight: 500;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 1rem;
    opacity: 0.6;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.text-red {
    color: #ff4d4d;
}

.breadcrumb {
    display: flex;
    align-items: center;
}