/* Leland AI Styles */

/* Leland Button */
.leland-trigger-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white !important;
    transition: all 0.3s ease;
}

.leland-trigger-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white !important;
}

.leland-icon {
    font-style: normal;
}

.leland-icon-large {
    font-size: 2.5rem;
    display: inline-block;
}

/* Modal Header */
.leland-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.5rem 0.5rem 0 0;
}

.leland-header .btn-close {
    filter: brightness(0) invert(1);
}

.leland-header .modal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Action Options */
.leland-action-option {
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leland-action-option:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.leland-action-option:has(input:checked) {
    border-color: #667eea;
    background-color: #f0f3ff;
}

.leland-action-option .form-check-input {
    margin-top: 0.25rem;
}

.leland-action-option label {
    cursor: pointer;
    margin-left: 0.5rem;
}

/* Featured Action (Quick Reply) */
.leland-action-featured {
    background: linear-gradient(135deg, #f0f3ff 0%, #e8ebff 100%);
    border-color: #667eea;
}

.leland-action-featured:hover {
    background: linear-gradient(135deg, #e8ebff 0%, #dde2ff 100%);
}

.leland-action-featured:has(input:checked) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.leland-action-featured:has(input:checked) label {
    color: white;
}

.leland-action-featured:has(input:checked) label strong {
    color: white;
}

.leland-action-featured:has(input:checked) label small {
    color: rgba(255,255,255,0.85) !important;
}

/* Result Box */
.leland-result-box {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
    border: 1px solid #e0e5ff;
    border-radius: 0.5rem;
    padding: 1rem;
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Loading Spinner */
.leland-spinner {
    animation: leland-pulse 1.5s ease-in-out infinite;
}

@keyframes leland-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* Modal Improvements */
#leland-modal {
    z-index: 9999 !important;
}

#leland-modal + .modal-backdrop,
.modal-backdrop.show + #leland-modal ~ .modal-backdrop {
    z-index: 9998 !important;
}

#leland-modal .modal-content {
    border-radius: 0.75rem;
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

#leland-modal .modal-footer {
    background-color: #f8f9fa;
}

/* Button Styles */
#leland-go-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

#leland-go-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

#leland-use-btn {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
}

#leland-use-btn:hover {
    background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
}

/* Responsive */
@media (max-width: 768px) {
    .leland-trigger-btn span.hidden-xs {
        display: none;
    }
    
    .leland-action-option {
        padding: 0.75rem;
    }
}

/* Fade in animation for result */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#leland-result {
    animation: fadeInUp 0.3s ease;
}

/* Sentiment Analysis */
.leland-sentiment-card {
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e9ecef;
    background-color: #f8f9fa;
    animation: fadeInUp 0.3s ease;
}

.leland-sentiment-emoji {
    font-size: 2rem;
    line-height: 1;
}

.leland-sentiment-card.sentiment-frustrated {
    background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%);
    border-color: #fca5a5;
}

.leland-sentiment-card.sentiment-frustrated .leland-sentiment-emoji {
    color: #dc2626;
}

.leland-sentiment-card.sentiment-neutral {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-color: #d1d5db;
}

.leland-sentiment-card.sentiment-neutral .leland-sentiment-emoji {
    color: #6b7280;
}

.leland-sentiment-card.sentiment-happy {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-color: #86efac;
}

.leland-sentiment-card.sentiment-happy .leland-sentiment-emoji {
    color: #16a34a;
}

#leland-sentiment-suggestion {
    font-size: 0.85rem;
}

.icon-12 {
    width: 12px;
    height: 12px;
}

/* Quick Actions */
.leland-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.leland-quick-action {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 2rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    color: #495057;
    transition: all 0.2s ease;
    cursor: pointer;
}

.leland-quick-action:hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #495057;
}

.leland-quick-action.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.leland-quick-action.active:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
}

/* Smart Tone Suggestions */
.leland-tone-suggested {
    position: relative;
    animation: tonePulse 2s ease-in-out infinite;
}

