/* ============================================
   Ghost Chat Widget Styles
   ============================================ */

/* Main Widget */
#ghost-chat-widget { 
    position: fixed; 
    bottom: 20px; 
    left: 20px; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; 
    z-index: 9999999; 
}

/* Hide original launcher button (replaced by AI Toolbox) */
#ghost-chat-button {
    display: none !important;
}

/* AI-Style Button with Gradient */
#ghost-chat-button { 
    width: 60px; 
    height: 60px; 
    border-radius: 30px; 
    background: linear-gradient(135deg, #2d3436 0%, #1a1a1a 50%, #000000 100%);
    border: none; 
    cursor: pointer; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#ghost-chat-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

#ghost-chat-button:hover { 
    transform: scale(1.08); 
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.6), 0 4px 15px rgba(0, 0, 0, 0.5);
}

#ghost-chat-button:hover::before {
    left: 100%;
}

#ghost-chat-button.active {
    width: 72px;
    height: 72px;
    border-radius: 36px;
    transform: scale(1.2);
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.6), 0 4px 15px rgba(0, 0, 0, 0.5);
}

#ghost-chat-button.active img {
    width: 38px;
    height: 38px;
}

#ghost-chat-button img { 
    width: 32px; 
    height: 32px; 
    filter: brightness(0) invert(1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
}

/* Container with size modes */
#ghost-chat-container { 
    display: none; 
    position: fixed; 
    background: white; 
    border-radius: 16px; 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12); 
    flex-direction: column; 
    overflow: hidden; 
    transition: all 0.3s ease; 
    z-index: 9999999; 
}

#ghost-chat-container.open { 
    display: flex; 
}

#ghost-chat-container.size-small { 
    width: 608px; 
    height: 810px; 
    max-width: calc(100vw - 60px); 
    max-height: calc(100vh - 140px); 
    bottom: 100px; 
    left: 20px; 
}

#ghost-chat-container.size-large { 
    width: 67.5vw; 
    height: 90vh; 
    max-width: 1200px; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
    bottom: auto; 
}

#ghost-chat-container.fullscreen { 
    width: 100vw !important; 
    height: 100vh !important; 
    max-width: 100vw !important; 
    max-height: 100vh !important; 
    top: 0 !important; 
    left: 0 !important; 
    bottom: 0 !important; 
    right: 0 !important; 
    border-radius: 0 !important; 
    transform: none !important; 
    z-index: 2147483647 !important; 
}

/* Hide all widget buttons when thinking partner is in fullscreen */
body:has(#ghost-chat-container.fullscreen) #ai-ds-button,
body:has(#ghost-chat-container.fullscreen) #relationship-mapper-button,
body:has(#ghost-chat-container.fullscreen) #briefing-button,
body:has(#ghost-chat-container.fullscreen) #ghost-chat-button {
    display: none !important;
    z-index: -1 !important;
    pointer-events: none !important;
}

/* Header */
#ghost-chat-header { 
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%); 
    color: white; 
    padding: 12px 16px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid rgba(255,255,255,0.1);
    overflow: hidden;
    min-width: 0;
}

#ghost-chat-header-left { 
    display: flex; 
    align-items: center; 
    gap: 10px;
    flex-shrink: 0;
    min-width: 0;
}

#ghost-chat-header-left > div:first-child {
    flex-shrink: 0;
}

#ghost-chat-header-left img { 
    height: 28px;
    width: auto;
    display: block;
}

#ghost-chat-header-left h3 { 
    margin: 0; 
    font-size: 16px; 
    font-weight: 600; 
    color: white; 
}

#ghost-chat-header-left > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ghost-function-indicator {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

#ghost-current-function-name {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

#ghost-chat-header-right { 
    display: flex; 
    align-items: center; 
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
}

