/* =============================================================================
   RAG UI - Bare-Bones Industrial Theme Override
   Apply this on top of main.css by adding 'bare-mode' class to body
   90s aesthetic: grey colors, no rounded corners, no animations, no shadows
   ============================================================================= */

/* =============================================================================
   Color Variables Override
   ============================================================================= */

body.bare-mode {
    --bg-primary: #e8e8e8;
    --bg-secondary: #d4d4d4;
    --bg-tertiary: #c0c0c0;
    --text-primary: #000000;
    --text-secondary: #404040;
    --text-muted: #606060;
    --border-color: #808080;
    --accent-color: #000080;
    --accent-hover: #0000a0;
    --success-color: #008000;
    --error-color: #800000;
    --warning-color: #808000;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --radius-sm: 0;
    --radius-md: 0;
    --radius-lg: 0;
    --transition-fast: 0ms;
    --transition-normal: 0ms;
}

/* =============================================================================
   Hide Unnecessary Elements
   ============================================================================= */

/* Hide left sidebar (history + documents) */
body.bare-mode .sidebar {
    display: none !important;
}

/* Hide config dropdown and edit button */
body.bare-mode .header-right {
    display: none !important;
}

/* Hide dark mode toggle */
body.bare-mode #dark-toggle {
    display: none !important;
}

/* Hide config modal (but allow document/PDF viewer modal) */
body.bare-mode #config-modal {
    display: none !important;
}

/* Hide welcome message header (simplify) */
body.bare-mode .welcome-message h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

body.bare-mode .welcome-message p {
    font-size: 13px;
}

/* Hide confidence indicator */
body.bare-mode .confidence-indicator {
    display: none !important;
}

/* =============================================================================
   Typography
   ============================================================================= */

body.bare-mode {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

/* =============================================================================
   Header Override
   ============================================================================= */

body.bare-mode .header {
    background: #e8e8e8;
    border-bottom: 2px solid #404040;
    box-shadow: none;
    height: 36px;
}

body.bare-mode .server-status {
    background: transparent;
    border-radius: 0;
    padding: 4px 8px;
}

body.bare-mode .status-dot {
    border-radius: 0;
    width: 8px;
    height: 8px;
}

body.bare-mode .status-dot.online {
    background: #008000;
    box-shadow: none;
}

body.bare-mode .status-dot.offline {
    background: #800000;
}

body.bare-mode .status-dot.initializing {
    background: #808000;
    animation: none;
}

/* Toggle button styling */
body.bare-mode .btn-toggle {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
}

body.bare-mode .btn-toggle:hover {
    background: #d0d0d0;
}

body.bare-mode .btn-toggle:active {
    border-style: inset;
}

/* =============================================================================
   Main Content Override
   ============================================================================= */

body.bare-mode .content {
    background: #d4d4d4;
}

body.bare-mode .main-container {
    height: calc(100vh - 36px);
    height: calc(100dvh - 36px);
    margin-top: 36px;
}

/* =============================================================================
   Input Area Override
   ============================================================================= */

body.bare-mode .input-area {
    background: #e8e8e8;
    border-top: 2px solid #404040;
    padding: 12px 16px;
}

body.bare-mode #query-input {
    background: #ffffff;
    border: 2px inset #808080;
    border-radius: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    padding: 8px;
    min-height: 50px;
}

body.bare-mode #query-input:focus {
    outline: 1px solid #000080;
    border-color: #808080;
}

body.bare-mode #query-input:disabled {
    background: #d4d4d4;
}

body.bare-mode .hint {
    font-size: 11px;
}

/* =============================================================================
   Buttons Override
   ============================================================================= */

body.bare-mode .btn-primary {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    color: #000000;
    font-weight: bold;
    padding: 6px 16px;
    transition: none;
}

body.bare-mode .btn-primary:hover:not(:disabled) {
    background: #d0d0d0;
}

body.bare-mode .btn-primary:active:not(:disabled) {
    border-style: inset;
}

body.bare-mode .btn-primary:disabled {
    color: #808080;
}

body.bare-mode .btn-secondary {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    transition: none;
}

body.bare-mode .btn-secondary:hover:not(:disabled) {
    background: #d0d0d0;
}

