@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
    width: 100%;
}

body {
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
    background: linear-gradient(145deg, #EDF2F8 0%, #F5F0EB 50%, #EDF2F8 100%);
    color: #1B2A4A;
    min-height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
}

html[dir="rtl"] body {
    direction: rtl;
}

html[dir="ltr"] body {
    direction: ltr;
}

.bank-select-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* ── Header ── */
.header-section {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.page-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #1B2A4A;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(27, 42, 74, 0.06);
}

.page-back-btn:hover {
    border-color: #F7A600;
    background: #FFF9EC;
}

.page-back-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

html[dir="rtl"] .page-back-btn svg {
    transform: scaleX(-1);
}

/* ── Language selector ── */
.language-selector {
    position: relative;
    margin-inline-start: auto;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #1B2A4A;
    padding: 8px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(27, 42, 74, 0.06);
}

.lang-toggle:hover {
    border-color: #F7A600;
    background: #FFF9EC;
}

.lang-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.language-selector.open .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    padding: 6px;
    min-width: 150px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(27, 42, 74, 0.12);
}

html[dir="ltr"] .lang-dropdown {
    right: auto;
    left: 0;
}

.language-selector.open .lang-dropdown {
    display: flex;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #475569;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

html[dir="rtl"] .lang-option {
    text-align: right;
}

.lang-option:hover {
    background: #F1F5F9;
    color: #1B2A4A;
}

.lang-option.active {
    background: #FFF5E0;
    color: #D48A00;
    font-weight: 600;
}

.lang-flag {
    font-size: 16px;
    line-height: 1;
}

/* ── Logo ── */
.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-img {
    height: 100px;
    width: auto;
    border-radius: 12px;
}

/* ── Content ── */
.content-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.page-header {
    text-align: center;
    width: 100%;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #1B2A4A;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: #64748B;
    line-height: 1.5;
}

.is-hidden,
.hidden {
    display: none !important;
}

/* ── Region selector (hidden for Morocco-only but kept for structure) ── */
.region-selector-card {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    background: #FFFFFF;
    border: 1px solid rgba(247, 166, 0, 0.22);
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(27, 42, 74, 0.06);
}

.region-selector-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    text-align: center;
}

.region-selector-label {
    font-size: 16px;
    font-weight: 700;
    color: #1B2A4A;
}

.region-selector-hint {
    font-size: 13px;
    line-height: 1.5;
    color: #64748B;
}

.region-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.region-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 14px;
    border-radius: 14px;
    border: 1px solid #E2E8F0;
    background: #FAFBFC;
    color: #475569;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.region-chip:hover {
    transform: translateY(-2px);
    border-color: #F7A600;
    background: #FFF9EC;
}

.region-chip.active {
    border-color: #F7A600;
    background: #FFF5E0;
    box-shadow: 0 6px 18px rgba(247, 166, 0, 0.14);
    color: #1B2A4A;
}

.region-chip-flag {
    font-size: 28px;
    line-height: 1;
}

.region-chip-code {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #D48A00;
}

.region-chip-name {
    font-size: 14px;
    font-weight: 600;
}

.region-chip-currency {
    font-size: 12px;
    color: #94A3B8;
}

/* ── Banks grid ── */
.banks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 600px;
}

.bank-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 20px;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 160px;
    box-shadow: 0 2px 8px rgba(27, 42, 74, 0.04);
}

.bank-card:hover {
    border-color: #F7A600;
    background: #FFFDF7;
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(247, 166, 0, 0.14);
}

.bank-card:active {
    transform: translateY(-2px);
}

.bank-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.bank-card.disabled:hover {
    border-color: #E2E8F0;
    background: #FFFFFF;
    transform: none;
    box-shadow: none;
}

.bank-logo {
    width: 100%;
    max-width: 140px;
    height: 60px;
    object-fit: contain;
    opacity: 0.88;
    transition: all 0.3s ease;
}

.bank-card:hover .bank-logo {
    opacity: 1;
}

.bank-name {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    text-align: center;
    transition: color 0.3s ease;
}

.bank-card:hover .bank-name {
    color: #D48A00;
}

/* ── Skeletons ── */
.bank-card-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 20px;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    min-height: 160px;
}

.bank-card-skeleton::before {
    content: '';
    width: 120px;
    height: 50px;
    background: linear-gradient(90deg, #E2E8F0 0%, #F1F5F9 50%, #E2E8F0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.bank-card-skeleton::after {
    content: '';
    width: 80px;
    height: 16px;
    background: linear-gradient(90deg, #E2E8F0 0%, #F1F5F9 50%, #E2E8F0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.bank-empty-state {
    grid-column: 1 / -1;
    width: 100%;
    padding: 28px 24px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #64748B;
    background: #FFFFFF;
    border: 2px dashed #CBD5E1;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Error message ── */
.error-message {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.08), rgba(239, 68, 68, 0.03));
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    color: #991B1B;
    font-size: 14px;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.06);
}

