:root {
    --bg-main: #0c0e14;
    --sidebar-bg: #11141d;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --card-bg: #151824;
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover: rgba(255, 255, 255, 0.03);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-subtle: rgba(99, 102, 241, 0.12);
    --primary-border: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --bot-bubble-bg: #161a29;
    --bot-bubble-border: rgba(255, 255, 255, 0.08);
    --user-bubble-bg: #4f46e5;
    --user-bubble-border: rgba(99, 102, 241, 0.4);
    
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.12);
    --danger-border: rgba(239, 68, 68, 0.3);
    --success: #10b981;
    --success-subtle: rgba(16, 185, 129, 0.12);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Outer Layout: Single Sidebar + Main Canvas */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   Single Minimal Sidebar
   ========================================================================== */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    gap: 1.25rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0.5rem;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.brand-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.65rem 1rem;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

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

.nav-groups {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    overflow-y: auto;
    flex: 1;
    padding-right: 2px;
}

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

.nav-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5rem 0.3rem;
}

.nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 0.5rem 0.2rem;
}

.nav-badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.nav-item:hover {
    background-color: var(--card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--primary-subtle);
    color: #fff;
    font-weight: 600;
}

.nav-item.active .nav-item-icon svg {
    color: var(--primary);
    stroke-width: 2.2;
}

.nav-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.nav-item:hover .nav-item-icon {
    color: var(--text-secondary);
}

.nav-item-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.empty-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    font-style: italic;
}

.sidebar-footer {
    padding-top: 0.75rem;
    border-top: 1px solid var(--sidebar-border);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0.5rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.status-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}


/* ==========================================================================
   Main Canvas & Unified Topbar
   ========================================================================== */
.main-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    background: radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.05), transparent 40%),
                radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.03), transparent 40%),
                var(--bg-main);
}

.view {
    display: none;
    height: 100%;
    width: 100%;
    flex-direction: column;
    min-height: 0;
}

.view.active {
    display: flex;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--card-border);
    background-color: rgba(12, 14, 20, 0.6);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.topbar-context {
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.context-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.context-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ghost-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ghost-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.ghost-btn.danger:hover {
    background: var(--danger-subtle);
    color: #f87171;
    border-color: var(--danger-border);
}


/* ==========================================================================
   Chat Feed & Floating Centered Input
   ========================================================================== */
.chat-feed-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: center;
    min-height: 0;
}

.chat-messages {
    width: 100%;
    max-width: 780px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.25s ease;
}

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

.message.bot {
    align-self: flex-start;
}

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

.avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bot-avatar {
    background-color: var(--primary-subtle);
    border: 1px solid var(--primary-border);
    color: var(--primary);
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bubble {
    padding: 0.85rem 1.15rem;
    font-size: 0.92rem;
    line-height: 1.55;
    border-radius: var(--radius-lg);
    word-break: break-word;
}

.message.bot .bubble {
    background-color: var(--bot-bubble-bg);
    border: 1px solid var(--bot-bubble-border);
    color: var(--text-primary);
    border-top-left-radius: 4px;
}

.message.user .bubble {
    background-color: var(--user-bubble-bg);
    border: 1px solid var(--user-bubble-border);
    color: #fff;
    border-top-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Citations & Booking confirmations */
.sources-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
}

.sources-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.sources-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.source-item {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.booking-confirm-card {
    background: var(--success-subtle);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    color: #e2e8f0;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.booking-confirm-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--success);
}

/* Clean Centered Input Pill */
.chat-input-wrapper {
    padding: 1rem 2rem 1.5rem;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.input-container {
    width: 100%;
    max-width: 780px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-xl);
    padding: 0.5rem 0.6rem 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.input-container:focus-within {
    border-color: var(--primary-border);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 8px 24px rgba(0, 0, 0, 0.3);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.92rem;
    resize: none;
    line-height: 1.4;
    padding: 0.3rem 0;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

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


/* ==========================================================================
   Documents & Bookings Management Views
   ========================================================================== */
.content-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.dropzone:hover {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.03);
    color: var(--text-secondary);
}

.dropzone svg {
    color: var(--primary);
}

.dropzone-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.dropzone-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-input {
    display: none;
}

.upload-controls {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-top: 1.25rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.select-input {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.select-input:focus {
    border-color: var(--primary-border);
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

.status-msg {
    margin-top: 0.75rem;
    font-size: 0.82rem;
}

.status-msg.success { color: var(--success); }
.status-msg.error { color: var(--danger); }

/* Clean Data Tables */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--sidebar-border);
}

th {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

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

tr:hover td {
    background-color: rgba(255, 255, 255, 0.015);
}

.doc-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.doc-name-cell svg {
    color: var(--primary);
    flex-shrink: 0;
}

.badge-tag {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.confirmed {
    background-color: var(--success-subtle);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.table-actions-cell {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.table-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--primary-subtle);
    color: #a5b4fc;
    border: 1px solid var(--primary-border);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.table-action-btn:hover {
    background: var(--primary);
    color: #fff;
}

.table-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.table-delete-btn:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.sidebar-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.45;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.nav-item:hover .sidebar-delete-btn {
    opacity: 0.85;
}

.sidebar-delete-btn:hover {
    color: #ef4444 !important;
    opacity: 1 !important;
    background: rgba(239, 68, 68, 0.2);
}


/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   Custom Confirmation Modal Dialog & Toast Notifications
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 6, 15, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    position: relative;
    width: 90%;
    max-width: 440px;
    background: linear-gradient(160deg, #161b2e 0%, #0d101d 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.92) translateY(8px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-card {
    transform: scale(1) translateY(0);
}

.modal-close-x {
    position: absolute;
    top: 16px;
    right: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.modal-close-x:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.modal-icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    flex-shrink: 0;
}

.modal-icon-badge.danger {
    background: rgba(239, 68, 68, 0.16);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.35);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.modal-title-wrap {
    flex: 1;
    padding-top: 2px;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.modal-body {
    margin-bottom: 24px;
}

.modal-desc {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    word-break: break-word;
}

.modal-desc strong {
    color: #fff;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    padding: 0.65rem 1.25rem;
    border-radius: 9px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
}

.modal-btn.cancel-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

.modal-btn.cancel-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.modal-btn.confirm-btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.modal-btn.confirm-btn.danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.modal-btn:active {
    transform: scale(0.98);
}

/* Toast Container & Toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    background: #14192b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.86rem;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    animation: toastSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}

.toast.success svg {
    color: var(--success);
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.15);
}

.toast.error svg {
    color: var(--danger);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