body.bare-mode .btn-icon {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    transition: none;
}

body.bare-mode .btn-icon:hover {
    background: #d0d0d0;
}

/* =============================================================================
   Messages Override
   ============================================================================= */

body.bare-mode .chat-container {
    padding: 16px;
}

body.bare-mode .message {
    border-radius: 0;
    border: 1px solid #808080;
    max-width: 100%;
    margin: 0 0 12px 0;
}

body.bare-mode .message.user {
    background: #ffffcc;
    border-left: 4px solid #000080;
    margin-left: 0;
    color: #000000;
}

body.bare-mode .message.assistant {
    background: #ffffff;
    border: 1px solid #808080;
}

/* =============================================================================
   Source Chips Override
   ============================================================================= */

body.bare-mode .source-chips {
    border-top: 1px solid #808080;
}

body.bare-mode .source-chip {
    background: #e8e8e8;
    border: 1px solid #808080;
    border-radius: 0;
    color: #000080;
    font-weight: bold;
    text-decoration: underline;
    padding: 2px 8px;
    transition: none;
}

body.bare-mode .source-chip:hover {
    background: #c0c0c0;
    color: #000080;
    border-color: #808080;
}

/* =============================================================================
   Loading/Progress Override
   ============================================================================= */

body.bare-mode .query-progress {
    background: #e8e8e8;
    border: 1px solid #808080;
    border-radius: 0;
}

body.bare-mode .query-progress .progress-spinner {
    border: 2px solid #808080;
    border-top-color: #000080;
    border-radius: 50%;
}

body.bare-mode .loading-spinner {
    border-radius: 50%;
}

/* Sources loading text */
body.bare-mode .sources-loading {
    font-style: normal;
    color: #606060;
}

/* =============================================================================
   Source Panel Override
   ============================================================================= */

body.bare-mode .source-panel {
    background: #e8e8e8;
    border-left: 2px solid #404040;
    transition: none;
}

body.bare-mode .panel-header {
    background: #d4d4d4;
    border-bottom: 2px solid #808080;
    padding: 3px 16px;
}

body.bare-mode .panel-header h3 {
    font-size: 13px;
}

body.bare-mode .source-content {
    padding: 12px;
}

body.bare-mode .source-meta {
    background: #ffffff;
    border: 1px solid #808080;
    border-radius: 0;
    font-size: 12px;
}

body.bare-mode .source-meta .label {
    font-weight: bold;
}

body.bare-mode .source-meta .view-document-btn {
    display: block;
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    padding: 6px 12px;
    font-size: 12px;
    color: #000000;
    cursor: pointer;
    transition: none;
    margin-top: 8px;
}

body.bare-mode .source-meta .view-document-btn:hover {
    background: #d0d0d0;
}

body.bare-mode .source-meta .view-document-btn:active {
    border-style: inset;
}

body.bare-mode .source-preview {
    background: #ffffff;
    border: 1px solid #808080;
    border-radius: 0;
}

body.bare-mode .source-preview table {
    border-collapse: collapse;
}

body.bare-mode .source-preview th,
body.bare-mode .source-preview td {
    border: 1px solid #808080;
}

body.bare-mode .source-preview th {
    background: #e8e8e8;
}

body.bare-mode .source-preview code {
    background: #e8e8e8;
    border-radius: 0;
}

body.bare-mode .source-preview pre {
    background: #e8e8e8;
    border: 1px solid #808080;
    border-radius: 0;
}

body.bare-mode .source-preview blockquote {
    border-left: 4px solid #808080;
    background: #e8e8e8;
}

/* =============================================================================
   Segment Highlighting Override
   ============================================================================= */

body.bare-mode .segment-center {
    background: #c8ffc8;
    border-left: 4px solid #008000;
    border-radius: 0;
    padding: 12px;
    margin: 8px 0;
}

body.bare-mode .segment-neighbor {
    background: #ffffcc;
    border-left: 4px solid #808000;
    border-radius: 0;
    padding: 12px;
    margin: 8px 0;
    opacity: 1;
}

body.bare-mode .segment-label {
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
    border-radius: 0;
    padding: 2px 6px;
}

body.bare-mode .segment-center .segment-label {
    background: #90ee90;
    color: #006400;
}

