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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: #0a0e17;
    color: #e4e6eb;
    height: 100vh;
    padding: 0;
    margin: 0;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%);
    overflow: hidden;
    width: 100%;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
    gap: 15px;
    overflow: hidden;
}

header {
    color: white;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.header-main {
    padding: 20px 25px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: center;
}

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

.header-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    opacity: 0.95;
    flex-shrink: 0;
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

header h1 {
    font-size: 2.2em;
    margin: 0;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    line-height: 1;
}

.tagline {
    font-size: 1.1em;
    opacity: 0.7;
    color: #9ca3af;
    margin: 0;
}

.header-vin-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 280px;
}

.main-content {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 15px;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-panel, .side-panel {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-panel {
    gap: 15px;
}

.side-panel {
    gap: 15px;
    overflow-y: auto;
}

.side-panel::-webkit-scrollbar {
    width: 8px;
}

.side-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.side-panel::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}

.side-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h2 {
    color: #e4e6eb;
    font-size: 1.5em;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector label {
    font-size: 0.9em;
    color: #9ca3af;
    font-weight: 500;
}

.model-dropdown {
    padding: 8px 14px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.1);
    font-size: 0.9em;
    color: #e4e6eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.model-dropdown:hover {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.2);
}

.model-dropdown:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.model-used {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 8px;
    font-size: 0.75em;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    min-height: 0;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

.message {
    margin-bottom: 20px;
    animation: slideInMessage 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.message-content {
    padding: 16px 18px;
    border-radius: 12px;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.user-message .message-content {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: white;
    margin-left: 60px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-message .message-content:hover {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.assistant-message .message-content {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 85, 247, 0.2);
    margin-right: 60px;
    color: #e4e6eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-message .message-content:hover {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.2);
    transform: translateY(-2px);
}

.system-message .message-content {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.9em;
}

.system-message .message-content p {
    margin: 4px 0;
}

.system-message .message-content p:first-child {
    font-size: 1em;
}

.system-message .message-content p:last-child {
    font-size: 0.9em;
    opacity: 0.8;
}

.message-content .note {
    font-size: 0.9em;
    opacity: 0.7;
    margin-top: 10px;
}

.sources {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 0.9em;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.source-item {
    padding: 8px;
    margin-top: 5px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #a5b4fc;
}

.source-item:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
}

.btn-tech-story {
    padding: 14px 18px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.btn-tech-story:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.tsb-selector {
    margin-bottom: 15px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    flex-shrink: 0;
}

#tsb-search {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: #e4e6eb;
    font-size: 0.95em;
}

#tsb-search:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#tsb-dropdown {
    width: 100%;
    padding: 10px;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: #e4e6eb;
    margin-bottom: 12px;
}

#tsb-dropdown option {
    background: #1e293b;
    color: #e4e6eb;
    padding: 10px;
}

.tsb-selector-actions {
    display: flex;
    gap: 10px;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    width: 100%;
    flex-shrink: 0;
}

.input-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
}

.vin-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

#vin-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: #e4e6eb;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

#vin-input:focus {
    outline: none;
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(30, 41, 59, 0.7);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#vin-input::placeholder {
    color: rgba(228, 230, 235, 0.35);
    text-transform: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.9em;
}

.btn-vin-action {
    padding: 12px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.95em;
}

.btn-vin-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-vin-secondary {
    padding: 12px 18px;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.9em;
}

.btn-vin-secondary:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.current-vehicle {
    margin-top: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: #e4e6eb;
    font-size: 0.9em;
}

#vehicle-info-text {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

#vehicle-info-text::before {
    content: "🚗";
    font-size: 1.2em;
}

#user-input {
    width: 100%;
    padding: 14px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    color: #e4e6eb;
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
    min-height: 60px;
    transition: all 0.2s ease;
}

.suggestions-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
    transition: all 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateX(4px);
}

.suggestion-tsb {
    font-weight: 600;
    color: #a855f7;
    margin-bottom: 4px;
}

.suggestion-confidence {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    font-size: 0.85em;
    margin-left: 8px;
}

.suggestion-reasons {
    font-size: 0.85em;
    color: #9ca3af;
    margin-top: 4px;
}

.vehicle-badge {
    display: inline-block;
    padding: 4px 10px;
    margin: 6px 0 4px 0;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.3));
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 6px;
    font-size: 0.8em;
    color: #10b981;
    font-weight: 600;
}

.suggestion-item.vehicle-match {
    background: rgba(16, 185, 129, 0.05);
    border-left: 3px solid #10b981;
    padding-left: 13px;
}