/* Usage Display */
.ghost-usage-display {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.ghost-usage-display:hover {
    background: rgba(255,255,255,0.25);
}

.ghost-usage-display.low {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.ghost-usage-display.critical {
    background: rgba(220, 53, 69, 0.3);
    color: #ff6b6b;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Usage Details Panel */
.ghost-usage-panel {
    display: none;
    background: white;
    border-bottom: 1px solid #e1e4e8;
    padding: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.ghost-usage-panel.open {
    display: block;
}

.ghost-usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ghost-usage-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #2d3436;
}

#ghost-usage-close {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ghost-usage-close:hover {
    color: #2d3436;
}

.ghost-usage-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ghost-usage-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.ghost-usage-label {
    color: #666;
    font-weight: 500;
}

.ghost-usage-value {
    color: #2d3436;
    font-weight: 600;
}

.ghost-usage-progress {
    margin-top: 8px;
}

.ghost-usage-progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e4e8;
    border-radius: 4px;
    overflow: hidden;
}

.ghost-usage-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.ghost-usage-progress-fill.low {
    background: linear-gradient(90deg, #ffc107 0%, #ff9800 100%);
}

.ghost-usage-progress-fill.critical {
    background: linear-gradient(90deg, #dc3545 0%, #c82333 100%);
}

/* Header Buttons */
.ghost-header-btn { 
    background: rgba(255,255,255,0.15); 
    border: none; 
    color: white; 
    cursor: pointer; 
    padding: 6px 10px; 
    border-radius: 6px; 
    font-size: 12px; 
    transition: all 0.2s; 
    font-weight: 500; 
}

.ghost-header-btn:hover { 
    background: rgba(255,255,255,0.25); 
}

#ghost-chat-close { 
    background: none; 
    border: none; 
    color: white; 
    cursor: pointer; 
    font-size: 24px; 
    line-height: 1; 
    padding: 0; 
    width: 24px; 
    height: 24px; 
    margin-left: 8px; 
}

/* Tabs */
#ghost-chat-tabs { 
    background: #f7f8fa; 
    padding: 8px 12px; 
    display: flex; 
    gap: 6px; 
    overflow-x: auto; 
    border-bottom: 1px solid #e1e4e8; 
    align-items: center; 
}

#ghost-chat-tabs::-webkit-scrollbar { 
    height: 4px; 
}

#ghost-chat-tabs::-webkit-scrollbar-thumb { 
    background: #ccc; 
    border-radius: 2px; 
}

.ghost-chat-tab { 
    background: white; 
    border: 1px solid #e1e4e8; 
    border-radius: 8px; 
    padding: 6px 10px; 
    cursor: pointer; 
    font-size: 13px; 
    white-space: nowrap; 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    transition: all 0.2s; 
    min-width: 120px; 
    max-width: 160px; 
}

.ghost-chat-tab:hover { 
    border-color: #2d3436; 
}

.ghost-chat-tab.active { 
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%); 
    color: white; 
    border-color: #2d3436; 
}

.ghost-chat-tab-name { 
    flex: 1; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    cursor: pointer; 
}

.ghost-chat-tab-edit { 
    background: none; 
    border: none; 
    color: inherit; 
    cursor: pointer; 
    padding: 4px; 
    border-radius: 4px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s; 
    opacity: 0.6; 
}

.ghost-chat-tab-edit:hover { 
    background: rgba(0,0,0,0.1); 
    opacity: 1; 
}

.ghost-chat-tab.active .ghost-chat-tab-edit:hover { 
    background: rgba(255,255,255,0.2); 
}

.ghost-chat-tab-edit svg { 
    width: 12px; 
    height: 12px; 
}

.ghost-chat-tab-delete { 
    background: rgba(255,255,255,0.2); 
    border: none; 
    color: inherit; 
    cursor: pointer; 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 12px; 
    line-height: 1; 
}

.ghost-chat-tab-delete:hover { 
    background: rgba(255,0,0,0.7); 
    color: white; 
}

.ghost-chat-tab.active .ghost-chat-tab-delete:hover { 
    background: rgba(255,255,255,0.9); 
    color: #000; 
}

