* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #1a0033, #32004d);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 16px;
}

.container {
    background: white;
    padding: 25px;
    border-radius: 20px;
    width: 600px;
    max-width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.language-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.lang-btn {
    background: #f0f0f0;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
}

.lang-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.lang-btn.active {
    background: linear-gradient(135deg, #6c63ff, #8b44ff);
    border-color: #6c63ff;
    color: white;
}

h1 {
    margin-bottom: 25px;
    font-size: 24px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.currency-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    gap: 15px;
}

.custom-select-wrapper {
    flex: 1;
    position: relative;
}

.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.select-selected {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.select-selected:hover {
    border-color: #6c63ff;
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.2);
}

.select-selected img {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.select-selected::after {
    content: "▼";
    font-size: 12px;
    margin-left: auto;
    color: #888;
    transition: transform 0.2s;
}

.select-items {
    position: absolute;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    width: 100%;
    margin-top: 8px;
    z-index: 99;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.select-items.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.select-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.select-item:last-child {
    border-bottom: none;
}

.select-item:hover {
    background: linear-gradient(135deg, #f0f0ff, #e8e8ff);
    transform: translateX(5px);
}

.select-item img {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
}

.select-item span {
    font-weight: 500;
    color: #333;
}

input {
    padding: 12px 15px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    flex: 1;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: monospace;
    -webkit-appearance: none;
    appearance: none;
}

input:focus {
    outline: none;
    border-color: #6c63ff;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

input:read-only {
    background-color: #f8f9fa;
    cursor: default;
}

.exchange-rate {
    margin-top: 25px;
    font-size: 16px;
    font-weight: 600;
    color: #6c63ff;
    background: linear-gradient(135deg, #f8f9fa, #fff);
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    word-break: break-word;
}

.status {
    margin-top: 15px;
    font-size: 11px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status::before {
    content: "🟢";
    font-size: 10px;
}

html[dir="rtl"] .currency-container {
    flex-direction: row-reverse;
}

html[dir="rtl"] .select-selected::after {
    margin-left: 0;
    margin-right: auto;
}

html[dir="rtl"] .select-selected,
html[dir="rtl"] .select-item {
    flex-direction: row-reverse;
}

html[dir="rtl"] .status::before {
    content: "🟢";
    margin-left: 5px;
    margin-right: 0;
}

@media (max-width: 550px) {
    body {
        padding: 12px;
    }
    
    .container {
        padding: 20px;
    }
    
    .language-selector {
        gap: 6px;
    }
    
    .lang-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .currency-container {
        flex-direction: column;
        gap: 10px;
        margin: 15px 0;
    }
    
    .custom-select-wrapper,
    input {
        width: 100%;
    }
    
    .select-selected img,
    .select-item img {
        width: 28px;
        height: 21px;
    }
    
    .select-selected {
        padding: 10px 12px;
    }
    
    .select-item {
        padding: 10px 12px;
    }
    
    .select-item,
    .select-selected {
        min-height: 48px;
    }
    
    input {
        padding: 12px;
        font-size: 16px;
        min-height: 48px;
    }
    
    input[type="number"] {
        font-size: 16px;
    }
    
    .exchange-rate {
        font-size: 14px;
        padding: 10px;
        margin-top: 20px;
    }
    
    .status {
        font-size: 10px;
        gap: 6px;
    }
    
    html[dir="rtl"] .currency-container {
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 20px;
    }
    
    .lang-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}