.leland-tone-suggested::after {
    content: '★';
    position: absolute;
    top: -5px;
    right: -10px;
    color: #667eea;
    font-size: 0.75rem;
}

@keyframes tonePulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 8px rgba(102, 126, 234, 0.5); }
}

.leland-apply-tone {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
    margin-left: 5px;
}

.leland-apply-tone:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Response Length Toggle */
#leland-length-group .btn-group {
    display: flex;
}

#leland-length-group .btn {
    flex: 1;
    padding: 0.5rem 0.25rem;
    font-size: 0.85rem;
}

#leland-length-group .btn-check:checked + .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* Response History */
.leland-history-item {
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leland-history-item:hover {
    background-color: #e9ecef;
    border-color: #667eea;
}

.leland-history-item.starred {
    border-color: #fbbf24;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.leland-history-preview {
    font-size: 0.85rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.leland-history-meta {
    font-size: 0.75rem;
    color: #9ca3af;
}

.leland-history-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.leland-history-item:hover .leland-history-actions {
    opacity: 1;
}

/* Thread Summary */
.leland-summary-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #7dd3fc;
    border-radius: 0.5rem;
    padding: 1rem;
}

.leland-summary-card h6 {
    color: #0369a1;
    margin-bottom: 0.75rem;
}

/* Canned Response */
.leland-canned-suggestion {
    padding: 0.5rem 0.75rem;
    background-color: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.leland-canned-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Help Panel */
.leland-help-content {
    max-height: 400px;
    overflow-y: auto;
}

.leland-help-section {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
}

.leland-help-section h6 {
    color: #374151;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.leland-help-section p {
    color: #6b7280;
    font-size: 0.85rem;
    margin-bottom: 0;
    line-height: 1.5;
}

.leland-help-content hr {
    margin: 1rem 0;
    border-color: #e5e7eb;
}

/* What's New Panel */
.leland-whats-new-content {
    display: grid;
    gap: 0.75rem;
}

.leland-feature-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
    border: 1px solid #e0e5ff;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    position: relative;
}

.leland-feature-badge {
    position: absolute;
    top: -8px;
    right: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
}

.leland-feature-card h6 {
    color: #374151;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.leland-feature-card p {
    color: #6b7280;
    font-size: 0.8rem;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Help button styling */
#leland-help-btn {
    padding: 0.375rem 0.5rem;
}

/* Voice Command Floating Button */
.leland-voice-floating {
    position: fixed;
    bottom: 20px;
    right: 80px; /* Positioned to the left of chat icon */
    height: 42px;
    padding: 0 16px;
    border-radius: 21px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9990;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    white-space: nowrap;
}

.leland-voice-floating:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    color: white;
}

.leland-voice-floating.wake-word-active {
    animation: wake-word-pulse 2s infinite;
}

@keyframes wake-word-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.7), 0 0 30px rgba(102, 126, 234, 0.3);
    }
}

/* Voice confirmation listening indicator */
#leland-voice-confirm.listening-for-confirm #leland-voice-confirm-hint {
    animation: confirm-listening-pulse 1.5s infinite;
    color: #667eea;
}

@keyframes confirm-listening-pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

#leland-voice-confirm-hint {
    transition: color 0.3s ease;
}

.leland-voice-floating:active {
    transform: translateY(0);
}

.leland-voice-floating .leland-voice-icon {
    font-size: 1rem;
    line-height: 1;
}

.leland-voice-floating .leland-voice-text {
    line-height: 1;
}

.leland-beta-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 8px;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    line-height: 1;
}

/* Voice Modal */
#leland-voice-modal .modal-dialog {
    max-width: 420px;
}

#leland-voice-modal .modal-body {
    padding: 2rem;
}

/* Listening Indicator */
.leland-voice-indicator {
    position: relative;
    width: 100px;
    height: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.leland-voice-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.3;
    animation: voicePulse 1.5s ease-out infinite;
}

.leland-voice-icon {
    position: relative;
    font-size: 3rem;
    z-index: 1;
}

