:root {
    --primary-color: #304FFE;
    --primary-dark: #2640e0;
    --secondary-color: #1a1a2e;
    --text-primary: #1a1a2e;
    --text-secondary: #666666;
    --bg-primary: #f8f8f8;
    --bg-secondary: #ffffff;
    --border-color: #e0e0e0;
    --input-bg: #ffffff;
    --error-color: #ff4757;
    --success-color: #2ed573;
    --google-blue: #4285F4;
    --facebook-blue: #1877F2;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: #f8f8f8;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

body[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

body[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: #ffffff;
    backdrop-filter: blur(10px);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    align-items: center;
    width: 100%;
    flex-direction: row !important;
    justify-content: space-between !important;
}

.logo-container {
    display: flex;
    align-items: center;
}

.language-switcher {
    position: relative;
}

/* Logo always on the right side for both languages - Force position */
body[dir="ltr"] .logo-container {
    margin-left: auto !important;
    margin-right: 0 !important;
    order: 2 !important;
}

body[dir="rtl"] .logo-container {
    margin-right: auto !important;
    margin-left: 0 !important;
    order: 2 !important;
}

/* Language switcher always on the left side (visual left) */
body[dir="ltr"] .language-switcher {
    margin-left: 0 !important;
    margin-right: auto !important;
    order: 1 !important;
}

body[dir="rtl"] .language-switcher {
    margin-right: 0 !important;
    margin-left: auto !important;
    order: 1 !important;
}

.logo {
    height: 32px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}


/* Language Switcher - Always on the left side */

.lang-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.globe-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: block;
}

.lang-toggle-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(48, 79, 254, 0.05);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    width: auto;
    display: none;
    z-index: 1000;
    overflow: hidden;
    animation: fadeInDown 0.2s ease;
}

/* RTL: Open dropdown from right side to prevent text overflow */
body[dir="rtl"] .lang-dropdown {
    left: auto !important;
    right: 0 !important;
    min-width: 160px;
    width: auto;
    max-width: 200px;
    overflow: hidden;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-dropdown.active {
    display: block;
}

.lang-option {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    box-sizing: border-box;
    overflow: hidden;
    white-space: nowrap;
}

body[dir="rtl"] .lang-option {
    text-align: right;
    direction: rtl;
    justify-content: flex-start;
    flex-direction: row;
}

body[dir="rtl"] .lang-option span {
    flex: 1;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}

body[dir="rtl"] .lang-option .check-icon {
    flex-shrink: 0;
    margin-right: 0;
    margin-left: 0;
}

.lang-option:hover {
    background: rgba(48, 79, 254, 0.05);
    color: var(--primary-color);
}

.lang-option.active {
    background: rgba(48, 79, 254, 0.1);
    color: var(--primary-color);
}

.lang-option.active .check-icon {
    display: block !important;
}

.check-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 60px 0;
    min-height: calc(100vh - 200px);
}

.auth-container {
    max-width: 480px;
    margin: 0 auto;
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-align: center;
}

/* Auth Forms */
.auth-forms {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: #f8f8f8;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(48, 79, 254, 0.05);
}

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

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Auth Form */
.auth-form {
    display: none;
    padding: 40px;
}

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

.form {
    width: 100%;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font-family);
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(48, 79, 254, 0.1);
    background: #ffffff;
}