.suggestion-item.vehicle-match:hover {
    background: rgba(16, 185, 129, 0.15);
}

#user-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background: rgba(30, 41, 59, 0.8);
}

#user-input::placeholder {
    color: #6b7280;
}

.btn-primary {
    padding: 14px 28px;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 15px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    margin-top: 15px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-indicator span {
    color: #a5b4fc;
    font-size: 0.95em;
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 16px 20px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    margin-right: 60px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Progress Container with Status and Cancel */
.progress-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 12px;
    margin-right: 60px;
    max-width: 350px;
}

.progress-status {
    font-size: 0.85em;
    color: rgba(228, 230, 235, 0.7);
    font-style: italic;
    text-align: center;
}

.cancel-request-btn {
    align-self: center;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.3);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    color: #e4e6eb;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

.cancel-request-btn:hover {
    background: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

/* Error Message Styling */
.error-message {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.error-fallback {
    margin-top: 16px;
    padding: 12px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.error-fallback p {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    color: rgba(228, 230, 235, 0.8);
}

.fallback-btn {
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 8px;
    color: #e4e6eb;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    text-align: left;
}

.fallback-btn:hover {
    background: rgba(99, 102, 241, 0.5);
    transform: translateX(4px);
    border-color: rgba(99, 102, 241, 0.6);
}

/* Gradient Text for Op Codes and Part Numbers */
.highlight-code {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Copy Button */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    margin-left: 8px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: #a5b4fc;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0) scale(0.95);
}

.copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #6ee7b7;
}

/* Feedback Buttons */
.feedback-btn {
    padding: 8px 14px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    transform: scale(1.1);
}

.feedback-btn:active {
    transform: scale(0.95);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 16px 24px;
    background: rgba(16, 185, 129, 0.95);
    backdrop-filter: blur(20px);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    font-size: 0.95em;
    animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
}

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

/* Voice Input Button */
.voice-btn {
    padding: 14px 18px;
    background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.voice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(236, 72, 153, 0.4);
}

.voice-btn.listening {
    animation: pulse 1.5s infinite;
    background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 24px rgba(236, 72, 153, 0.5);
    }
}

.visual-context {
    flex-shrink: 0;
}

.visual-context h3 {
    color: #e4e6eb;
    margin-bottom: 12px;
    font-size: 1.05em;
    font-weight: 600;
}

.pdf-viewer {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    flex: 1;
    min-height: 0;
    text-align: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pdf-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.pdf-nav-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pdf-nav-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.pdf-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    color: #a5b4fc;
    font-weight: 600;
    font-size: 0.95em;
    min-width: 120px;
}

.pdf-content {
    margin-top: 10px;
}

.pdf-viewer img {
    max-width: 100%;
    height: auto;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: block;
}

.pdf-viewer .placeholder {
    color: #6b7280;
    padding: 60px 20px;
    font-size: 0.95em;
}

.document-browser {
    flex-shrink: 0;
}

.document-browser h3 {
    color: #e4e6eb;
    margin-bottom: 12px;
    font-size: 1.05em;
    font-weight: 600;
}

.doc-search {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    color: #e4e6eb;
    font-size: 0.95em;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.doc-search:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.doc-search::placeholder {
    color: #6b7280;
}

.doc-browser-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 10px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.doc-browser-list .placeholder {
    color: #6b7280;
    padding: 20px;
    text-align: center;
    font-size: 0.9em;
}

.doc-item {
    padding: 10px 12px;
    margin-bottom: 6px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.doc-item:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateX(2px);
}

.doc-item:last-child {
    margin-bottom: 0;
}

.doc-item-name {
    color: #e4e6eb;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uploader-section {
    flex-shrink: 0;
}

.uploader-section h3 {
    color: #e4e6eb;
    margin-bottom: 12px;
    font-size: 1.05em;
    font-weight: 600;
}

.upload-area {
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-area:hover {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.05);
}

.upload-label {
    cursor: pointer;
}

.upload-icon {
    font-size: 2em;
    margin-bottom: 10px;
    opacity: 0.7;
}

.upload-area p {
    color: #9ca3af;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.85em;
    color: #6b7280;
}

.upload-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9em;
}

.upload-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Upload Button - New Clean Design */
.btn-upload {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    margin-bottom: 12px;
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

.btn-upload:active {
    transform: translateY(0);
}

/* View Library Button */
.btn-view-library {
    width: 100%;
    padding: 10px 16px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    flex-shrink: 0;
}

.btn-view-library:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

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

.library-modal-content {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 30px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
}

@media (max-width: 768px) {
    .library-modal-content {
        width: 95vw;
        max-width: 95vw;
        max-height: 90vh;
        padding: 20px;
        border-radius: 16px;
    }
}

.library-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.library-modal-header h3 {
    color: #e4e6eb;
    font-size: 1.5em;
    margin: 0;
}

.close-library-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 1.5em;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-library-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.documents-list {
    margin-top: 25px;
}

.documents-list h4 {
    color: #9ca3af;
    margin-bottom: 12px;
    font-size: 1em;
    font-weight: 500;
}

.documents {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.documents::-webkit-scrollbar {
    width: 6px;
}

.documents::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.documents::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 10px;
}

.document-item {
    padding: 12px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.document-item:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(99, 102, 241, 0.3);
}

.document-item:last-child {
    margin-bottom: 0;
}

.document-name {
    color: #e4e6eb;
    font-size: 0.9em;
    flex: 1;
}

.document-meta {
    color: #6b7280;
    font-size: 0.8em;
    margin-right: 10px;
}

.btn-delete {
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Mobile Header (Gemini-style) */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 23, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    padding: 12px 16px;
    z-index: 1000;
    height: 56px;
    align-items: center;
    justify-content: space-between;
}

.mobile-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hamburger-btn {
    background: transparent;
    border: none;
    color: #e4e6eb;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-logo svg {
    width: 32px;
    height: 32px;
}

.mobile-header-title {
    font-size: 1.2em;
    font-weight: 600;
    color: #e4e6eb;
    margin: 0;
}

.mobile-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1em;
}

/* Full-screen Document Viewer Modal */
.fullscreen-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    flex-direction: column;
}

.fullscreen-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(17, 24, 39, 0.95);
    border-bottom: 1px solid rgba(99, 102, 241, 0.3);
}

