/* Phone Authentication Modal */
.phone-auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.phone-auth-content {
    background: white;
    padding: 50px 40px 40px 40px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    min-height: 380px;
}

.phone-auth-content h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    margin-top: 18px;
}

.phone-auth-content h2::after {
    display: none;
}

.phone-auth-content p {
    color: #666;
    margin-bottom: 30px;
}

.auth-step {
    margin: 20px 0;
}

#otp-step {
    position: static;
}

#otp-step .back-arrow-btn {
    position: absolute;
    top: 15px;
    left: 15px;
}

@media (max-width: 480px) {
    #otp-step .back-arrow-btn {
        top: 12px;
        left: 12px;
    }
}

.phone-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 5px;
}

.country-code {
    padding: 12px 15px;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    font-weight: 600;
}

#phone-number, #otp-code {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
}

#phone-number:focus, #otp-code:focus {
    outline: none;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    margin-top: 15px;
    text-decoration: underline;
}

.otp-sent-message {
    margin-bottom: 20px;
    margin-top: 15px;
    color: #333;
}

.otp-sent-message::after {
    display: none;
}

.otp-sent-message span {
    font-weight: 600;
    color: var(--primary-color);
}

.back-arrow-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    padding: 10px;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.back-arrow-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

.auth-message {
    margin-top: 20px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.auth-message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.auth-message.error {
    background: #ffebee;
    color: #c62828;
}

@media (max-width: 480px) {
    .phone-auth-content {
        padding: 30px 20px;
    }
}

/* Welcome Language Toggle - centered at bottom */
.phone-auth-content {
    position: relative;
}

.welcome-lang-toggle {
    position: relative;
    margin: 25px auto 0 auto;
    display: flex;
    /* Override navbar white colors for dark modal context */
    background: linear-gradient(135deg, #3b030d 0%, #5e0918 25%, #7c0f23 50%, #5e0918 75%, #3b030d 100%);
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.welcome-lang-toggle:hover {
    background: linear-gradient(135deg, #4a040f 0%, #6f0a1c 25%, #8d1128 50%, #6f0a1c 75%, #4a040f 100%);
    transform: scale(1.05);
}

.welcome-lang-toggle .language-text,
.welcome-lang-toggle .language-alt {
    color: #fff;
}

/* Default state: English is active (bold) */
.welcome-lang-toggle .language-text {
    font-weight: 700;
}

.welcome-lang-toggle .language-alt {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.welcome-lang-toggle svg {
    stroke: #fff;
}

/* Arabic active state: Arabic is bold, English is dimmed */
.welcome-lang-toggle.arabic .language-text {
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 400 !important;
}

.welcome-lang-toggle.arabic .language-alt {
    color: #fff !important;
    font-weight: 700 !important;
}

/* RTL adjustments for welcome modal */
body.rtl .phone-auth-content h2,
body.rtl .phone-auth-content p {
    direction: rtl;
}

body.rtl .phone-input-group {
    flex-direction: row-reverse;
}

body.rtl #phone-number {
    text-align: right;
}

/* Login popup App Store button - mobile only */
.login-app-store {
    display: none;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.login-app-store .app-store-badge {
    display: inline-block;
    transition: transform 0.2s ease;
}

.login-app-store .app-store-badge:hover {
    transform: scale(1.05);
}

.login-app-store .app-store-badge svg {
    width: 130px;
    height: auto;
}

/* Show only on mobile/phone devices */
@media (max-width: 768px) {
    .login-app-store {
        display: block;
    }
}

/* Hide in native app */
body.native-app .login-app-store {
    display: none !important;
}
