/* =============================================================================
   SpeedTrans Professional Translation Widget Styles
   Brand Colors: Red #D32F2F, Navy #1A237E, Yellow #FFC107
   A11y: WCAG AA compliant, ≥44px touch targets, ≥4.5:1 contrast
   ============================================================================= */

/* Translation Widget Container */
.translation-widget {
    position: relative;
    display: inline-block;
    margin-left: 1rem;
    z-index: 1000;
}

/* Translation Toggle Button */
.translation-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    min-height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, #D32F2F, #C62828);
    color: white;
    border: 2px solid #D32F2F;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}

.translation-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.4);
    background: linear-gradient(135deg, #E53935, #D32F2F);
}

.translation-toggle:active {
    transform: translateY(0);
}

.translation-toggle:focus {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

.lang-label {
    font-size: 0.85rem;
    opacity: 0.95;
}

.lang-current {
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.lang-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.translation-toggle[aria-expanded="true"] .lang-arrow {
    transform: rotate(180deg);
}

/* Translation Dropdown */
.translation-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.translation-dropdown:not([hidden]) {
    opacity: 1;
    transform: translateY(0);
}

.translation-dropdown-header {
    padding: 1rem;
    background: linear-gradient(135deg, #1A237E, #283593);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.translation-dropdown-footer {
    padding: 0.75rem;
    background: #F5F5F5;
    color: #757575;
    font-size: 0.75rem;
    text-align: center;
    border-top: 1px solid #E0E0E0;
}

/* Language Options */
.translation-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    min-height: 44px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #F5F5F5;
}

.translation-option:hover {
    background-color: rgba(211, 47, 47, 0.05);
}

.translation-option:focus {
    outline: 3px solid #FFC107;
    outline-offset: -3px;
    background-color: rgba(211, 47, 47, 0.08);
}

.translation-option.active {
    background-color: rgba(211, 47, 47, 0.1);
    font-weight: 600;
}

.translation-option.active::after {
    content: "✓";
    margin-left: auto;
    color: #D32F2F;
    font-weight: bold;
    font-size: 1.1rem;
}

.lang-flag {
    font-size: 1.5rem;
    line-height: 1;
}

.lang-name {
    flex: 1;
    font-size: 0.95rem;
    color: #333;
}

.lang-code {
    font-size: 0.8rem;
    color: #757575;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* First Visit Banner */
.first-visit-banner {
    background: linear-gradient(90deg, #1A237E, #283593);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    max-width: 1200px;
    width: 100%;
}

.banner-content p {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.banner-actions {
    display: flex;
    gap: 1rem;
}

.banner-confirm,
.banner-dismiss {
    padding: 0.6rem 1.5rem;
    min-height: 44px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.banner-confirm {
    background: #FFC107;
    color: #1A237E;
}

.banner-confirm:hover {
    background: #FFD54F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.banner-confirm:focus {
    outline: 3px solid white;
    outline-offset: 2px;
}

.banner-dismiss {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.banner-dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
}

.banner-dismiss:focus {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

/* Translation Toast */
.translation-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1A237E;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.translation-toast span {
    font-size: 0.95rem;
    font-weight: 500;
}

.toast-undo {
    padding: 0.4rem 1rem;
    background: #FFC107;
    color: #1A237E;
    border: none;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toast-undo:hover {
    background: #FFD54F;
    transform: scale(1.05);
}

.toast-undo:focus {
    outline: 3px solid white;
    outline-offset: 2px;
}

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

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .translation-toggle,
    .translation-option,
    .banner-confirm,
    .banner-dismiss,
    .toast-undo,
    .translation-dropdown {
        transition: none;
    }
    
    .translation-toast {
        transition: opacity 0.2s ease;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .translation-toggle {
        border: 3px solid #D32F2F;
    }
    
    .translation-option:focus {
        outline-width: 4px;
    }
    
    .banner-confirm:focus,
    .banner-dismiss:focus,
    .toast-undo:focus {
        outline-width: 4px;
    }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .translation-widget {
        margin-left: 0.5rem;
    }
    
    .translation-toggle {
        padding: 0.5rem 0.75rem;
    }
    
    .lang-label {
        display: none;
    }
    
    .translation-dropdown {
        min-width: 260px;
        right: -10px;
    }
    
    .banner-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .translation-toast {
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(100px);
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
    
    .translation-toast.show {
        transform: translateX(0) translateY(0);
    }
}

@media screen and (max-width: 480px) {
    .translation-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .first-visit-banner {
        padding: 1rem;
    }
    
    .banner-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .banner-confirm,
    .banner-dismiss {
        width: 100%;
    }
}

/* Placeholder to prevent CLS */
.translation-widget-placeholder {
    display: inline-block;
    width: 180px;
    height: 44px;
    vertical-align: middle;
}

/* Print Styles */
@media print {
    .translation-widget,
    .first-visit-banner,
    .translation-toast {
        display: none !important;
    }
}
