/* ==========================================================================
   9. Authentication Forms - تسجيل الدخول وإنشاء حساب جديد
   ========================================================================== */

/* Auth Screens */
#login-screen,
#register-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.auth-header {
    background: white;
    position: relative;
    margin-bottom: 0;
    border: none;
}

.auth-container {
    width: min(540px, 100%);
    max-width: 540px;
    padding: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-card-header h3 {
    margin: 0 0 8px;
    font-size: 1.8rem;
    font-weight: 800;
    color: #111;
}

.auth-card-header p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
}

/* Form Group */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.input-wrapper input {
    flex: 1;
}

.input-icon {
    position: absolute;
    left: 14px;
    pointer-events: none;
    font-size: 1.1rem;
}

.password-toggle {
    position: absolute;
    left: auto;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    transition: transform 0.2s;
}

.password-toggle:hover {
    transform: scale(1.1);
}

/* Error Message */
.error-message {
    color: #d32f2f;
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
    min-height: 1.2em;
}

/* Checkbox Styling */
.checkbox-group {
    margin-bottom: 18px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    user-select: none;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Account Type Selector */
.account-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.account-type-option {
    cursor: pointer;
}

.account-type-option input[type="radio"] {
    display: none;
}

.option-card {
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    background: #f9f9f9;
}

.account-type-option input[type="radio"]:checked + .option-card {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.option-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.option-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.option-desc {
    font-size: 0.8rem;
    color: #777;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 8px;
}

.strength-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.strength-fill {
    width: 30%;
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
    border-radius: 3px;
}

.strength-text {
    font-size: 0.8rem;
    display: block;
}

/* Auth Form */
.auth-form {
    margin-bottom: 16px;
}

.auth-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}

.auth-role-picker {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.auth-role-picker button {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
    color: #666;
}

.auth-role-picker button:hover {
    border-color: #667eea;
    color: #667eea;
}

.auth-role-picker button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Auth Actions */
.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

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

.btn-large {
    padding: 14px 18px;
    font-size: 1.05rem;
    min-height: 50px;
}

.btn-loader {
    animation: spin 1s linear infinite;
}

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

.link-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    text-decoration: none;
    font-size: inherit;
    padding: 0;
    font-weight: 600;
    transition: color 0.3s;
}

.link-btn:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Auth Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 18px 0;
    color: #999;
    font-size: 0.9rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.auth-divider span {
    padding: 0 10px;
    background: white;
}

/* Social Login */
.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
}

.btn-social {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.btn-social:hover {
    border-color: #667eea;
    background: #f9f9f9;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 0.9rem;
    color: #666;
}

.auth-footer p {
    margin: 8px 0;
}

/* Mode Toggle */
.auth-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}

.auth-mode-toggle button {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #666;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.auth-mode-toggle button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* ==========================================================================
   10. Responsive Auth Forms
   ========================================================================== */

@media (max-width: 600px) {
    .auth-card {
        padding: 24px;
        border-radius: 16px;
    }

    .auth-card-header h3 {
        font-size: 1.5rem;
    }

    .auth-grid {
        gap: 12px;
    }

    .account-type-selector {
        grid-template-columns: 1fr 1fr;
    }

    .auth-role-picker {
        grid-template-columns: 1fr 1fr 1fr;
    }

    #login-screen,
    #register-screen {
        padding: 12px;
    }

    .main-header {
        padding: 18px 12px;
    }

    .main-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .auth-card {
        padding: 18px;
    }

    .auth-card-header h3 {
        font-size: 1.3rem;
    }

    .form-group input,
    .form-group select {
        padding: 10px 12px;
        font-size: 16px;
    }

    .social-login {
        grid-template-columns: 1fr;
    }

    .account-type-selector {
        grid-template-columns: 1fr;
    }

    .auth-role-picker {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   11. Animation Effects
   ========================================================================== */

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Smooth transitions for all form elements */
input, select, textarea, button {
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

/* Focus ring for accessibility */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}
