:root {
    --primary: #6A0DAD;
    --primary-dark: #5a0b94;
    --secondary: #FFEB3B;
    --light: #f8f9fa;
    --dark: #1e1e2c;
    --gray: #6c757d;
    --error: #dc2626;
    --success: #16a34a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    direction: ltr; /* Set to left-to-right */
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    direction: ltr; /* Ensure LTR for the container */
}

.logo {
    text-align: center;
    margin-bottom: 20px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    font-size: 24px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(106, 13, 173, 0.3);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
}

h1 {
    text-align: center;
    color: var(--dark);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 20px;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%; /* Adjusted for LTR */
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--secondary);
    border-radius: 2px;
}

.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}

.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.input-group {
    margin-bottom: 15px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--dark);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left; /* Adjusted for LTR */
}

.input-wrapper {
    position: relative;
}

input {
    width: 100%;
    padding: 12px 40px 12px 40px; /* Equal padding for icons on both sides */
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
    direction: ltr; /* Ensure LTR for input text */
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(106, 13, 173, 0.1);
    transform: translateY(-1px);
}

.input-icon {
    position: absolute;
    right: 12px; /* Icon on the right */
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 1rem;
}

.password-toggle {
    position: absolute;
    left: 12px; /* Password toggle on the left */
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: var(--primary);
}

.btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.btn:enabled {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 6px 15px rgba(106, 13, 173, 0.3);
}

.btn:enabled:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(106, 13, 173, 0.4);
}

.btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loading {
    display: none;
    animation: spin 1s linear infinite;
}

.btn:disabled .btn-loading {
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.link {
    text-align: center;
    margin-top: 15px;
    color: var(--gray);
    font-size: 0.9rem;
}

.link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; /* Adjusted for LTR */
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
}

.link a:hover::after {
    width: 100%;
}

.forgot-password {
    text-align: left; /* Adjusted for LTR */
    margin-top: -10px;
    margin-bottom: 15px;
}

.forgot-password a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

.forgot-password a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .login-container {
        padding: 20px;
        margin: 5px;
    }
    
    h1 {
        font-size: 1.4rem;
    }
    
    .logo-icon {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .logo-text {
        font-size: 1.3rem;
    }
    
    input {
        padding: 10px 35px 10px 35px; /* Equal padding for mobile */
    }
}