.fullscreen-viewer-title {
    color: #e4e6eb;
    font-size: 1em;
    font-weight: 600;
    flex: 1;
    margin: 0 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fullscreen-viewer-close {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.fullscreen-viewer-close:active {
    transform: scale(0.95);
}

.fullscreen-viewer-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
}

.fullscreen-viewer-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(17, 24, 39, 0.95);
    border-top: 1px solid rgba(99, 102, 241, 0.3);
}

.fullscreen-nav-btn {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    min-width: 100px;
}

.fullscreen-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.fullscreen-nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.fullscreen-page-indicator {
    color: #9ca3af;
    font-size: 0.9em;
    min-width: 80px;
    text-align: center;
}

/* Hamburger Menu Drawer */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
    backdrop-filter: blur(4px);
}

.menu-overlay.active {
    display: block;
}

.hamburger-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    bottom: 0;
    width: 80%;
    max-width: 320px;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(99, 102, 241, 0.3);
    z-index: 2000;
    overflow-y: auto;
    transition: left 0.3s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.hamburger-menu.active {
    left: 0;
}

.menu-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.menu-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.1em;
}

.menu-user-name {
    color: #e4e6eb;
    font-weight: 600;
    font-size: 1em;
}

.menu-items {
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    color: #e4e6eb;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1em;
}

.menu-item:active {
    background: rgba(99, 102, 241, 0.2);
}

.menu-item-icon {
    font-size: 1.3em;
    min-width: 24px;
    text-align: center;
}

.menu-item-text {
    flex: 1;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 20px;
}

.menu-section-title {
    padding: 12px 20px 8px;
    color: #9ca3af;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Tablet & Mobile Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 12px;
    }

    .container {
        padding: 12px;
        gap: 12px;
    }

    .side-panel {
        overflow-y: auto;
    }
}

