/* Right sidebar, tooltips, welcome screen, modals, privacy content,
 * auth overlay, guest ticket section, custom dialogs, privacy banner.
 * Extracted from styles.css lines 2387-3455.
 */

/* Right Sidebar */
.right-sidebar {
    width: 320px;
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow: hidden;
    border-radius: 12px;
    margin: 8px;
    margin-left: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: width 0.3s ease, margin 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    order: 4;
}

.right-sidebar.collapsed {
    width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
}

/* Hide settings button when panel is expanded */
#toggleSettingsBtn {
    display: none;
}

.right-sidebar.collapsed ~ .main-content #toggleSettingsBtn {
    display: flex;
}

.settings {
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

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

.settings-header h2 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.settings-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.settings-close-btn svg {
    font-size: 20px;
}

.setting-group {
    margin-bottom: 0;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-top: 32px;
}

.setting-group:first-child {
    margin-top: 0;
    padding-top: 0;
}

 .setting-group.no-border {
     border-bottom: none;
 }

 .setting-item {
     margin-bottom: 24px;
 }

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-primary);
    gap: 8px;
}

.setting-label > span:first-child {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.setting-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    cursor: help;
    vertical-align: middle;
    flex-shrink: 0;
}

.setting-tooltip svg {
    color: var(--text-secondary);
    opacity: 0.6;
    transition: opacity 0.2s ease, color 0.2s ease;
    display: block;
}

.setting-tooltip:hover svg {
    opacity: 1;
    color: var(--blue-accent);
}

/* JavaScript-generated tooltip styles */
.tooltip-box {
    position: fixed;
    background-color: rgba(30, 41, 59, 0.95);
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    width: 280px;
    pointer-events: none;
    z-index: 10002;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    animation: tooltipFadeIn 0.15s ease-out;
}

.tooltip-arrow {
    position: fixed;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    pointer-events: none;
    z-index: 10002;
    animation: tooltipFadeIn 0.15s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

 .slider-container {
     display: flex;
     align-items: center;
     gap: 16px;
 }

 .slider-container input[type="range"] {
     flex: 1;
     -webkit-appearance: none;
     appearance: none;
     height: 6px;
     background: var(--bg-hover);
     border-radius: 3px;
     outline: none;
 }

 .slider-container input[type="range"]::-webkit-slider-runnable-track {
     height: 6px;
     border-radius: 3px;
     background: linear-gradient(to right, var(--blue-accent) 0%, var(--blue-accent) var(--slider-value, 35%), var(--bg-hover) var(--slider-value, 35%), var(--bg-hover) 100%);
 }

 .slider-container input[type="range"]::-moz-range-track {
     height: 6px;
     border-radius: 3px;
     background: var(--bg-hover);
 }

 .slider-container input[type="range"]::-moz-range-progress {
     height: 6px;
     border-radius: 3px;
     background: var(--blue-accent);
 }

 .slider-container input[type="range"]::-webkit-slider-thumb {
     -webkit-appearance: none;
     appearance: none;
     width: 20px;
     height: 20px;
     background: var(--blue-accent);
     border-radius: 50%;
     cursor: pointer;
     transition: box-shadow 0.2s, background-color 0.2s;
     border: none;
     box-shadow: 0 0 0 1px rgba(3, 105, 161, 0.2);
     margin-top: -7px;
 }

 .slider-container input[type="range"]::-webkit-slider-thumb:hover {
     box-shadow: 0 0 0 6px rgba(3, 105, 161, 0.15);
     background-color: var(--gemini-blue);
 }

 .slider-container input[type="range"]::-moz-range-thumb {
     width: 20px;
     height: 20px;
     background: var(--blue-accent);
     border-radius: 50%;
     cursor: pointer;
     border: none;
     box-shadow: 0 0 0 1px rgba(3, 105, 161, 0.2);
     transition: box-shadow 0.2s, background-color 0.2s;
     margin-top: 0;
 }

 .slider-container input[type="range"]::-moz-range-thumb:hover {
     box-shadow: 0 0 0 6px rgba(3, 105, 161, 0.15);
     background-color: var(--gemini-blue);
 }

 .slider-container .value-box {
     width: 70px;
     text-align: center;
     border: none;
     border-radius: 8px;
     padding: 8px 4px;
     font-size: 14px;
     background-color: #ffffff;
     color: var(--text-primary);
     font-family: var(--font-family);
 }

/* Compact slider row for side-by-side label and slider */
.compact-slider-row {
    display: flex;
    align-items: center;
}

 .slider-container .value-box:focus {
     outline: none;
     border: none;
     box-shadow: none;
 }

 .toggle-switch {
     width: 44px;
     height: 24px;
     background-color: var(--bg-switch-inactive);
     border-radius: 12px;
     position: relative;
     cursor: pointer;
     border: 1px solid transparent;
     transition: background-color 0.2s;
 }

 .toggle-switch::after {
     content: '';
     position: absolute;
     width: 20px;
     height: 20px;
     background-color: #ffffff;
     border-radius: 50%;
     top: 1px;
     left: 2px;
     transition: transform 0.2s, background-color 0.2s;
     box-shadow: 0 2px 4px rgba(0,0,0,0.2);
 }

 .toggle-switch.active {
     background-color: var(--blue-accent);
     border-color: transparent;
 }

 .toggle-switch.active::after {
     transform: translateX(18px);
 }
 
.system-prompt-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-panel);
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--text-primary);
    resize: vertical;
    min-height: 160px;
    max-height: 400px;
    transition: border-color 0.2s;
}

