/*
================================================================================
PRODUCT MANUAL ASSISTANT - STYLESHEET
================================================================================
Main stylesheet for the Product Manual Assistant application.

Sections:
1. CSS Variables (Theming)
2. Reset & Base Styles
3. Background & Decorations
4. Layout (App Container, Header, Sidebar, Main Panel)
5. Components (Buttons, Cards, Modals, Forms)
6. Knowledge Display (Cards, Specs, Tags)
7. Chat Interface
8. Annotation Tools
9. Metrics Dashboard
10. Responsive Breakpoints

Author: SUDHARSAN G S
================================================================================
*/

/* ============================================================================
   1. CSS VARIABLES - THEMING
   ============================================================================
   Color scheme and design tokens. Supports light/dark themes via data-theme.
*/
:root {
    /* Primary brand color */
    --primary-hue: 250;
    --primary-color: hsl(var(--primary-hue), 80%, 60%);
    --bg-color: #f0f2f5;
    --text-color: #1a1a1a;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --input-bg: rgba(255, 255, 255, 0.9);
    --card-radius: 20px;
    --transition: 0.3s ease;

    /* Background blob colors (light theme) */
    --blob-1: #ff9a9e;
    --blob-2: #fad0c4;
    --blob-3: #a18cd1;

    /* Knowledge category colors */
    --safety-color: #ff4d4f; /* Red - warnings/hazards */
    --parts-color: #1890ff; /* Blue - specifications */
    --warranty-color: #52c41a; /* Green - warranty info */
    --procedures-color: #fa8c16; /* Orange - procedures */
    --errors-color: #eb2f96; /* Pink - error codes */
    --video-color: #722ed1; /* Purple - video/links */
}

/* Dark theme overrides */

[data-theme="dark"] {
    /* Dark theme color overrides */
    --bg-color: #0f0f13;
    --text-color: #f0f0f0;
    --glass-bg: rgba(20, 20, 25, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --input-bg: rgba(30, 30, 35, 0.8);

    --blob-1: #4a1c40;
    --blob-2: #1a2a6c;
    --blob-3: #b21f1f;
}

/* ============================================================================
   2. RESET & BASE STYLES
   ============================================================================
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Outfit", sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
    transition:
        background-color var(--transition),
        color var(--transition);
    overflow-x: hidden;
}

/* ============================================================================
   3. BACKGROUND & DECORATIONS
   ============================================================================
   Animated gradient blobs for visual appeal
*/
/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: drift 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--blob-1);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--blob-2);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--blob-3);
    top: 30%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(30px, 50px);
    }
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: calc(100vh - 40px);
}

/* Glass Components */
.glass-header,
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    box-shadow: var(--glass-shadow);
}

.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    position: sticky;
    top: 10px;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.header-btn:hover {
    background: rgba(var(--primary-hue), 80%, 60%, 0.15);
    border-color: var(--primary-color);
}

.header-btn i {
    font-size: 0.9rem;
}

.header-btn-label {
    display: none;
}

@media (min-width: 768px) {
    .header-btn-label {
        display: inline;
    }
}

.icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(var(--primary-hue), 80%, 60%, 0.15);
    border-color: var(--primary-color);
}

.glass-card {
    padding: 16px;
    border-radius: 20px;
}

@media (min-width: 992px) {
    .glass-card {
        padding: 15px;
        position: relative;
    }
}

.glass-card.control-card {
    overflow: visible;
    position: relative;
}

.glass-card.control-card:first-child {
    z-index: 120;
}

.glass-card.control-card:nth-child(2) {
    z-index: 110;
}

.glass-card.control-card:nth-child(3) {
    z-index: 100;
}

/* Accordion */
.accordion {
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 0px;
    overflow: visible;
    position: relative;
    z-index: 10;
}

.accordion-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    border-radius: 16px;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.1);
}