#ghost-chat-new-tab { 
    background: #2d3436; 
    color: white; 
    border: none; 
    border-radius: 8px; 
    padding: 6px 12px; 
    cursor: pointer; 
    font-size: 13px; 
    font-weight: 600; 
    white-space: nowrap; 
    transition: all 0.2s; 
}

#ghost-chat-new-tab:hover { 
    background: #000; 
}

/* Messages */
#ghost-chat-messages { 
    flex: 1; 
    overflow-y: auto; 
    padding: 20px; 
    background: #f7f8fa; 
}

.ghost-chat-message { 
    margin-bottom: 16px; 
    display: flex; 
    flex-direction: column; 
}

.ghost-chat-message.user { 
    align-items: flex-end; 
}

.ghost-chat-message.assistant { 
    align-items: flex-start; 
}

.ghost-chat-bubble { 
    max-width: 80%; 
    padding: 12px 16px; 
    border-radius: 12px; 
    word-wrap: break-word; 
    line-height: 1.5; 
    overflow-x: auto; 
}

.ghost-chat-bubble strong { 
    font-weight: 700; 
}

.ghost-chat-bubble em { 
    font-style: italic; 
}

.ghost-chat-bubble li { 
    margin: 4px 0; 
}

.ghost-chat-bubble h1, 
.ghost-chat-bubble h2, 
.ghost-chat-bubble h3 { 
    margin: 12px 0 8px 0; 
}

.ghost-chat-bubble table { 
    width: 100%; 
    margin: 12px 0; 
    border-collapse: collapse; 
    font-size: 13px; 
}

.ghost-chat-bubble table th { 
    background: rgba(0,0,0,0.05); 
    font-weight: 600; 
}

.ghost-chat-bubble table th, 
.ghost-chat-bubble table td { 
    border: 1px solid rgba(0,0,0,0.1); 
    padding: 8px; 
    text-align: left; 
}

.ghost-chat-bubble pre { 
    background: rgba(0,0,0,0.05); 
    padding: 10px; 
    border-radius: 6px; 
    overflow-x: auto; 
    margin: 8px 0; 
}

.ghost-chat-bubble code { 
    font-family: 'Courier New', monospace; 
    font-size: 12px; 
}

.ghost-chat-bubble ul, 
.ghost-chat-bubble ol { 
    margin: 8px 0; 
    padding-left: 20px; 
}

.ghost-chat-bubble blockquote { 
    border-left: 3px solid #2d3436; 
    padding-left: 12px; 
    margin: 8px 0; 
    color: #666; 
    font-style: italic; 
}

.ghost-chat-bubble hr { 
    border: none; 
    border-top: 1px solid rgba(0,0,0,0.1); 
    margin: 16px 0; 
}

.ghost-chat-message.user .ghost-chat-bubble { 
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%); 
    color: white; 
    border-bottom-right-radius: 4px; 
}

.ghost-chat-message.assistant .ghost-chat-bubble { 
    background: white; 
    color: #333; 
    border-bottom-left-radius: 4px; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); 
}

/* Articles */
.ghost-chat-articles { 
    margin-top: 12px; 
    max-width: 80%; 
}

.ghost-chat-article { 
    background: white; 
    padding: 10px; 
    margin-bottom: 8px; 
    border-radius: 8px; 
    border-left: 3px solid #2d3436; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); 
}

.ghost-chat-article a { 
    color: #2d3436; 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 14px; 
}

.ghost-chat-article a:hover { 
    text-decoration: underline; 
}

.ghost-chat-article p { 
    margin: 4px 0 0 0; 
    font-size: 12px; 
    color: #666; 
}

/* Input Area */
#ghost-chat-input-area { 
    padding: 16px; 
    background: white; 
    border-top: 1px solid #e1e4e8; 
    display: flex; 
    flex-direction: column;
    gap: 12px; 
}

/* Function Controls */
#ghost-chat-function-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#ghost-chat-function-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