.form-group input::placeholder {
    color: var(--text-secondary);
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

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

body[dir="ltr"] .password-input-wrapper input {
    padding-right: 16px;
    padding-left: 45px;
}

.toggle-password {
    position: absolute;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

body[dir="ltr"] .toggle-password {
    right: auto;
    left: 8px;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.toggle-password:focus {
    outline: none;
}

.toggle-password svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.btn-primary {
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(48, 79, 254, 0.3);
}

.btn-google {
    background: #ffffff;
    color: #333333;
    border: 1px solid var(--border-color);
}

.btn-google:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-facebook {
    background: var(--facebook-blue);
    color: #ffffff;
}

.btn-facebook:hover {
    background: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
}

.btn svg {
    flex-shrink: 0;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

body[dir="rtl"] .divider::before {
    margin-left: 10px;
}

body[dir="rtl"] .divider::after {
    margin-right: 10px;
}

body[dir="ltr"] .divider::before {
    margin-right: 10px;
}

body[dir="ltr"] .divider::after {
    margin-left: 10px;
}

/* Forgot Password */
.forgot-password {
    text-align: center;
    margin-top: 20px;
}

.forgot-password a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.forgot-password a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Footer */
.footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 40px 0 20px;
    margin-top: 60px;
}

.footer-content {
    margin-bottom: 30px;
}

.footer-text {
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.footer-text.warning-text {
    color: #ffa726;
    font-weight: 500;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-container {
        max-width: 100%;
        padding: 0 15px;
    }

    .auth-form {
        padding: 30px 20px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .header-content {
        flex-direction: row !important;
        gap: 0;
        justify-content: space-between !important;
    }

    body[dir="ltr"] .logo-container {
        margin-left: auto !important;
        margin-right: 0 !important;
        order: 2 !important;
    }

    body[dir="rtl"] .logo-container {
        margin-right: auto !important;
        margin-left: 0 !important;
        order: 2 !important;
    }

    body[dir="ltr"] .language-switcher {
        margin-left: 0 !important;
        margin-right: auto !important;
        order: 1 !important;
    }

    body[dir="rtl"] .language-switcher {
        margin-right: 0 !important;
        margin-left: auto !important;
        order: 1 !important;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 30px 0;
    }

    .auth-form {
        padding: 25px 15px;
    }

    .tab-btn {
        padding: 15px;
        font-size: 14px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .header-content {
        flex-direction: row !important;
        justify-content: space-between !important;
    }

    body[dir="ltr"] .logo-container {
        margin-left: auto !important;
        margin-right: 0 !important;
        order: 2 !important;
    }

    body[dir="rtl"] .logo-container {
        margin-right: auto !important;
        margin-left: 0 !important;
        order: 2 !important;
    }

    body[dir="ltr"] .language-switcher {
        margin-left: 0 !important;
        margin-right: auto !important;
        order: 1 !important;
    }

    body[dir="rtl"] .language-switcher {
        margin-right: 0 !important;
        margin-left: auto !important;
        order: 1 !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form.active {
    animation: fadeIn 0.3s ease;
}

/* Loading State */
.btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Messages */
.error-message {
    color: var(--error-color);
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

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

/* Success Messages */
.success-message {
    color: var(--success-color);
    font-size: 14px;
    padding: 12px;
    background: rgba(46, 213, 115, 0.1);
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

/* Toast Notification Container */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    width: calc(100% - 40px);
    pointer-events: none;
}

body[dir="rtl"] .toast-container {
    left: 50%;
    right: auto;
}

/* Toast Notification */
.toast {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    border-right: 4px solid var(--primary-color);
    min-height: 56px;
}

body[dir="rtl"] .toast {
    border-right: none;
    border-left: 4px solid var(--primary-color);
}

.toast.warning {
    border-color: #ffa726;
}

.toast.success {
    border-color: var(--success-color);
}

.toast.error {
    border-color: var(--error-color);
}

.toast-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 24px;
    height: 24px;
}

.toast.warning .toast-icon {
    color: #ffa726;
}

.toast.success .toast-icon {
    color: var(--success-color);
}

.toast.error .toast-icon {
    color: var(--error-color);
}

.toast-content {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}

.toast-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 4px;
}

.toast-close:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.toast-close svg {
    width: 18px;
    height: 18px;
}

/* Toast Animation */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease-in forwards;
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Responsive Toast */
@media (max-width: 480px) {
    .toast-container {
        width: calc(100% - 20px);
        top: 10px;
    }
    
    .toast {
        padding: 14px 16px;
        font-size: 13px;
    }
}