.accordion-content {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 0;
    overflow: hidden;
    transition:
        max-height 0.3s ease-out,
        padding 0.3s ease,
        opacity 0.3s ease,
        border-color 0.3s ease;
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid transparent;
    border-radius: 16px;
    margin-top: 0;
    backdrop-filter: blur(40px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
}

.accordion-content.open {
    max-height: 500px;
    padding: 24px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: var(--glass-border);
    margin-top: 8px;
    opacity: 1;
    pointer-events: auto;
}

.fa-chevron-down {
    transition: transform 0.3s ease;
}

/* Inputs & Forms */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.input-with-toggle {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-toggle input {
    flex: 1;
    padding-right: 45px;
}

.eye-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.5;
    padding: 8px;
    transition: opacity 0.2s;
}

.eye-toggle:hover {
    opacity: 0.8;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

select option {
    background: #1a1a2e;
    color: var(--text-color);
    padding: 10px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-hue), 80%, 60%, 0.1);
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: 10px;
    font-size: 0.9rem;
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Manual Library */
.manual-library {
    margin-bottom: 15px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.library-header h3 {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.library-list {
    max-height: 120px;
    overflow-y: auto;
}

.library-empty {
    text-align: center;
    padding: 20px;
    opacity: 0.5;
    font-size: 0.9rem;
}

.library-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    transition: var(--transition);
}

.library-item:hover,
.library-item.active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-hue), 80%, 60%, 0.1);
}

.library-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.library-item-name {
    font-weight: 500;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.library-item-meta {
    font-size: 0.75rem;
    opacity: 0.6;
}

.library-item-actions {
    display: flex;
    gap: 6px;
}

.library-item-actions button {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.library-item-actions button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.library-delete:hover {
    color: var(--safety-color) !important;
}

/* Header Tip */
.header-tip-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-tip {
    position: relative;
    color: var(--text-color);
    opacity: 0.5;
    cursor: help;
    font-size: 0.9rem;
    padding: 4px;
    display: flex;
    align-items: center;
}

.header-tip:hover {
    opacity: 1;
}

.header-tip .tip-content {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    width: 220px;
    padding: 12px 14px;
    background: rgba(30, 30, 40, 0.98);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 0.8rem;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.header-tip:hover .tip-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-tip .tip-content strong {
    display: block;
    margin-bottom: 6px;
    color: var(--primary-color);
    font-size: 0.85rem;
}

.header-tip .tip-content p {
    margin: 0;
    opacity: 0.9;
}

.header-tip .tip-content i {
    color: var(--primary-color);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 15px;
}

.upload-area.small {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-hue), 80%, 60%, 0.05);
}

/* Quick Chips - Ghost Buttons in Chat */
.quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 8px;
}

.quick-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1.5px solid;
    border-radius: 20px;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.75rem;
    font-weight: 500;
}

.quick-chip i {
    font-size: 0.8rem;
}

/* Safety Chip - Red */
.quick-chip.safety-chip {
    border-color: var(--safety-color);
    color: var(--safety-color);
}

.quick-chip.safety-chip:hover {
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

/* Warranty Chip - Green */
.quick-chip.warranty-chip {
    border-color: var(--warranty-color);
    color: var(--warranty-color);
}

.quick-chip.warranty-chip:hover {
    background: rgba(34, 197, 94, 0.15);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

/* Diagnose Chip - Orange */
.quick-chip.diagnose-chip {
    border-color: var(--procedures-color);
    color: var(--procedures-color);
}

.quick-chip.diagnose-chip:hover {
    background: rgba(249, 115, 22, 0.15);
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.3);
}

/* Parts Chip - Blue */
.quick-chip.parts-chip {
    border-color: var(--parts-color);
    color: var(--parts-color);
}

.quick-chip.parts-chip:hover {
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

/* Chat Interface */
.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 8px;
    margin-bottom: 12px;
    min-height: 150px;
    max-height: 300px;
}

@media (min-width: 992px) {
    .chat-messages {
        max-height: 350px;
    }
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

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

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

.message-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message.user .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

.message-image {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
    object-fit: cover;
    border: 1px solid var(--glass-border);
}

.message.user .message-image {
    margin-left: auto;
}

.message-content ul,
.message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 5px;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

/* Chat Image Preview */
.chat-image-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 10px;
}

.chat-image-preview.hidden {
    display: none;
}

.chat-image-preview img {
    max-width: 120px;
    max-height: 80px;
    border-radius: 8px;
    object-fit: cover;
}

.remove-image-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--safety-color);
    color: var(--safety-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: var(--transition);
}