#ghost-chat-function-selector label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

#ghost-function-dropdown {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: #2d3436;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

#ghost-function-dropdown:hover {
    border-color: #2d3436;
}

#ghost-function-dropdown:focus {
    border-color: #2d3436;
    box-shadow: 0 0 0 3px rgba(45, 52, 54, 0.1);
}

#ghost-chat-article-toggle {
    display: flex;
    align-items: center;
}

.ghost-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    user-select: none;
}

.ghost-toggle-label input[type="checkbox"] {
    display: none;
}

.ghost-toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #e1e4e8;
    border-radius: 12px;
    transition: background 0.3s;
}

.ghost-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ghost-toggle-label input[type="checkbox"]:checked + .ghost-toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ghost-toggle-label input[type="checkbox"]:checked + .ghost-toggle-slider::before {
    transform: translateX(20px);
}

.ghost-toggle-text {
    font-weight: 500;
    color: #2d3436;
}

#ghost-chat-input-wrapper {
    display: flex;
    gap: 8px;
    order: 2;
}

#ghost-chat-input { 
    flex: 1; 
    padding: 12px; 
    border: 1px solid #e1e4e8; 
    border-radius: 8px; 
    font-size: 14px; 
    resize: none; 
    font-family: inherit; 
    outline: none; 
    min-height: 48px; 
}

#ghost-chat-input:focus { 
    border-color: #2d3436; 
}

#ghost-chat-send { 
    padding: 12px 20px; 
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%); 
    color: white; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: opacity 0.2s; 
}

#ghost-chat-send:hover:not(:disabled) { 
    opacity: 0.9; 
}

#ghost-chat-send:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

/* Loading Animation */
.ghost-chat-loading { 
    display: flex; 
    gap: 4px; 
    padding: 12px 16px; 
}

.ghost-chat-loading-dot { 
    width: 8px; 
    height: 8px; 
    border-radius: 50%; 
    background: #2d3436; 
    animation: loading 1.4s infinite ease-in-out both; 
}

.ghost-chat-loading-dot:nth-child(1) { 
    animation-delay: -0.32s; 
}

.ghost-chat-loading-dot:nth-child(2) { 
    animation-delay: -0.16s; 
}

@keyframes loading { 
    0%, 80%, 100% { 
        transform: scale(0); 
    } 
    40% { 
        transform: scale(1); 
    } 
}

/* Modal for rename */
#ghost-rename-modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    background: rgba(0,0,0,0.5); 
    z-index: 10000; 
    align-items: center; 
    justify-content: center; 
}

#ghost-rename-modal.open { 
    display: flex; 
}

#ghost-rename-content { 
    background: white; 
    padding: 24px; 
    border-radius: 12px; 
    max-width: 400px; 
    width: 90%; 
}

#ghost-rename-content h4 { 
    margin: 0 0 16px 0; 
    font-size: 18px; 
    color: #2d3436; 
}

#ghost-rename-input { 
    width: 100%; 
    padding: 10px; 
    border: 1px solid #e1e4e8; 
    border-radius: 6px; 
    font-size: 14px; 
    font-family: inherit; 
    margin-bottom: 16px; 
}

#ghost-rename-buttons { 
    display: flex; 
    gap: 8px; 
    justify-content: flex-end; 
}

#ghost-rename-buttons button { 
    padding: 8px 16px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    font-size: 14px; 
}

#ghost-rename-cancel { 
    background: #f7f8fa; 
    color: #333; 
}

#ghost-rename-save { 
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%); 
    color: white; 
}