.system-prompt-textarea:focus {
    outline: none;
    border-color: var(--blue-accent);
}

.system-prompt-textarea::placeholder {
    color: var(--text-secondary);
}

.save-default-prompt-btn {
    margin-top: 8px;
    margin-left: auto;
    padding: 6px 12px;
    background-color: transparent;
    color: var(--blue-accent);
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    display: block;
}

.save-default-prompt-btn:hover {
    background-color: var(--bg-hover);
    color: #357abd;
}

.save-default-prompt-btn:active {
    transform: scale(0.98);
}

.save-default-prompt-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

 select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-panel);
    font-family: var(--font-family);
    font-size: 15px;
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
}

/* Hide welcome screen when messages exist */
.chat-messages > .message-wrapper ~ .welcome-screen,
.chat-messages > .welcome-screen:not(:first-child),
.chat-messages > .welcome-screen:not(:last-child) {
    display: none !important;
}

.welcome-screen h1 {
    font-size: 44px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.welcome-screen p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.status-badges {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-badge.connected {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.disconnected {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-badge.connected .status-dot {
    background-color: #16a34a;
}

.status-badge.disconnected .status-dot {
    background-color: #dc2626;
}

.status-badge.local-llm-online {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.local-llm-online .status-dot {
    background-color: #16a34a;
}

.status-badge.local-llm-offline {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.local-llm-offline .status-dot {
    background-color: #d97706;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-panel);
    margin: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-panel);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Privacy Content Styles */
.privacy-content {
    font-family: var(--font-family);
    color: var(--text-primary);
    line-height: 1.7;
}

.privacy-section {
    margin-bottom: 28px;
}

.privacy-section:last-child {
    margin-bottom: 0;
}

.privacy-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--blue-accent);
    margin-bottom: 12px;
    line-height: 1.4;
}

.privacy-section p {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.7;
}

.privacy-section p:last-child {
    margin-bottom: 0;
}

.privacy-section strong {
    font-weight: 600;
    color: var(--text-primary);
}

.privacy-footer {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

/* Authentication Overlay Styles */
#auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-box {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 48px 40px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease-out;
}

#auth-title {
    font-size: 28px;
    font-weight: 500;
    text-align: center;
    margin-bottom: 8px;
    margin-top: 0;
    color: var(--text-primary);
}

#auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

.google-btn {
    width: 100%;
    background: var(--blue-accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background-color 0.2s, transform 0.1s;
    font-family: var(--font-family);
}

.google-btn:hover {
    background: var(--gemini-blue);
    transform: translateY(-1px);
}

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

.google-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider span {
    padding: 0 16px;
}

/* Guest Ticket Section */
.guest-ticket-section {
    margin: 0;
}

.guest-ticket-toggle-btn {
    width: 100%;
    background: var(--bg-panel);
    color: var(--blue-accent);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.guest-ticket-toggle-btn:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.guest-ticket-toggle-btn:active {
    transform: translateY(0);
}

.guest-ticket-toggle-btn svg {
    flex-shrink: 0;
}

.guest-ticket-input-container {
    margin-top: 16px;
    padding-top: 16px;
}

.guest-ticket-help {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
    line-height: 1.4;
}

.auth-input-group {
    position: relative;
    margin-bottom: 16px;
}

.auth-input-group .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.auth-input-group input {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-panel);
    color: var(--text-primary);
}

.auth-input-group input:focus {
    outline: none;
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.1);
}

.email-auth-btn {
    width: 100%;
    background: var(--bg-button);
    color: var(--blue-accent);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-family: var(--font-family);
    margin-top: 8px;
}

.email-auth-btn:hover {
    background: var(--bg-button-hover);
    transform: translateY(-1px);
}

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

.auth-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.link-button {
    background: none;
    border: none;
    color: var(--blue-accent);
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-family);
    padding: 0;
    margin-left: 4px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.link-button:hover {
    opacity: 0.8;
    text-decoration: underline;
}

#auth-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-hover);
    border-top-color: var(--blue-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Custom Dialog Styles */
.custom-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-in;
}

.custom-dialog-overlay.show {
    display: flex;
}

.custom-dialog-box {
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 32px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: dialogSlideUp 0.3s ease-out;
    text-align: center;
}

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

.custom-dialog-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-icon {
    background: rgba(251, 191, 36, 0.15);
    color: #f59e0b;
}

.alert-icon svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
}

.confirm-icon {
    background: rgba(3, 105, 161, 0.15);
    color: var(--blue-accent);
}

.confirm-icon svg {
    width: 32px;
    height: 32px;
    stroke: currentColor;
}

.custom-dialog-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.custom-dialog-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 28px 0;
    white-space: pre-wrap;
}

.custom-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.custom-dialog-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
}