.remove-image-btn:hover {
    background: var(--safety-color);
    color: white;
}

.chat-input-area {
    display: flex;
    gap: 0;
    position: relative;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    transition: var(--transition);
    align-items: center;
    padding: 5px;
}

.chat-input-area:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-hue), 80%, 60%, 0.15);
}

.attach-btn {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.6;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.attach-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

/* Attachment Menu */
.attach-menu-container {
    position: relative;
}

.attach-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: rgba(30, 30, 40, 0.98);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.attach-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    text-align: left;
}

.attach-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.attach-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
}

.attach-menu-item:hover i {
    opacity: 1;
    color: var(--primary-color);
}

/* Page Picker Modal */
.page-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 0;
}

.page-picker-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: var(--transition);
}

.page-picker-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.page-picker-item img {
    width: 100%;
    height: 60px;
    object-fit: cover;
}

.page-picker-item span {
    display: block;
    text-align: center;
    font-size: 0.7rem;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.chat-input-area input[type="text"] {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 12px 60px 12px 10px;
    border-radius: 50px;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
}

.chat-input-area input:focus {
    border: none;
    box-shadow: none;
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    position: absolute;
    right: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:disabled {
    opacity: 0.5;
    background: #ccc;
    cursor: not-allowed;
}

.send-btn:not(:disabled):hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Badge */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(var(--primary-hue), 80%, 60%, 0.15);
    color: var(--primary-color);
}

/* Side Navigation */
.side-nav {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-radius: 0 16px 16px 0;
    z-index: 200;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.6rem;
    font-weight: 600;
    border-radius: 10px;
    transition: var(--transition);
    opacity: 0.6;
    width: 56px;
    text-align: center;
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item span {
    white-space: nowrap;
}

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

.nav-item.active {
    background: rgba(var(--primary-hue), 80%, 60%, 0.2);
    color: var(--primary-color);
    opacity: 1;
}

/* Slide Panels */
.slide-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-panel.active {
    transform: translateX(0);
}

.slide-panel-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.slide-panel-header h2 {
    flex: 1;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.slide-panel-header h2 i {
    color: var(--primary-color);
}

.panel-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--safety-color);
}

.slide-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-left: 80px;
    min-height: calc(100vh - 100px);
}

.chat-panel {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    max-height: 800px;
}

.chat-panel .upload-area {
    margin-bottom: 15px;
}

.chat-panel .chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-panel .chat-messages {
    flex: 1;
    overflow-y: auto;
}

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

/* Visual Gallery */
.visual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.visual-header h3 {
    font-size: 1rem;
    margin: 0;
}

.visual-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.page-search {
    flex: 1;
    min-width: 200px;
    max-width: 350px;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    max-height: 450px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

.gallery-item {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    background: #000;
}

.gallery-item img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
    opacity: 0.8;
    transition: var(--transition);
}

@media (min-width: 768px) {
    .gallery-item img {
        height: 90px;
    }
}

.gallery-item:hover img {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.75rem;
    padding: 4px 8px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-color);
    opacity: 0.7;
    grid-column: 1 / -1;
    font-size: 0.9rem;
}

.empty-state i {
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: block;
}

/* Knowledge Graph */
.knowledge-header {
    margin-bottom: 20px;
}

.knowledge-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip:hover,
.filter-chip.active {
    background: rgba(var(--primary-hue), 80%, 60%, 0.15);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-chip[data-filter="safety"].active {
    background: rgba(255, 77, 79, 0.15);
    border-color: var(--safety-color);
    color: var(--safety-color);
}
.filter-chip[data-filter="parts"].active {
    background: rgba(24, 144, 255, 0.15);
    border-color: var(--parts-color);
    color: var(--parts-color);
}
.filter-chip[data-filter="warranty"].active {
    background: rgba(82, 196, 26, 0.15);
    border-color: var(--warranty-color);
    color: var(--warranty-color);
}
.filter-chip[data-filter="procedures"].active {
    background: rgba(250, 140, 22, 0.15);
    border-color: var(--procedures-color);
    color: var(--procedures-color);
}
.filter-chip[data-filter="errors"].active {
    background: rgba(235, 47, 150, 0.15);
    border-color: var(--errors-color);
    color: var(--errors-color);
}
.filter-chip[data-filter="video"].active {
    background: rgba(114, 46, 209, 0.15);
    border-color: var(--video-color);
    color: var(--video-color);
}

.knowledge-graph-container {
    margin-bottom: 20px;
}

.knowledge-graph-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
}

