/* Vocabulary Tooltip Styles */

.vocab-word-highlight {
    background: linear-gradient(120deg, #fff3cd 0%, #ffeaa7 100%);
    border-bottom: 2px solid #d69e2e;
    cursor: help;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(212, 158, 46, 0.2);
    text-decoration: none;
}

.vocab-word-highlight:hover {
    background: linear-gradient(120deg, #ffeaa7 0%, #ffcc02 100%);
    border-bottom-color: #b7651d;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(212, 158, 46, 0.3);
    font-weight: 600;
}

/* Enhanced highlighting with CEFR level indicator */
.vocab-word-highlight::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background: #d69e2e;
    border-radius: 50%;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.vocab-word-highlight:hover::after {
    background: #b7651d;
    transform: scale(1.2);
    opacity: 1;
}

/* Vocabulary Processing Indicators (Option 6) */
.vocabulary-processing {
    position: relative;
    opacity: 0.9;
}

.vocab-processing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #6c757d;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    margin-left: 8px;
    animation: vocab-processing-pulse 1.5s ease-in-out infinite;
}

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

/* Subtle pulse animation for newly highlighted words */
@keyframes vocab-highlight-intro {
    0% {
        background: #fff3cd;
        transform: scale(1);
    }
    50% {
        background: #ffeaa7;
        transform: scale(1.05);
    }
    100% {
        background: linear-gradient(120deg, #fff3cd 0%, #ffeaa7 100%);
        transform: scale(1);
    }
}

.vocab-word-highlight.new-highlight {
    animation: vocab-highlight-intro 0.8s ease-out;
}

/* Different highlight styles based on CEFR level difficulty */
.vocab-word-highlight[data-difficulty="medium"] {
    background: linear-gradient(120deg, #fff3cd 0%, #ffcc02 100%);
    border-bottom-color: #b7651d;
}

.vocab-word-highlight[data-difficulty="hard"] {
    background: linear-gradient(120deg, #ffcc02 0%, #ff8c00 100%);
    border-bottom-color: #d2691e;
    font-weight: 600;
}

.vocab-word-highlight[data-difficulty="very-hard"] {
    background: linear-gradient(120deg, #ff8c00 0%, #ff6347 100%);
    border-bottom-color: #cd5c5c;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Tooltip Container */
.vocab-tooltip {
    position: fixed;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 350px;
    min-width: 200px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.vocab-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.vocab-tooltip.sticky {
    pointer-events: auto;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

/* Tooltip Header */
.vocab-tooltip-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.vocab-word {
    font-weight: 600;
    font-size: 16px;
    color: #2c3e50;
}

.vocab-pos {
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tooltip Content */
.vocab-tooltip-content {
    padding: 12px 16px;
}

/* Definitions */
.vocab-definitions {
    margin-bottom: 8px;
}

.vocab-definition {
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.vocab-definition:last-child {
    margin-bottom: 0;
}

.cefr-level {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* CEFR Level Colors */
.cefr-a1 {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cefr-a2 {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.cefr-b1 {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.cefr-b2 {
    background-color: #ffeaa7;
    color: #b7651d;
    border: 1px solid #ffcc02;
}

.cefr-c1 {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
}

.cefr-c2 {
    background-color: #e2d1f3;
    color: #6f2dbd;
    border: 1px solid #d1b3e8;
}

.definition-text {
    flex: 1;
    color: #495057;
}

/* Context Section */
.vocab-context {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
    font-size: 12px;
}

.context-label {
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 4px;
}

.context-text {
    font-style: italic;
    color: #868e96;
    line-height: 1.3;
}

/* Tooltip Footer */
.vocab-tooltip-footer {
    padding: 8px 16px 12px;
    border-top: 1px solid #f0f0f0;
    text-align: right;
}

.vocab-confidence {
    font-size: 11px;
    color: #adb5bd;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .vocab-tooltip {
        max-width: 280px;
        font-size: 13px;
    }

    .vocab-tooltip-header {
        padding: 10px 12px 6px;
    }

    .vocab-tooltip-content {
        padding: 10px 12px;
    }

    .vocab-word {
        font-size: 15px;
    }
}

/* Animation for word highlighting on hover */
@keyframes vocab-highlight-pulse {
    0% { background-color: #fff3cd; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fff3cd; }
}

.vocab-word-highlight:hover {
    animation: vocab-highlight-pulse 1s ease-in-out;
}

/* Visual feedback enhancements */
.vocab-word-highlight:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.vocab-word-highlight:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Toast notification styles */
#vocab-highlight-toast {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Enhanced highlighting for different difficulties */
.vocab-word-highlight[data-difficulty="easy"] {
    background: linear-gradient(120deg, #e8f5e8 0%, #d4edda 100%);
    border-bottom-color: #28a745;
    color: #155724;
}

.vocab-word-highlight[data-difficulty="easy"]:hover {
    background: linear-gradient(120deg, #d4edda 0%, #c3e6cb 100%);
    color: #0e4419;
}

/* Word count indicator in chat */
.vocab-highlight-indicator {
    display: inline-block;
    background: #007bff;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 8px;
    opacity: 0.8;
    font-weight: 500;
}

/* Improved mobile experience */
@media (max-width: 768px) {
    .vocab-word-highlight {
        padding: 3px 5px;
        font-weight: 600;
        border-bottom-width: 3px;
    }

    .vocab-word-highlight::after {
        width: 8px;
        height: 8px;
    }

    #vocab-highlight-toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        text-align: center;
    }
}

/* Accessibility improvements */
.vocab-tooltip:focus-within,
.vocab-word-highlight:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .vocab-tooltip {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .vocab-tooltip-header {
        background: #4a5568;
        border-bottom-color: #606d7b;
    }

    .vocab-word {
        color: #f7fafc;
    }

    .definition-text {
        color: #cbd5e0;
    }

    .context-text {
        color: #a0aec0;
    }

    .vocab-word-highlight {
        background-color: rgba(255, 243, 205, 0.2);
        border-bottom-color: #d69e2e;
        color: #2d3748;
    }

    .vocab-word-highlight:hover {
        background-color: rgba(255, 234, 167, 0.3);
    }
}