@media (max-width: 768px) {
    /* GEMINI-STYLE MOBILE: Full-screen chat experience */
    
    body {
        padding: 0;
        overflow: hidden;
    }

    .container {
        width: 100%;
        padding: 0;
        gap: 0;
        height: 100vh;
        padding-top: 56px;
    }

    /* Hide desktop header completely */
    header {
        display: none !important;
    }

    /* Show mobile header */
    .mobile-header {
        display: flex !important;
    }

    /* Show hamburger menu drawer when visible */
    .hamburger-menu {
        display: block;
    }

    /* MOBILE: Full-screen chat window */
    .main-content {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        width: 100%;
        height: calc(100vh - 56px);
        overflow: hidden;
    }

    .chat-panel {
        padding: 0;
        width: 100%;
        min-width: 0;
        min-height: 0;
        gap: 0;
        flex: 1;
        border-radius: 0;
        border: none;
        background: transparent;
        overflow: hidden;
    }

    /* Hide side panel completely on mobile */
    .side-panel {
        display: none !important;
    }

    /* Hide chat header on mobile (moved to mobile header) */
    .chat-header {
        display: none !important;
    }

    /* Full-screen chat messages (Gemini style) */
    .chat-messages {
        flex: 1;
        min-height: 0;
        max-height: calc(100vh - 56px - 80px);
        padding: 16px;
        padding-bottom: 80px;
        background: transparent;
        border-radius: 0;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .user-message .message-content {
        margin-left: 0;
        width: 100%;
    }

    .assistant-message .message-content {
        margin-right: 0;
        width: 100%;
    }

    .sources {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        font-size: 0.85em;
        padding: 8px 16px;
    }

    .source-item {
        word-break: break-word;
        padding: 6px 10px;
        font-size: 0.85em;
    }

    /* Gemini-style bottom input bar */
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
        align-items: flex-end;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: rgba(10, 14, 23, 0.95);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(99, 102, 241, 0.2);
        z-index: 100;
    }

    .input-actions {
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: center;
    }

    .input-actions button {
        padding: 10px !important;
        font-size: 1.2em !important;
        min-height: 44px;
        min-width: 44px;
        border-radius: 50% !important;
        background: rgba(99, 102, 241, 0.1);
        border: 1px solid rgba(99, 102, 241, 0.3);
    }

    .input-wrapper {
        flex: 1;
    }

    #user-input {
        min-height: 44px;
        max-height: 120px;
        width: 100%;
        padding: 12px 16px;
        font-size: 1em;
        border-radius: 24px;
        resize: none;
        overflow-y: auto;
    }

    .btn-primary {
        padding: 12px 20px !important;
        font-size: 1em !important;
        white-space: nowrap;
        border-radius: 24px !important;
        min-height: 44px;
    }

    .btn-tech-story {
        font-size: 1.3em !important;
    }

    .voice-btn {
        font-size: 1.3em !important;
    }

    .tsb-selector {
        position: fixed;
        bottom: 80px; /* Above chat input bar */
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        z-index: 1100; /* Above chat input */
        margin: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    }

    #tsb-search,
    #tsb-dropdown {
        width: 100%;
        max-width: 100%;
    }

    .tsb-selector-actions {
        flex-direction: column;
        width: 100%;
    }

    .tsb-selector-actions .btn-secondary {
        width: 100%;
        max-width: 100%;
    }

    .pdf-viewer {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }

    .pdf-controls {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .pdf-nav-btn {
        flex: 1;
        min-width: 80px;
    }

    .page-indicator {
        width: 100%;
        text-align: center;
    }

    .document-browser h3,
    .visual-context h3,
    .uploader-section h3 {
        font-size: 1.1em;
        word-break: break-word;
    }

    .doc-browser-list {
        max-height: 200px;
        width: 100%;
    }

    .doc-search {
        width: 100%;
        max-width: 100%;
    }

    .documents {
        max-height: 200px;
        width: 100%;
    }

    .upload-area {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .header-logo {
        width: 50px;
        height: 50px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .tagline {
        font-size: 0.9em;
    }

    .chat-header h2 {
        font-size: 1.1em;
    }

    .message-content {
        padding: 12px 14px;
        font-size: 0.95em;
    }

    .chat-messages {
        height: 350px;
        padding: 10px;
    }

    .sources {
        font-size: 0.85em;
        padding: 10px;
    }

    .source-item {
        padding: 6px;
        font-size: 0.9em;
    }

    .btn-tech-story {
        padding: 12px;
        font-size: 0.95em;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-icon {
        font-size: 2.5em;
    }

    .pdf-viewer {
        padding: 12px;
    }

    .pdf-nav-btn {
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .doc-item,
    .document-item {
        padding: 10px;
        font-size: 0.9em;
    }
}

/* Touch-friendly improvements for mobile */
@media (hover: none) and (pointer: coarse) {
    .btn-primary,
    .btn-secondary,
    .btn-tech-story,
    .pdf-nav-btn,
    .source-item,
    .doc-item,
    .document-item {
        min-height: 44px; /* iOS recommended touch target size */
    }

    .chat-input-container #user-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    #tsb-search,
    .doc-search,
    .model-dropdown {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
}

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

.modal-content {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 24px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.modal-body {
    padding: 24px;
    overflow-y: auto;
    color: #e4e6eb;
    line-height: 1.6;
}

.modal-body h3,
.modal-body h4 {
    color: #ffffff;
}

.modal-body p {
    margin-bottom: 12px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
}