.graph-center {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(var(--primary-hue), 80%, 60%, 0.4);
}

.graph-center span {
    font-size: 0.7rem;
    margin-top: 4px;
}

.graph-nodes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.graph-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 15px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--node-color);
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
}

.graph-node:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.graph-node i {
    font-size: 1.5rem;
    color: var(--node-color);
}

.graph-node span {
    font-size: 0.85rem;
    font-weight: 500;
}

.node-count {
    background: var(--node-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
}

.knowledge-list {
    max-height: 400px;
    overflow-y: auto;
}

.knowledge-section {
    margin-bottom: 25px;
}

.ks-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 12px;
}

.ks-count {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 10px;
    margin-left: auto;
}

.ks-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.page-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.page-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.pc-page {
    display: inline-block;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    align-self: flex-start;
}

.pc-overview {
    font-size: 0.82rem;
    line-height: 1.55;
    opacity: 0.75;
    max-height: 300px;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Troubleshooting */
.troubleshoot-header {
    margin-bottom: 20px;
}

.troubleshoot-subtitle {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 5px;
}

.issue-selector {
    margin-bottom: 20px;
}

.issue-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.issue-selector select {
    max-width: 300px;
}

.diagnostic-workflow {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.workflow-empty,
.workflow-loading,
.workflow-error {
    text-align: center;
    padding: 30px;
    opacity: 0.7;
}

.workflow-empty i,
.workflow-loading i,
.workflow-error i {
    font-size: 2rem;
    margin-bottom: 15px;
    display: block;
}

.workflow-content {
    line-height: 1.7;
}

.workflow-content h1,
.workflow-content h2,
.workflow-content h3 {
    margin: 15px 0 10px;
}

.workflow-content ol,
.workflow-content ul {
    padding-left: 25px;
    margin: 10px 0;
}

.workflow-content li {
    margin-bottom: 8px;
}

.error-lookup {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
}

.error-lookup h4 {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-search-box {
    display: flex;
    gap: 10px;
}

.error-search-box input {
    flex: 1;
}

.lookup-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.lookup-btn:hover {
    filter: brightness(1.1);
}

.error-result {
    margin-top: 15px;
}

.error-result-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 15px;
}

.error-result-content h5 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Annotation Tool */
.annotate-header {
    margin-bottom: 20px;
}

.annotate-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    align-items: center;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tool-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.tool-separator {
    width: 1px;
    height: 30px;
    background: var(--glass-border);
    margin: 0 5px;
}

#annotation-color {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: none;
}

.chat-annotated-btn {
    background: linear-gradient(
        135deg,
        var(--primary-color),
        #8b5cf6
    ) !important;
    color: white !important;
    border-color: transparent !important;
}

.chat-annotated-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.annotate-workspace {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 20px;
}

.page-selector {
    grid-column: 1 / -1;
}

.page-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.annotation-canvas-container {
    position: relative;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    min-height: 300px;
}

#annotation-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.annotation-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.annotation-shape {
    position: absolute;
    pointer-events: auto;
}

.annotation-rect {
    border: 2px solid;
    background: transparent;
}

.annotation-circle {
    border: 2px solid;
    border-radius: 50%;
    background: transparent;
}

.annotation-arrow {
    height: 3px;
}

.annotation-marker {
    position: absolute;
    font-size: 24px;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    cursor: pointer;
}

.annotation-text {
    position: absolute;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    cursor: pointer;
}

.annotation-list {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
}

.annotation-list h4 {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

#annotation-items {
    list-style: none;
}

.annotation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

.ann-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.6;
    font-weight: 600;
}