body.bare-mode .segment-neighbor .segment-label {
    background: #ffff99;
    color: #666600;
}

/* =============================================================================
   Responsive - Source Panel Behavior
   PC (>1024px): Split view (main left, source right)
   Tablet/Mobile (<=1024px): Source replaces main view
   ============================================================================= */

/* PC: Source panel on right, main on left */
@media (min-width: 1025px) {
    body.bare-mode .main-container {
        display: flex;
        height: calc(100vh - 36px);
        height: calc(100dvh - 36px);
    }

    body.bare-mode .content {
        flex: 1;
        min-width: 0;
        overflow-y: auto;
    }

    body.bare-mode .source-panel {
        width: 50%;
        flex-shrink: 0;
        height: 100%;
        overflow-y: auto;
    }

    body.bare-mode .source-panel.hidden {
        display: none;
    }
}

/* Tablet and Mobile: Source replaces view */
@media (max-width: 1024px) {
    body.bare-mode .source-panel {
        position: fixed;
        top: 36px;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        z-index: 50;
        border-left: none;
    }

    body.bare-mode .source-panel.hidden {
        display: none;
    }

    /* When source panel is open, hide main content */
    body.bare-mode.source-panel-open .content {
        display: none;
    }
}

/* =============================================================================
   Images Override
   ============================================================================= */

body.bare-mode .md-image {
    border: 1px solid #808080;
    border-radius: 0;
}

body.bare-mode .md-image:hover {
    border-color: #808080;
}

body.bare-mode .image-placeholder {
    background: #e8e8e8;
    border: 1px dashed #808080;
    border-radius: 0;
}

/* =============================================================================
   Scrollbars (Windows 95 style)
   ============================================================================= */

body.bare-mode ::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

body.bare-mode ::-webkit-scrollbar-track {
    background: #c0c0c0;
    border: 1px solid #808080;
}

body.bare-mode ::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border: 2px outset #808080;
}

body.bare-mode ::-webkit-scrollbar-thumb:hover {
    background: #d0d0d0;
}

body.bare-mode ::-webkit-scrollbar-button:single-button {
    background: #c0c0c0;
    border: 2px outset #808080;
    height: 16px;
    width: 16px;
    display: block;
}

body.bare-mode ::-webkit-scrollbar-button:single-button:hover {
    background: #d0d0d0;
}

body.bare-mode ::-webkit-scrollbar-button:single-button:active {
    border-style: inset;
}

/* Hide double buttons (we only want single up/down buttons) */
body.bare-mode ::-webkit-scrollbar-button:double-button {
    display: none;
}

/* =============================================================================
   Voice Input Override
   ============================================================================= */

body.bare-mode .voice-language-select {
    padding: 4px 6px;
    border: 2px inset #808080;
    border-radius: 0;
    background: #ffffff;
    font-size: 11px;
    transition: none;
}

body.bare-mode .voice-language-select:focus {
    outline: 1px solid #000080;
    border-color: #808080;
}

/* =============================================================================
   Microphone Button Override
   ============================================================================= */

body.bare-mode .btn-mic {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    width: 40px;
    height: 40px;
    transition: none;
}

body.bare-mode .btn-mic:hover:not(:disabled) {
    background: #d0d0d0;
    border-color: #808080;
}

body.bare-mode .btn-mic:active:not(:disabled) {
    border-style: inset;
}

body.bare-mode .btn-mic img {
    width: 20px;
    height: 20px;
    opacity: 1;
}

body.bare-mode .btn-mic.recording {
    background: #800000;
    border: 2px inset #808080;
}

/* =============================================================================
   Recording Popup Override
   ============================================================================= */

body.bare-mode .recording-popup {
    background: #e8e8e8;
    border: 2px outset #808080;
    border-radius: 0;
    box-shadow: none;
    padding: 12px 16px;
}

body.bare-mode .recording-dot {
    background: #800000;
    border-radius: 0;
    width: 10px;
    height: 10px;
    animation: none;
}

body.bare-mode .recording-text {
    font-size: 12px;
    font-weight: bold;
}

body.bare-mode .btn-recording {
    width: 36px;
    height: 28px;
    border-radius: 0;
    font-size: 12px;
    transition: none;
}