.error-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    color: #EF4444;
}

.error-message-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.error-message-title {
    color: #1B2A4A;
    font-size: 15px;
    font-weight: 700;
}

.error-message-text {
    color: #64748B;
    line-height: 1.5;
}

.error-message-retry {
    width: fit-content;
    margin-top: 4px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(247, 166, 0, 0.3);
    background: #FFF5E0;
    color: #D48A00;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-message-retry:hover {
    background: #FFEDCC;
    transform: translateY(-1px);
}

/* ── Footer note ── */
.footer-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(247, 166, 0, 0.07);
    border: 1px solid rgba(247, 166, 0, 0.18);
    border-radius: 10px;
    color: #64748B;
    font-size: 13px;
    text-align: center;
}

.footer-note svg {
    width: 18px;
    height: 18px;
    color: #F7A600;
    flex-shrink: 0;
}

/* ── Mobile responsive ── */
@media (max-width: 600px) {
    body {
        padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
    }

    .bank-select-container {
        gap: 18px;
    }

    .header-section {
        position: sticky;
        top: 0;
        z-index: 20;
        padding-top: 2px;
        background: linear-gradient(180deg, rgba(237, 242, 248, 0.98), rgba(237, 242, 248, 0.9));
        backdrop-filter: blur(10px);
    }

    .banks-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .bank-card {
        flex-direction: row;
        justify-content: flex-start;
        gap: 20px;
        padding: 20px;
        min-height: auto;
    }

    .bank-logo {
        width: 80px;
        height: 40px;
    }

    .bank-name {
        text-align: left;
    }

    html[dir="rtl"] .bank-name {
        text-align: right;
    }

    .page-title {
        font-size: 24px;
    }

    .page-back-btn {
        padding: 0 12px;
    }

    .region-selector-grid {
        grid-template-columns: 1fr;
    }

    .footer-note {
        flex-direction: column;
        gap: 8px;
    }
}

/* ── Requisites Panel ── */
.requisites-panel {
    width: 100%;
    max-width: 600px;
    background: #FFFFFF;
    border: 1px solid rgba(247, 166, 0, 0.22);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(27, 42, 74, 0.06);
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.requisites-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: #64748B;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    margin-inline-end: auto;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.requisites-back:hover {
    color: #1B2A4A;
    background: #F1F5F9;
}

.requisites-back svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

html[dir="rtl"] .requisites-back svg {
    transform: scaleX(-1);
}

.requisites-bank-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #E2E8F0;
}

.requisites-bank-logo {
    height: 48px;
    width: 90px;
    object-fit: contain;
}

.requisites-bank-name {
    font-size: 18px;
    font-weight: 700;
    color: #1B2A4A;
}

.requisites-details {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.requisites-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.requisites-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #64748B;
}

.req-icon {
    width: 16px;
    height: 16px;
    color: #F7A600;
}

.requisites-row-value-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #FAFBFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px 14px;
    transition: all 0.2s ease;
}

.requisites-row-value-wrapper:hover {
    border-color: rgba(247, 166, 0, 0.4);
    background: #FFFDF9;
}

.requisites-row-value {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #1B2A4A;
    word-break: break-all;
    user-select: all;
}

.requisites-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    color: #475569;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.requisites-copy-btn:hover {
    border-color: #F7A600;
    color: #D48A00;
    background: #FFF9EC;
}

.requisites-copy-btn.copied {
    border-color: #10B981 !important;
    background: #ECFDF5 !important;
    color: #047857 !important;
}

.requisites-copy-btn svg {
    width: 14px;
    height: 14px;
}

.requisites-notes-box {
    margin-top: 6px;
    background: rgba(247, 166, 0, 0.05);
    border: 1px dashed rgba(247, 166, 0, 0.3);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.requisites-notes-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #D48A00;
}

.requisites-notes-title svg {
    width: 16px;
    height: 16px;
    color: #F7A600;
}

.requisites-notes-content {
    font-size: 13px;
    line-height: 1.5;
    color: #64748B;
}

.requisites-empty {
    text-align: center;
    color: #94A3B8;
    font-style: italic;
    padding: 20px 0;
}

@media (max-width: 600px) {
    .requisites-panel {
        padding: 16px;
        gap: 16px;
    }
    
    .requisites-row-value-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .requisites-copy-btn {
        justify-content: center;
    }
}
