* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: 'Noto Sans', 'Noto Sans Devanagari', 'Noto Sans Arabic', 'Noto Sans Bengali', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Language-specific font prioritization to ensure proper glyph rendering */
html[lang="hi"] body {
    font-family: 'Noto Sans Devanagari', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[lang="bn"] body {
    font-family: 'Noto Sans Bengali', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[lang="ur"] body {
    font-family: 'Noto Sans Arabic', 'Noto Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Language Screen */
.logo-container {
    text-align: center;
    padding: 60px 20px 40px;
}

.logo {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}

.tagline {
    color: var(--text-light);
    font-size: 16px;
}

.language-grid {
    display: grid;
    gap: 12px;
    padding: 20px;
}

.lang-btn {
    padding: 16px 24px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

/* Welcome Screen */
.onboarding-content {
    text-align: center;
    padding: 60px 20px;
}

.illustration {
    font-size: 80px;
    margin-bottom: 24px;
}

.onboarding-content h1 {
    font-size: 28px;
    margin-bottom: 12px;
}

.onboarding-content p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 40px;
    line-height: 1.5;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary.btn-large {
    margin-top: 20px;
}

.btn-secondary {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin: 12px 0;
}

/* Screen Header */
.screen-header {
    display: flex;
    align-items: center;
    margin: -20px -20px 20px;
    padding: 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.back-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg);
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* Search */
.search-box {
    margin-bottom: 16px;
}

.search-box input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
}

/* Employer Cards */
.employer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.employer-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.employer-card:hover {
    border-color: var(--primary);
}

.employer-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 12px;
}

.employer-name {
    font-weight: 600;
    font-size: 16px;
}

.employer-type {
    color: var(--text-light);
    font-size: 14px;
}

/* ID Verification */
.id-verification {
    padding: 20px 0;
}

.id-card-preview {
    margin-bottom: 24px;
}

.id-placeholder {
    height: 200px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.id-placeholder span {
    font-size: 48px;
    margin-bottom: 8px;
}

.id-placeholder p {
    color: var(--text-light);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
}

/* Home Screen */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -20px -20px 20px;
    padding: 20px;
    background: var(--card);
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.greeting {
    font-size: 16px;
}

.greeting span:first-child {
    color: var(--text-light);
}

.lang-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
}

/* Balance Card */
.balance-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 28px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.balance-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 4px;
}

.balance-sub {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 20px;
}

.balance-card .btn-primary {
    background: white;
    color: var(--primary);
}

.balance-card .btn-primary:hover {
    background: #f8fafc;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    background: var(--card);
    border: none;
    border-radius: 16px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
}

.action-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.action-btn span {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

/* EWA Request */
.ewa-content {
    padding: 10px 0;
}

.earned-so-far {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.earned-label {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 8px;
}

.earned-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--success);
}

.amount-selector {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.amount-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 16px;
}

.amount-input {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 16px;
}

.amount-input .currency {
    padding: 0 16px;
    font-weight: 600;
    color: var(--text-light);
}

.amount-input input {
    flex: 1;
    border: none;
    padding: 12px;
    font-size: 24px;
    font-weight: 700;
    outline: none;
}

.amount-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.amount-presets button {
    padding: 10px;
    border: 2px solid var(--border);
    background: var(--bg);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.amount-presets button:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

/* Fee Preview */
.fee-preview {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.fee-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.fee-row:last-child {
    border-bottom: none;
}

.fee-row.total {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

/* Confirm Screens */
.confirm-content {
    padding: 10px 0;
}

.confirm-details {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.confirm-row {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.confirm-row:last-child {
    border-bottom: none;
}

.confirm-row span {
    color: var(--text-light);
}

.confirm-row strong {
    font-weight: 600;
}

.confirm-row strong.highlight {
    color: var(--success);
    font-size: 18px;
}

/* Success Screen */
.success-content {
    text-align: center;
    padding: 60px 20px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.success-content h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.success-content p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 40px;
    line-height: 1.5;
}

/* Receipt Box */
.receipt-box {
    background: var(--bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}

.receipt-row span {
    color: var(--text-light);
}

/* Corridor Selection */
.corridor-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.corridor-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.corridor-card:hover {
    border-color: var(--primary);
}

.flag {
    font-size: 36px;
    margin-right: 16px;
}

.country {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.rate {
    color: var(--text-light);
    font-size: 14px;
}

/* Recipient */
.recipient-content {
    padding: 10px 0;
}

.recipient-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.recipient-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.recipient-card:hover,
.recipient-card.selected {
    border-color: var(--primary);
}

.recipient-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: 12px;
}

.recipient-name {
    font-weight: 600;
}

.recipient-detail {
    color: var(--text-light);
    font-size: 14px;
}

.check {
    margin-left: auto;
    color: var(--primary);
    font-weight: 700;
    font-size: 20px;
}

/* Remittance Amount */
.remittance-amount-content {
    padding: 10px 0;
}

.amount-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.amount-input-large {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.amount-input-large .currency {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-light);
    margin-right: 8px;
}

.amount-input-large input {
    font-size: 48px;
    font-weight: 700;
    border: none;
    background: transparent;
    width: 200px;
    text-align: center;
    outline: none;
}

.conversion-preview {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.convert-row {
    padding: 8px 0;
}

.convert-row.highlight {
    font-size: 18px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.fee-breakdown {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

/* History */
.history-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: var(--bg);
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card);
    border-radius: 12px;
}

.history-item.hidden {
    display: none;
}

.history-icon {
    font-size: 24px;
    margin-right: 12px;
}

.history-info {
    flex: 1;
}

.history-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-date {
    color: var(--text-light);
    font-size: 14px;
}

.history-amount {
    font-weight: 700;
}

.history-amount.positive {
    color: var(--success);
}

.history-amount.negative {
    color: var(--danger);
}

/* Help */
.help-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.help-card {
    background: var(--card);
    padding: 20px;
    border-radius: 16px;
}

.help-card h3 {
    margin-bottom: 12px;
    font-size: 18px;
}

.help-card p {
    color: var(--text-light);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.help-card p:last-child {
    border-bottom: none;
}

/* RTL Support */
[dir="rtl"] .screen-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .screen-header h2 {
    text-align: right;
    flex: 1;
}

[dir="rtl"] .back-btn {
    margin-right: 0;
    margin-left: 12px;
}

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

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

[dir="rtl"] .avatar {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .fee-row,
[dir="rtl"] .confirm-row,
[dir="rtl"] .receipt-row {
    flex-direction: row-reverse;
}

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

[dir="rtl"] .history-icon {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .history-amount {
    text-align: left;
}

[dir="rtl"] .employer-card,
[dir="rtl"] .corridor-card,
[dir="rtl"] .recipient-card {
    flex-direction: row-reverse;
}

[dir="rtl"] .employer-icon,
[dir="rtl"] .flag,
[dir="rtl"] .recipient-avatar {
    margin-right: 0;
    margin-left: 12px;
}

[dir="rtl"] .check {
    margin-left: 0;
    margin-right: auto;
}

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

[dir="rtl"] .amount-input .currency {
    margin-right: 8px;
    margin-left: 0;
}

/* Responsive */
@media (min-width: 431px) {
    #app {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}
