/* DLA Translator — Floating Switcher */

.dlt-floating {
    position: fixed; z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.dlt-floating-bottom-right { bottom: 24px; right: 24px; }
.dlt-floating-bottom-left  { bottom: 24px; left: 24px; }
.dlt-floating-top-right    { top: 24px; right: 24px; }
.dlt-floating-top-left     { top: 24px; left: 24px; }

.dlt-floating-btn {
    display: flex; align-items: center; gap: 6px;
    height: 48px; padding: 0 16px; border: none; border-radius: 50px;
    background: #1a1a2e; color: #fff; cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    font-size: 14px; font-weight: 600;
}
.dlt-floating-btn:hover { transform: scale(1.05); box-shadow: 0 6px 28px rgba(0,0,0,0.35); background: #16213e; }
.dlt-floating-btn:active { transform: scale(0.97); }
.dlt-floating-flag { font-size: 22px; line-height: 1; }
.dlt-floating-code { font-size: 13px; opacity: 0.9; }

.dlt-floating-panel {
    position: absolute; min-width: 200px; background: #fff; border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.06);
    overflow: hidden; opacity: 0; visibility: hidden;
    transform: scale(0.9) translateY(8px);
    transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
}
.dlt-floating-bottom-right .dlt-floating-panel,
.dlt-floating-bottom-left .dlt-floating-panel { bottom: calc(100% + 12px); }
.dlt-floating-bottom-right .dlt-floating-panel { right: 0; }
.dlt-floating-bottom-left .dlt-floating-panel { left: 0; }
.dlt-floating-top-right .dlt-floating-panel,
.dlt-floating-top-left .dlt-floating-panel { top: calc(100% + 12px); }
.dlt-floating-top-right .dlt-floating-panel { right: 0; }
.dlt-floating-top-left .dlt-floating-panel { left: 0; }

.dlt-floating.dlt-open .dlt-floating-panel {
    opacity: 1; visibility: visible; transform: scale(1) translateY(0); pointer-events: auto;
}

.dlt-floating-header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 18px 10px; font-size: 13px; font-weight: 600;
    color: #666; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid #f0f0f0;
}

.dlt-floating-lang {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; color: #333; text-decoration: none !important;
    transition: background 0.15s; font-size: 15px;
}
.dlt-floating-lang:hover { background: #f7f7f9; color: #111; }
.dlt-floating-lang.dlt-floating-active { background: #f0f4ff; font-weight: 600; color: #1a1a2e; }
.dlt-floating-lang:last-child { border-radius: 0 0 16px 16px; }
.dlt-floating-lang-flag { font-size: 22px; line-height: 1; }
.dlt-floating-lang-name { flex: 1; }
.dlt-floating-check { color: #4CAF50; font-weight: bold; }

@keyframes dltPulse {
    0%   { box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 0 0 0 rgba(26,26,46,0.4); }
    70%  { box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 0 0 10px rgba(26,26,46,0); }
    100% { box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 0 0 0 rgba(26,26,46,0); }
}
.dlt-floating-btn.dlt-pulse { animation: dltPulse 2s ease-out 3; }

@media (max-width: 480px) {
    .dlt-floating-bottom-right { bottom: 24px; right: 16px; }
    .dlt-floating-bottom-left { bottom: 24px; left: 16px; }
    .dlt-floating-btn { height: 44px; padding: 0 14px; }
}

body.single-dla_online_course .dlt-floating-bottom-right,
body.single-dla_masterclass .dlt-floating-bottom-right { bottom: 24px; }
body.single-dla_online_course .dlt-floating-bottom-left,
body.single-dla_masterclass .dlt-floating-bottom-left { bottom: 24px; }

/* Spinner for translation status */
.dlt-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dltSpin 0.8s linear infinite;
}
@keyframes dltSpin { 0%{transform:rotate(0)} 100%{transform:rotate(360deg)} }

/* =========================================================================
   Language Popup — first visit
   ========================================================================= */

#dlt-lang-popup-overlay {
    position: fixed; inset: 0; z-index: 2147483647;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}
#dlt-lang-popup-overlay.dlt-popup-visible {
    opacity: 1; visibility: visible;
}

#dlt-lang-popup {
    position: relative;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.25);
    max-width: 520px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.dlt-popup-visible #dlt-lang-popup {
    transform: scale(1) translateY(0);
}

.dlt-popup-header {
    text-align: center;
    padding: 32px 24px 16px;
}
.dlt-popup-icon {
    font-size: 48px;
    margin-bottom: 8px;
}
.dlt-popup-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #1a1a2e !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
    line-height: 1.3 !important;
}
.dlt-popup-subtitle {
    font-size: 14px !important;
    color: #888 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.dlt-popup-langs {
    padding: 8px 24px 28px;
}

/* Featured first language - big button */
.dlt-popup-lang-featured {
    display: flex; align-items: center; gap: 14px;
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #eee;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #1a1a2e;
    text-align: left;
    text-decoration: none;
    margin-bottom: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.dlt-popup-lang-featured:hover {
    border-color: #1a1a2e;
    background: #f7f7ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.dlt-popup-lang-featured.dlt-popup-active {
    border-color: #4CAF50;
    background: #f0fff0;
}
.dlt-popup-flag-big { font-size: 36px; line-height: 1; }
.dlt-popup-name-big { font-weight: 600; font-size: 18px; }

/* Grid for remaining languages */
.dlt-popup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.dlt-popup-lang {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border: 2px solid #eee;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    color: #333;
    text-align: left;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}
.dlt-popup-lang:hover {
    border-color: #1a1a2e;
    background: #f7f7ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.dlt-popup-lang.dlt-popup-active {
    border-color: #4CAF50;
    background: #f0fff0;
}
.dlt-popup-flag { font-size: 24px; line-height: 1; }
.dlt-popup-name { font-weight: 500; }

.dlt-popup-close {
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px;
    border: none; background: #f0f0f0;
    border-radius: 50%; cursor: pointer;
    font-size: 16px; color: #666;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.dlt-popup-close:hover { background: #e0e0e0; color: #333; }

@media (max-width: 480px) {
    #dlt-lang-popup { border-radius: 16px; }
    .dlt-popup-langs { padding: 8px 16px 24px; }
    .dlt-popup-lang-featured { padding: 14px 16px; font-size: 16px; }
    .dlt-popup-flag-big { font-size: 30px; }
    .dlt-popup-name-big { font-size: 16px; }
    .dlt-popup-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .dlt-popup-lang { padding: 10px 12px; font-size: 14px; }
    .dlt-popup-header { padding: 24px 16px 12px; }
    .dlt-popup-title { font-size: 18px !important; }
}

/* RevSlider — force text to fit in translated languages */
body:not(.dlt-lang-en) rs-module-wrap .tp-caption,
body:not(.dlt-lang-en) rs-module-wrap rs-layer {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    hyphens: auto !important;
    line-height: 1.1 !important;
}
/* Slightly reduce large headings to prevent overflow */
body:not(.dlt-lang-en) rs-module-wrap .tp-caption[style*="font-size: 8"],
body:not(.dlt-lang-en) rs-module-wrap .tp-caption[style*="font-size: 7"],
body:not(.dlt-lang-en) rs-module-wrap .tp-caption[style*="font-size: 9"] {
    letter-spacing: -0.02em !important;
}