.ann-label {
    flex: 1;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ann-delete {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.5;
    cursor: pointer;
    padding: 4px;
}

.ann-delete:hover {
    opacity: 1;
    color: var(--safety-color);
}

.empty-annotations {
    text-align: center;
    opacity: 0.5;
    font-size: 0.85rem;
    padding: 20px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    max-width: 90%;
    max-height: 85vh;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 20px;
    padding: 35px 30px 30px 30px;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 25px;
    color: var(--text-color);
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Image Modal */
#image-modal .modal-content {
    background: transparent;
    border: none;
    padding: 0;
}

#image-modal img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.modal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Specific Modal Styles */
.warranty-modal-content,
.safety-modal-content,
.parts-modal-content,
.video-modal-content {
    width: 700px;
    max-width: 90vw;
    max-height: 80vh;
    padding: 30px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
}

.warranty-header,
.safety-header,
.parts-header,
.video-header {
    text-align: center;
    margin-bottom: 25px;
}

.warranty-icon,
.safety-icon,
.parts-icon,
.video-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

.warranty-icon {
    color: var(--warranty-color);
}
.safety-icon {
    color: var(--safety-color);
}
.parts-icon {
    color: var(--parts-color);
}
.video-icon {
    color: var(--video-color);
}

.warranty-body,
.safety-body,
.parts-body,
.video-body {
    flex: 1;
    max-height: 50vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Search term highlighting */
.search-highlight {
    background: var(--primary-color);
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Improved Parts Card Styling */
.parts-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.part-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid var(--parts-color);
}

.part-card .part-page {
    display: inline-block;
    background: var(--parts-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
}

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

.part-card .part-component-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.part-card .part-specs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.part-card .spec-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
}

.part-card .spec-item-full {
    flex-basis: 100%;
}

.part-card .spec-tag {
    background: rgba(138, 43, 226, 0.15);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 20px;
    padding: 6px 14px;
    min-width: auto;
    flex-direction: row;
}

.part-card .spec-tag .spec-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--parts-color);
}

.part-card .part-spec-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.part-card .part-spec-row:last-child {
    border-bottom: none;
}

.part-card .spec-label {
    color: var(--parts-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.part-card .spec-value {
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.part-card p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Bullet list display for specs */
.part-card .part-specs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.part-card .spec-list-item {
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.part-card .spec-list-item:last-child {
    border-bottom: none;
}

/* Note/filler text styling */
.part-card .part-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.7;
    margin: 0;
}

/* Parts search styling */
.parts-search {
    margin-bottom: 20px;
}

.parts-search input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-color);
    font-size: 0.95rem;
}

.parts-search input:focus {
    outline: none;
    border-color: var(--parts-color);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.2);
}

.parts-search input::placeholder {
    color: var(--text-secondary);
}

.warranty-loading,
.safety-loading,
.parts-loading,
.video-loading {
    text-align: center;
    padding: 40px;
}

.modal-empty {
    text-align: center;
    padding: 40px;
    opacity: 0.7;
}

.modal-empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

/* Library Modal */
.library-modal-content {
    max-width: 500px;
    max-height: 80vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 30px;
}

.library-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.library-icon {
    font-size: 2rem;
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
    padding: 12px;
    border-radius: 12px;
}

.library-modal-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    flex: 1;
}

.library-modal-header .badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.library-modal-header .modal-close {
    position: static;
    margin-left: 10px;
}

.library-modal-body {
    flex: 1;
    max-height: 50vh;
    overflow-y: auto;
    padding-bottom: 20px;
}

.library-modal-body .library-list {
    max-height: none;
}

/* Configuration Modal */
.config-modal-content {
    max-width: 450px;
    max-height: 80vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 30px;
}

.config-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.config-icon {
    font-size: 2rem;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.15);
    padding: 12px;
    border-radius: 12px;
}

.config-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    flex: 1;
}

.config-header .modal-close {
    position: static;
}

.modal-refresh {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.modal-refresh:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--primary-color);
}

.modal-refresh:hover i {
    animation: spin 0.5s ease;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Page Picker Modal */
.page-picker-modal-content {
    max-width: 500px;
    width: 100%;
}

.page-picker-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.page-picker-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.15);
    padding: 12px;
    border-radius: 12px;
}

.page-picker-header h2 {
    flex: 1;
    font-size: 1.3rem;
    font-weight: 600;
}

.page-picker-header .modal-close {
    position: static;
}

.page-picker-body {
    max-height: 400px;
    overflow-y: auto;
}