@keyframes voicePulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Transcript Box */
.leland-transcript-box {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 1rem;
    color: #374151;
    min-height: 50px;
    max-height: 100px;
    overflow-y: auto;
}

/* Voice Preview Card */
.leland-voice-preview-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
    border: 1px solid #e0e5ff;
    border-radius: 0.5rem;
    padding: 1rem;
}

.leland-voice-preview-card p {
    font-size: 0.9rem;
    color: #374151;
}

.leland-voice-preview-card strong {
    color: #667eea;
}

/* Voice Confirm/Result/Type Icons */
.leland-voice-confirm-icon,
.leland-voice-result-icon,
.leland-voice-error-icon,
.leland-type-icon {
    font-size: 4rem;
    line-height: 1;
}

/* Mode Toggle */
.leland-mode-toggle {
    margin-bottom: 1rem;
}

.leland-mode-toggle .btn-group {
    box-shadow: none;
}

.leland-mode-toggle .btn {
    padding: 0.375rem 1rem;
}

/* Type Input */
#leland-type-input .form-control {
    text-align: center;
    font-size: 1rem;
}

#leland-type-input .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Voice Search Results */
#leland-voice-search-results .list-group-item {
    border-left: none;
    border-right: none;
    padding: 0.75rem 0;
}

#leland-voice-search-results .list-group-item:first-child {
    border-top: none;
}

#leland-voice-search-results .list-group-item:hover {
    background-color: #f8f9ff;
}

/* Voice Command Modal */
#leland-voice-modal .modal-content {
    border-radius: 1rem;
    overflow: hidden;
}

#leland-voice-modal .modal-body {
    padding: 2rem;
}

/* Voice Indicator with Pulse */
.leland-voice-indicator {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.leland-voice-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.3;
    animation: voicePulse 1.5s ease-out infinite;
}

.leland-voice-icon {
    position: relative;
    font-size: 3rem;
    z-index: 1;
}

@keyframes voicePulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Transcript Box */
.leland-transcript-box {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
    border: 1px solid #e0e5ff;
    border-radius: 0.5rem;
    padding: 1rem;
    font-style: italic;
    color: #374151;
    min-height: 50px;
}

/* Voice Confirm/Result Icons */
.leland-voice-confirm-icon,
.leland-voice-result-icon,
.leland-voice-error-icon {
    font-size: 4rem;
    line-height: 1;
}

/* Voice Preview Card */
.leland-voice-preview-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: left;
}

.leland-voice-preview-card p {
    font-size: 0.9rem;
}

/* Search Results in Voice Modal */
#leland-voice-search-results .list-group-item {
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

#leland-voice-search-results .list-group-item:hover {
    border-left-color: #667eea;
    background-color: #f8f9ff;
}

/* Hide floating button on ticket view (Leland button is there) */
.ticket-view-container .leland-voice-floating {
    /* Keep visible for voice commands */
}

/* ========================================
   CHAT MODE STYLES
   ======================================== */

.leland-chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

.leland-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.leland-chat-welcome {
    color: #6c757d;
}

.leland-chat-message {
    display: flex;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.leland-chat-user {
    justify-content: flex-end;
}

.leland-chat-assistant {
    justify-content: flex-start;
}

.leland-chat-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.leland-chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-break: break-word;
}

.leland-chat-user .leland-chat-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.leland-chat-assistant .leland-chat-bubble {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 0.25rem;
}

.leland-chat-error .leland-chat-bubble {
    background: #fff5f5;
    border: 1px solid #feb2b2;
}

/* Typing indicator */
.leland-chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 1rem 1.25rem;
}

.leland-chat-typing span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

.leland-chat-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.leland-chat-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

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

/* Chat input */
.leland-chat-input {
    margin-top: auto;
}

.leland-chat-input .form-control {
    border-radius: 1.5rem 0 0 1.5rem;
    padding-left: 1.25rem;
}

.leland-chat-input .btn {
    border-radius: 0 1.5rem 1.5rem 0;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}
