/**
 * Text Selection Context Menu Styles
 */

.text-selection-menu {
    position: fixed;
    z-index: 100010;
    background: var(--card-bg, #1a1a2e);
    border-radius: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 
                0 0 0 1px rgba(255, 255, 255, 0.1);
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    max-width: calc(100vw - 20px);
    pointer-events: none;
}

.text-selection-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.tsm-scroll-container {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 2px 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-width: calc(100vw - 20px);
}

.tsm-scroll-container::-webkit-scrollbar {
    display: none;
}

.tsm-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary, #e2e8f0);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.tsm-item:hover,
.tsm-item:active {
    background: rgba(79, 209, 197, 0.15);
    color: var(--primary-color, #4FD1C5);
}

.tsm-label {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}


.tsm-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.tsm-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
    .text-selection-menu {
        border-radius: 16px;
    }
    
    .tsm-scroll-container {
        max-width: calc(100vw - 20px);
        padding: 2px 4px;
    }
    
    .tsm-item {
        padding: 5px 8px;
    }
    
    .tsm-label {
        font-size: 11px;
    }
}

body.light-mode .text-selection-menu {
    background: #ffffff;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25), 
                0 0 0 1.5px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-mode .tsm-item {
    color: #1a1a2e;
}

body.light-mode .tsm-item:hover,
body.light-mode .tsm-item:active {
    background: rgba(15, 82, 186, 0.15);
    color: #0F52BA;
}

body.light-mode .tsm-divider {
    background: rgba(0, 0, 0, 0.2);
}

body.light-mode [data-category="basic"] .tsm-icon {
    color: #374151;
}

body.light-mode [data-category="bible"] .tsm-icon {
    color: #0F52BA;
}

body.light-mode [data-category="original"] .tsm-icon {
    color: #6d28d9;
}

body.light-mode [data-category="ai"] .tsm-icon {
    color: #c2410c;
}

body.light-mode [data-category="extend"] .tsm-icon {
    color: #0369a1;
}

body.light-mode .tsm-icon {
    opacity: 1;
    font-weight: 600;
}

body.light-mode .tsm-label {
    color: #111827;
    font-weight: 700;
    opacity: 1;
}

/* AI Translation Modal */
.ai-translation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ai-translation-modal.visible {
    opacity: 1;
    visibility: visible;
}

.ai-translation-content {
    background: var(--card-bg, #1a1a2e);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.ai-translation-modal.visible .ai-translation-content {
    transform: scale(1);
}

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

.ai-translation-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.ai-translation-close {
    background: none;
    border: none;
    color: var(--text-secondary, #a0aec0);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.ai-translation-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #e2e8f0);
}

.ai-translation-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.ai-translation-section {
    margin-bottom: 16px;
}

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

.ai-translation-section label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #a0aec0);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-translation-original,
.ai-translation-result {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary, #e2e8f0);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-translation-result {
    background: rgba(79, 209, 197, 0.1);
    border: 1px solid rgba(79, 209, 197, 0.2);
}

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

.ai-translation-copy {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-color, #4FD1C5);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-translation-copy:hover {
    background: #38b2a5;
    transform: translateY(-1px);
}

.ai-translation-copy .material-icons {
    font-size: 18px;
}

/* Light mode */
body.light-mode .ai-translation-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

body.light-mode .ai-translation-header {
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

body.light-mode .ai-translation-header h3 {
    color: #0F52BA;
    font-weight: 700;
}

body.light-mode .ai-translation-section label {
    color: #0F52BA;
    font-weight: 600;
}

body.light-mode .ai-translation-original,
body.light-mode .ai-translation-result {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

body.light-mode .ai-translation-result {
    background: #e0f2fe;
    border: 2px solid #0F52BA;
    color: #0c4a6e;
}

body.light-mode .ai-translation-footer {
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

body.light-mode .ai-translation-copy {
    background: #0F52BA;
    color: #ffffff;
}

body.light-mode .ai-translation-copy:hover {
    background: #0d47a1;
}

@media (max-width: 480px) {
    .ai-translation-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .ai-translation-header {
        padding: 14px 16px;
    }
    
    .ai-translation-body {
        padding: 16px;
    }
    
    .ai-translation-original,
    .ai-translation-result {
        padding: 14px;
        font-size: 14px;
    }
}
