/* Language Selector Styles */
.language-selector {
    position: relative;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.lang-current:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-arrow {
    transition: transform 0.2s;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    max-height: 320px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1001;
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--bg-color);
}

.lang-option.active {
    background: rgba(255, 107, 157, 0.15);
    color: var(--primary-color);
    font-weight: 600;
}

/* RTL Support */
[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .store-card {
    flex-direction: row-reverse;
}

[dir="rtl"] .coupon-card {
    flex-direction: row-reverse;
}

[dir="rtl"] .nav-item {
    flex-direction: column;
}

/* Modal Language List */
.language-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.language-item:hover {
    background: var(--border-color);
}

.language-item input[type="radio"] {
    accent-color: var(--primary-color);
}

/* Header language button in white bg pages */
.page-header .lang-current {
    background: var(--bg-color);
    color: var(--text-color);
}

.page-header .lang-current:hover {
    background: var(--border-color);
}

/* ============================================
   Multi-language text handling
   ============================================ */

/* Global text handling for long translations */
[data-i18n] {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* German, Russian, and other languages with longer words */
html[lang="de"] .hero h1,
html[lang="ru"] .hero h1,
html[lang="pl"] .hero h1,
html[lang="nl"] .hero h1 {
    font-size: clamp(16px, 4.5vw, 22px);
    hyphens: auto;
    -webkit-hyphens: auto;
}

html[lang="de"] .step-content h4,
html[lang="ru"] .step-content h4,
html[lang="pl"] .step-content h4,
html[lang="nl"] .step-content h4 {
    font-size: clamp(10px, 2.8vw, 12px);
}

/* Arabic RTL layout */
html[lang="ar"] {
    direction: rtl;
}

html[lang="ar"] .steps {
    flex-direction: row-reverse;
}

html[lang="ar"] .step-arrow svg {
    transform: scaleX(-1);
}

html[lang="ar"] .analysis-preview-card,
html[lang="ar"] .step {
    text-align: right;
}

/* Thai, Vietnamese - may need more line height */
html[lang="th"] *,
html[lang="vi"] * {
    line-height: 1.5;
}

/* Japanese, Korean - character wrapping */
html[lang="ja"] *,
html[lang="ko"] * {
    word-break: keep-all;
}

/* Ensure buttons don't overflow */
.btn-primary,
.btn-claim,
.btn-submit {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Card content handling */
.store-card .store-name,
.package-card .package-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Navigation text */
.bottom-nav .nav-item span {
    font-size: clamp(10px, 2.5vw, 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60px;
}

/* Coupon section text handling */
.coupon-info h3 {
    font-size: clamp(13px, 3.5vw, 16px);
    line-height: 1.3;
}

.coupon-info p {
    font-size: clamp(11px, 3vw, 13px);
}