body.bare-mode .btn-recording.btn-cancel {
    background: #c0c0c0;
    border: 2px outset #808080;
    color: #000000;
}

body.bare-mode .btn-recording.btn-cancel:hover {
    background: #d0d0d0;
    color: #000000;
    border: 2px outset #808080;
}

body.bare-mode .btn-recording.btn-cancel:active {
    border-style: inset;
}

body.bare-mode .btn-recording.btn-confirm {
    background: #c0c0c0;
    border: 2px outset #808080;
    color: #000000;
}

body.bare-mode .btn-recording.btn-confirm:hover {
    background: #d0d0d0;
    filter: none;
}

body.bare-mode .btn-recording.btn-confirm:active {
    border-style: inset;
}

/* =============================================================================
   Transcription Loading State Override
   ============================================================================= */

body.bare-mode .input-area.transcribing .textarea-wrapper::after {
    border: 3px solid #808080;
    border-top-color: #000080;
    border-radius: 0;
}

body.bare-mode .input-area.transcribing #query-input {
    background: #c0c0c0;
}

/* =============================================================================
   PDF Viewer Modal Override
   ============================================================================= */

body.bare-mode #document-modal {
    display: flex;
}

body.bare-mode #document-modal.hidden {
    display: none !important;
}

body.bare-mode .modal-pdf-viewer {
    border: 2px outset #808080;
    border-radius: 0;
    box-shadow: none;
    background: #e8e8e8;
}

body.bare-mode .modal-pdf-viewer .modal-header {
    background: #000080;
    color: #ffffff;
    padding: 4px 8px;
    border-bottom: 2px solid #404040;
}

body.bare-mode .modal-pdf-viewer .modal-header h3 {
    font-size: 13px;
    font-weight: bold;
}

body.bare-mode .modal-pdf-viewer .modal-close {
    color: #ffffff;
    font-size: 18px;
    background: transparent;
    border: none;
}

body.bare-mode .modal-pdf-viewer .modal-close:hover {
    background: #0000a0;
}

body.bare-mode .modal-pdf-viewer .modal-body {
    background: #c0c0c0;
}

body.bare-mode .pdf-loading {
    background: #c0c0c0;
}

body.bare-mode .pdf-loading-spinner {
    border: 4px solid #808080;
    border-top-color: #000080;
    border-radius: 0;
    width: 32px;
    height: 32px;
}

body.bare-mode .pdf-loading-text {
    color: #000000;
    font-size: 12px;
}

body.bare-mode .pdf-cancel-btn {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    padding: 4px 12px;
    font-size: 12px;
    color: #000000;
    cursor: pointer;
    transition: none;
}

body.bare-mode .pdf-cancel-btn:hover {
    background: #d0d0d0;
}

body.bare-mode .pdf-cancel-btn:active {
    border-style: inset;
}

/* PDF.js Controls */
body.bare-mode .pdf-controls {
    gap: 4px;
}

body.bare-mode .pdf-controls .btn-icon {
    background: #c0c0c0;
    border: 2px outset #808080;
    border-radius: 0;
    padding: 2px 6px;
    min-width: 24px;
    font-size: 12px;
    color: #000000;
    transition: none;
}

body.bare-mode .pdf-controls .btn-icon:hover {
    background: #d0d0d0;
}

body.bare-mode .pdf-controls .btn-icon:active {
    border-style: inset;
}

body.bare-mode .pdf-controls .btn-icon:disabled {
    background: #c0c0c0;
    color: #808080;
}

body.bare-mode #pdf-page-info,
body.bare-mode #pdf-zoom-level {
    color: #ffffff;
    font-size: 12px;
}

/* PDF.js Scrollable Container */
body.bare-mode .pdf-container {
    background: #808080;
    padding: 10px;
    gap: 16px;
    border: 2px inset #808080;
}

body.bare-mode .pdf-page-wrapper {
    gap: 2px;
}

body.bare-mode .pdf-page-label {
    background: #c0c0c0;
    border: 1px solid #808080;
    border-radius: 0;
    font-size: 11px;
    color: #000000;
}

body.bare-mode .pdf-page-canvas {
    box-shadow: none;
    border: 1px solid #404040;
}