.config-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.config-body .input-group {
    margin-bottom: 15px;
}

.config-body .primary-btn {
    margin-top: 10px;
}

/* Safety Modal */
.safety-warnings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.safety-warning-card {
    background: rgba(255, 77, 79, 0.1);
    border: 1px solid rgba(255, 77, 79, 0.3);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid var(--safety-color);
}

.safety-warning-card p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.warning-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--safety-color);
    font-weight: 600;
}

.warning-page {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Warranty Modal */
.warranty-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.warranty-card {
    background: rgba(82, 196, 26, 0.1);
    border: 1px solid rgba(82, 196, 26, 0.3);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid var(--warranty-color);
}

.warranty-card p {
    margin: 0;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.warranty-page {
    display: inline-block;
    background: var(--warranty-color);
    color: white;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Parts Modal - styles moved to earlier section */
.part-page {
    display: inline-block;
    background: var(--parts-color);
    color: white;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

/* Metrics Modal */
.metrics-modal-content {
    width: 900px;
    max-width: 95vw;
    max-height: 80vh;
    padding: 30px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
}

.metrics-header {
    text-align: center;
    margin-bottom: 30px;
}

.metrics-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
}

.metrics-body {
    flex: 1;
    max-height: 55vh;
    overflow-y: auto;
    padding-bottom: 20px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.metrics-body::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.metrics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.metric-label {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 4px;
}

.metrics-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
}

.chart-container h4 {
    margin-bottom: 20px;
    font-size: 1rem;
}

.category-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-label {
    width: 80px;
    font-size: 0.85rem;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.safety-bar {
    background: var(--safety-color);
}
.parts-bar {
    background: var(--parts-color);
}
.warranty-bar {
    background: var(--warranty-color);
}
.procedures-bar {
    background: var(--procedures-color);
}
.errors-bar {
    background: var(--errors-color);
}

.cat-value {
    width: 30px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
}

.satisfaction-display {
    display: flex;
    align-items: center;
    gap: 30px;
}

.satisfaction-ring {
    width: 120px;
    height: 120px;
    position: relative;
}

.satisfaction-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.ring-fill {
    fill: none;
    stroke: var(--warranty-color);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.ring-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ring-value span {
    font-size: 2rem;
    font-weight: 700;
}

.ring-value small {
    font-size: 1rem;
    opacity: 0.6;
}

.satisfaction-breakdown {
    flex: 1;
}

.rating-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rating-row:last-child {
    border-bottom: none;
}

.recent-activity {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.recent-activity h4 {
    margin-bottom: 15px;
}

#activity-log {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.activity-time {
    opacity: 0.5;
    width: 80px;
}

.activity-type {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.activity-desc {
    flex: 1;
}

.activity-empty {
    text-align: center;
    opacity: 0.5;
    padding: 20px;
}

.metrics-export {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

#reset-metrics:hover {
    border-color: var(--safety-color);
    color: var(--safety-color);
}

/* Survey Modal */
.survey-modal-content {
    width: 500px;
    max-width: 90vw;
    padding: 30px;
}

.survey-header {
    text-align: center;
    margin-bottom: 30px;
}

.survey-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
}

.survey-header p {
    opacity: 0.7;
    margin-top: 5px;
}

.survey-body {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.survey-question label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
}

.survey-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.survey-option {
    flex: 1;
    min-width: 100px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.survey-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.survey-option.selected {
    background: rgba(var(--primary-hue), 80%, 60%, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.star-rating {
    display: flex;
    gap: 10px;
    font-size: 2rem;
}

.star-rating i {
    cursor: pointer;
    color: #ffc107;
    transition: var(--transition);
}

.star-rating i:hover {
    transform: scale(1.2);
}

#survey-comments {
    min-height: 100px;
    resize: vertical;
}

.survey-submit {
    margin-top: 10px;
}

/* Cross-Manual Search Modal */
.cross-search-modal-content {
    width: 700px;
    max-width: 95vw;
    padding: 30px;
}

.cross-search-header {
    text-align: center;
    margin-bottom: 25px;
}

.cross-search-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: block;
}

.cross-search-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.cross-search-input input {
    flex: 1;
}

.cross-search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-results-header {
    font-weight: 600;
    margin-bottom: 15px;
    opacity: 0.7;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-result-item {
    display: flex;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.result-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-manual {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
}

.result-page {
    font-size: 0.8rem;
    opacity: 0.6;
    display: block;
    margin: 4px 0;
}

.result-snippet {
    font-size: 0.85rem;
    opacity: 0.7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-snippet mark {
    background: rgba(var(--primary-hue), 80%, 60%, 0.3);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast i {
    font-size: 1.2rem;
}

.toast-success i {
    color: var(--warranty-color);
}
.toast-error i {
    color: var(--safety-color);
}
.toast-info i {
    color: var(--parts-color);
}
.toast-warning i {
    color: var(--procedures-color);
}

/* Status Text */
.status-text {
    text-align: center;
    padding: 8px 12px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 12px;
}

.status-text i {
    font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(128, 128, 128, 0.5);
}

/* Main Layout */
main {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    min-height: 0;
}

@media (min-width: 992px) {
    .side-nav {
        padding: 16px 10px;
    }

    .nav-item {
        width: 64px;
        padding: 14px 10px;
    }

    .main-content {
        padding-left: 90px;
    }

    .chat-panel {
        max-width: 700px;
    }
}

@media (min-width: 1200px) {
    .chat-panel {
        max-width: 800px;
    }
}

/* Mobile & Tablet Responsive */
@media (max-width: 991px) {
    body {
        padding: 8px;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
        gap: 10px;
    }

    .glass-header {
        padding: 8px 12px;
        position: sticky;
        top: 8px;
        border-radius: 14px;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .logo i {
        font-size: 1.1rem;
    }

    .glass-card {
        padding: 12px;
        border-radius: 14px;
    }

    .side-nav {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        flex-direction: row;
        justify-content: space-around;
        border-radius: 16px 16px 0 0;
        border: 1px solid var(--glass-border);
        border-bottom: none;
        padding: 8px 12px;
    }

    .nav-item {
        width: auto;
        padding: 8px 12px;
        font-size: 0.55rem;
    }

    .nav-item i {
        font-size: 1rem;
    }

    .main-content {
        padding: 10px;
        padding-left: 10px;
        padding-bottom: 80px;
    }

    .chat-panel {
        height: calc(100vh - 160px);
    }

    .slide-panel-content {
        padding: 15px;
    }

    .annotate-workspace {
        grid-template-columns: 1fr;
    }

    .annotation-list {
        margin-top: 12px;
    }

    .metrics-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .metric-card {
        padding: 12px;
        flex-direction: row;
    }

    .metric-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .metric-value {
        font-size: 1.4rem;
    }

    .satisfaction-display {
        flex-direction: column;
        gap: 20px;
    }

    .survey-options {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .survey-option {
        flex: 1;
        min-width: 80px;
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .chat-messages {
        max-height: 250px;
        min-height: 120px;
    }

    .message-content {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 6px;
    }

    .glass-header {
        padding: 6px 10px;
    }

    .logo h1 {
        font-size: 0.9rem;
    }

    .header-btn {
        padding: 5px 8px;
    }

    .header-btn i {
        font-size: 0.85rem;
    }

    .icon-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .quick-btn {
        padding: 6px 2px;
        border-radius: 8px;
    }

    .quick-btn i {
        font-size: 0.85rem;
    }

    .quick-btn span {
        font-size: 0.6rem;
    }

    .metrics-summary {
        grid-template-columns: 1fr 1fr;
    }

    .metric-card {
        padding: 10px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    .gallery-item img {
        height: 60px;
    }

    .gallery-caption {
        font-size: 0.65rem;
        padding: 2px 4px;
    }

    .tab {
        padding: 4px 8px;
        font-size: 0.75rem;
        gap: 3px;
    }

    .modal-content {
        border-radius: 16px;
    }

    .survey-option {
        min-width: 70px;
        padding: 8px 6px;
        font-size: 0.75rem;
    }

    .survey-option i {
        font-size: 0.9rem;
    }
}

/* Landscape phone */
@media (max-width: 991px) and (orientation: landscape) {
    .chat-messages {
        max-height: 180px;
    }

    .gallery-grid {
        max-height: 200px;
    }
}