/* Responsive */
@media (max-width: 768px) { 
    #ghost-chat-button {
        display: none !important;
    }

    #ghost-chat-container.size-small { 
        width: calc(100vw - 40px); 
        height: calc(100vh - 120px); 
        bottom: 90px; 
        left: 20px; 
    }
    
    #ghost-chat-container.size-large { 
        width: calc(100vw - 20px); 
        height: calc(100vh - 20px); 
        top: 50%; 
        left: 50%; 
        transform: translate(-50%, -50%); 
    }
    
    /* Header optimizations for small screens */
    #ghost-chat-header {
        padding: 10px 12px;
    }
    
    #ghost-chat-header-left {
        gap: 8px;
    }
    
    #ghost-chat-header-left > div:first-child {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
    }
    
    #ghost-chat-header-left img {
        height: 20px !important;
    }
    
    #ghost-chat-header-left h3 {
        font-size: 14px !important;
    }
    
    #ghost-chat-header-left > div > div {
        font-size: 9px !important;
    }
    
    #ghost-chat-header-right {
        gap: 4px;
    }
    
    .ghost-header-btn {
        padding: 4px 6px !important;
        min-width: 28px !important;
        height: 28px !important;
    }
    
    .ghost-header-btn i {
        font-size: 14px !important;
    }
    
    #ghost-usage-info {
        display: none !important;
    }
}

/* Hide widget by default - will be shown for logged-in members only */
#ghost-chat-widget { 
    display: block; 
}

/* Mermaid Diagram Styling */
.mermaid-diagram-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 16px 0;
    overflow-x: auto;
    border: 1px solid #e1e4e8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.mermaid-diagram-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.mermaid-diagram-container svg {
    max-width: 100%;
    height: auto;
}

.mermaid-diagram-container .mermaid {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Dark mode support */
.dark-mode #ghost-chat-container {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.dark-mode .mermaid-diagram-container {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
}

.dark-mode .mermaid-diagram-container button {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

/* Sales Qualification Progress Bar - DEPRECATED: Moved to expert-consultation-widget */
.qualification-progress-bar {
    background: #f7f8fa;
    padding: 12px 16px;
    border-bottom: 1px solid #e1e4e8;
}

.qualification-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #2d3436;
}

.qualification-progress-track {
    height: 8px;
    background: #e1e4e8;
    border-radius: 4px;
    overflow: hidden;
}

.qualification-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent) 0%, var(--color-accent-premium) 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.dark-mode .qualification-progress-bar {
    background: var(--color-bg-secondary);
    border-bottom-color: var(--color-border);
}

.dark-mode .qualification-progress-label {
    color: var(--color-text-primary);
}

.dark-mode .qualification-progress-track {
    background: var(--color-bg-primary);
}

/* Email Preview Modal */
.email-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.email-preview-modal.open {
    display: flex;
}

.email-preview-content {
    background: white;
    border-radius: 12px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.email-preview-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-preview-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2d3436;
}

.email-preview-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.email-preview-close:hover {
    background: #f7f8fa;
    color: #2d3436;
}

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

.email-preview-info {
    margin-bottom: 20px;
    padding: 12px;
    background: #e8f5e9;
    border-radius: 6px;
    border-left: 4px solid var(--color-accent);
}

.lead-score {
    font-size: 14px;
    color: #2d3436;
}

.lead-score strong {
    font-size: 18px;
    color: var(--color-accent);
}

.email-preview-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.email-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.email-field label {
    font-size: 13px;
    font-weight: 600;
    color: #2d3436;
}

.email-field input,
.email-field textarea {
    padding: 10px;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.email-field input:focus,
.email-field textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.email-field input[readonly] {
    background: #f7f8fa;
    cursor: not-allowed;
}

.email-field textarea {
    min-height: 300px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

.email-preview-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e1e4e8;
    justify-content: flex-end;
}

.email-send-btn,
.email-copy-btn,
.email-cancel-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.email-send-btn {
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%);
    color: white;
}

.email-send-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.email-copy-btn {
    background: #f7f8fa;
    color: #2d3436;
    border: 1px solid #e1e4e8;
}

.email-copy-btn:hover {
    background: #e1e4e8;
}

.email-cancel-btn {
    background: white;
    color: #666;
    border: 1px solid #e1e4e8;
}

.email-cancel-btn:hover {
    background: #f7f8fa;
}