.custom-dialog-btn.primary-btn {
    background: var(--blue-accent);
    color: white;
}

.custom-dialog-btn.primary-btn:hover {
    background: var(--gemini-blue);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.3);
}

.custom-dialog-btn.primary-btn:active {
    transform: translateY(0);
}

.custom-dialog-btn.secondary-btn {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.custom-dialog-btn.secondary-btn:hover {
    background: var(--border-color);
    transform: translateY(-1px);
}

.custom-dialog-btn.secondary-btn:active {
    transform: translateY(0);
}

/* Custom AI Modal Input Styles */
#customBotDialog input[type="text"]:focus,
#customBotDialog textarea:focus {
    border-color: #0369a1;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.08);
}

#customBotDialog input[type="text"]:hover,
#customBotDialog textarea:hover {
    border-color: #e0e0e0;
    background: #ffffff;
}

#customBotDialog select:focus {
    background: rgba(3, 105, 161, 0.02);
}

#customBotDialog select:hover {
    background: rgba(0, 0, 0, 0.02);
}

#customBotDialog input[type="text"]::placeholder,
#customBotDialog textarea::placeholder {
    color: #aaa;
}

/* Privacy Mode Banner */
.privacy-mode-banner {
    background: #f5f7fa;
    padding: 10px 24px;
    border-bottom: 1px solid #e2e8f0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.privacy-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #64748b;
}

.privacy-banner-icon {
    flex-shrink: 0;
    color: #64748b;
}

.privacy-banner-text {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0;
}

