:root {
    --bg-gradient: linear-gradient(135deg, #2c3540 0%, #182026 100%);
    --card-bg: rgba(220, 225, 230, 0.92);
    --steel-dark: #0b112c;
    --text-main: #1a2233;
    --text-muted: #556273;
    --input-bg: #ffffff;
    --border-color: rgba(11, 17, 44, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transition: all 0.2s ease;
}

html, body {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px; 
    overflow-x: hidden;
}

body.rtl { direction: rtl; }

.lang-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}
body.rtl .lang-container { left: auto; right: 20px; }

.lang-select {
    background: rgba(255, 255, 255, 0.8);
    color: var(--steel-dark);
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    outline: none;
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    width: 100%;
    max-width: 460px;
    padding: 0 40px 40px 40px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
    overflow: hidden; 
}

.header-logo-zone {
    background-color: var(--steel-dark);
    margin: 0 -40px 30px -40px;
    padding: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 3px solid rgba(255, 255, 255, 0.1);
}

.app-logo {
    width: 100%;
    max-width: 160px;
    height: auto;
    object-fit: contain;
    display: block;
}

.method-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.08);
    padding: 6px;
    border-radius: 14px;
    margin-bottom: 25px;
}

.method-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
}

.method-btn.active {
    background: #ffffff;
    color: var(--steel-dark);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.input-group {
    margin-bottom: 18px;
    text-align: left;
}

body.rtl .input-group { text-align: right; }

.input-field {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
}

.input-field:focus {
    border-color: var(--steel-dark);
    box-shadow: 0 0 0 4px rgba(11, 17, 44, 0.1);
}

.phone-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    padding: 0 15px;
}

.phone-input-wrapper:focus-within {
    border-color: var(--steel-dark);
    box-shadow: 0 0 0 4px rgba(11, 17, 44, 0.1);
}

.country-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 16px 0;
    font-size: 0.95rem;
    font-weight: 600;
    user-select: none;
}

.field-divider {
    width: 1px;
    height: 22px;
    background-color: rgba(0, 0, 0, 0.15);
    margin: 0 15px;
}

.phone-clean-field {
    flex: 1;
    border: none !important;
    box-shadow: none !important;
    padding: 16px 0 !important;
    background: transparent !important;
}

.country-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.country-modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.country-modal-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    padding: 20px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.country-modal-overlay.open .country-modal-card {
    transform: translateY(0);
}

.search-box-wrapper {
    display: flex;
    align-items: center;
    background: #f1f3f4;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 10px 15px;
    margin-bottom: 15px;
}

.search-icon {
    font-size: 1.1rem;
    color: #757575;
    margin-right: 10px;
}
body.rtl .search-icon {
    margin-right: 0;
    margin-left: 10px;
}

#countrySearchInput {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 1rem;
    color: var(--text-main);
}

.country-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.country-item {
    display: flex;
    align-items: center;
    padding: 14px 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 0.95rem;
}

.country-item:hover {
    background-color: #f9f9f9;
}

.country-item .item-text {
    color: #a0a0a0;
    font-weight: 500;
}

.country-item .item-flag {
    margin: 0 8px;
    font-size: 1.2rem;
}

.country-item .item-code {
    color: #a0a0a0;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .input-field {
    padding-right: 54px;
}

body.rtl .password-wrapper .input-field {
    padding-right: 20px;
    padding-left: 54px;
}

.toggle-password-eye {
    position: absolute;
    right: 18px;
    width: 22px;
    height: 22px;
    cursor: pointer;
    background-color: var(--text-muted);
    opacity: 0.7;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z' /%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z' /%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z' /%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z' /%3E%3C/svg%3E") no-repeat center;
}

.toggle-password-eye:hover {
    opacity: 1;
    background-color: var(--steel-dark);
}

.toggle-password-eye.slashed {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18' /%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l18 18' /%3E%3C/svg%3E") no-repeat center;
}

body.rtl .toggle-password-eye {
    right: auto;
    left: 18px;
}

.dynamic-field {
    display: none;
    opacity: 0;
    transform: translateY(-8px);
}

.dynamic-field.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.submit-btn {
    width: 100%;
    background: linear-gradient(90deg, var(--steel-dark) 0%, #1c2754 100%);
    color: #ffffff;
    border: none;
    padding: 16px;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 6px 20px rgba(11, 17, 44, 0.2);
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(11, 17, 44, 0.35);
}

.message-box {
    margin-top: 15px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.auth-form {
    display: none;
}

.auth-form.active-form {
    display: block;
}

.switch-form-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--steel-dark);
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.switch-form-link:hover {
    text-decoration: underline;
}

@media (max-width: 400px) {
    body { padding: 20px 10px; }
    .auth-card { padding: 0 20px 30px 20px; border-radius: 20px; }
    .header-logo-zone { margin: 0 -20px 25px -20px; padding: 25px; }
    .app-logo { max-width: 140px; }
}