.dark-mode .email-preview-content {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.dark-mode .email-preview-header {
    border-bottom-color: var(--color-border);
}

.dark-mode .email-preview-header h3 {
    color: var(--color-text-primary);
}

.dark-mode .email-preview-info {
    background: var(--color-bg-secondary);
}

.dark-mode .email-field input,
.dark-mode .email-field textarea {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

/* AI Disclaimer Styles - Shared across all widgets */
.ghost-ai-disclaimer {
    border-top: 1px solid #e1e4e8;
    background: #f7f8fa;
    padding: 0;
}

.ghost-disclaimer-toggle {
    width: 100%;
    padding: 10px 16px;
    background: #f7f8fa;
    border: none;
    border-top: 2px solid #2d3436;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #2d3436;
    transition: background 0.2s;
}

.ghost-disclaimer-toggle:hover {
    background: #e1e4e8;
}

.ghost-disclaimer-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.ghost-disclaimer-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 16px;
}

.ghost-disclaimer-content.open {
    max-height: 500px;
    padding: 16px;
    background: white;
}

.ghost-disclaimer-content p {
    margin: 0 0 12px 0;
    font-size: 11px;
    line-height: 1.6;
    color: #666;
}

.ghost-disclaimer-content p:last-child {
    margin-bottom: 0;
}

.ghost-disclaimer-content strong {
    color: #2d3436;
    font-weight: 600;
}

/* Inline disclaimer styles for generated content */
.briefing-disclaimer,
.ds-disclaimer,
.relationship-disclaimer {
    margin-top: 20px;
    padding: 12px;
    background: #f7f8fa;
    border-left: 3px solid #2d3436;
    border-radius: 4px;
}

.briefing-disclaimer p,
.ds-disclaimer p,
.relationship-disclaimer p {
    margin: 0;
    font-size: 11px;
    color: #666;
    line-height: 1.5;
}

.briefing-disclaimer strong,
.ds-disclaimer strong,
.relationship-disclaimer strong {
    color: #2d3436;
    font-weight: 600;
}

/* Chart.js Visualization Styles */
.ghost-chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 16px 0;
    overflow-x: auto;
    border: 1px solid #e1e4e8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
}

.ghost-chart-container canvas {
    max-width: 100%;
    height: auto;
}

.dark-mode .ghost-chart-container {
    background: #2d3436;
    border-color: #444;
    color: #fff;
}

.dark-mode .ghost-chart-container h4 {
    color: #fff;
}

.dark-mode .email-field input[readonly] {
    background: var(--color-bg-primary);
}

.dark-mode .email-preview-actions {
    border-top-color: var(--color-border);
}

.dark-mode .email-copy-btn,
.dark-mode .email-cancel-btn {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

.dark-mode .ghost-usage-panel {
    background: var(--color-bg-primary);
    border-bottom-color: var(--color-border);
}

.dark-mode .ghost-usage-header h4 {
    color: var(--color-text-primary);
}

.dark-mode .ghost-usage-label {
    color: var(--color-text-secondary);
}

.dark-mode .ghost-usage-value {
    color: var(--color-text-primary);
}

.dark-mode .ghost-usage-progress-bar {
    background: var(--color-bg-secondary);
}

.dark-mode #ghost-usage-close {
    color: var(--color-text-secondary);
}

.dark-mode #ghost-usage-close:hover {
    color: var(--color-text-primary);
}

.dark-mode #ghost-chat-messages {
    background: var(--color-bg-secondary);
}

.dark-mode .ghost-chat-message.assistant .ghost-chat-bubble {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.dark-mode #ghost-chat-input-area {
    background: var(--color-bg-primary);
    border-top-color: var(--color-border);
}

.dark-mode #ghost-chat-input {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

.dark-mode .ghost-chat-article {
    background: var(--color-bg-primary);
    border-left-color: var(--color-accent);
}

.dark-mode #ghost-rename-content {
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
}

.dark-mode #ghost-rename-input {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

