/* Login Page Styles */

body {
    background: url('../images/bg_3.jpg') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    font-family: 'Cairo', sans-serif;
    position: relative;
}

/* Dark overlay for better readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

/* Ensure mobile nav is visible on login page */
@media (max-width: 991.98px) {
    body {
        padding-top: 55px !important;
    }
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 100%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #F26722, #F26722);
}

/* Toggle Buttons */
.toggle-buttons {
    display: flex;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 5px;
    margin-bottom: 30px;
    gap: 5px;
}

.toggle-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #666;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.toggle-btn.active {
    background: #F26722;
    color: white;
    box-shadow: 0 4px 12px rgba(196, 30, 58, 0.3);
}

.toggle-btn:hover:not(.active) {
    background: rgba(196, 30, 58, 0.1);
    color: #F26722;
}

/* Form Styles */
.form-container {
    transition: all 0.3s ease;
}

.form-container.hidden {
    display: none;
}

.form-title {
    text-align: center;
    color: #F26722;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
}

.form-subtitle {
    text-align: center;
    color: #666;
    font-size: 16px;
    margin-bottom: 30px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #F26722;
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: #333;
    direction: ltr;
    text-align: right;
}

.form-group input:focus {
    outline: none;
    border-color: #F26722;
    background: white;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.form-group input::placeholder {
    color: #adb5bd;
    direction: ltr;
    text-align: left;
}

/* Phone input specific styling */
input[type="tel"] {
    direction: ltr !important;
    text-align: left !important;
    font-family: 'Poppins', sans-serif !important;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 15px;
    background: #F26722;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.submit-btn:hover {
    background: #a01729;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(196, 30, 58, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Success/Error Messages */
.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
    text-align: center;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Loading State */
.submit-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-btn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .login-container {
        padding: 15px;
        min-height: calc(100vh - 70px);
    }

    .login-card {
        padding: 30px 20px;
        border-radius: 15px;
    }

    .form-title {
        font-size: 24px;
    }

    .form-subtitle {
        font-size: 14px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .toggle-btn {
        padding: 10px 15px;
        font-size: 13px;
        /* Ensure buttons are touchable on mobile */
        min-height: 44px;
        touch-action: manipulation;
    }

    .form-group input {
        padding: 12px 15px;
        font-size: 16px;
        /* Prevent zoom on iOS */
        /* Ensure inputs are touchable on mobile */
        min-height: 44px;
        touch-action: manipulation;
    }

    .submit-btn {
        padding: 12px;
        font-size: 14px;
        /* Ensure submit button is touchable on mobile */
        min-height: 44px;
        touch-action: manipulation;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 25px 15px;
    }

    .form-title {
        font-size: 22px;
    }

    .toggle-buttons {
        margin-bottom: 25px;
    }

    /* Ensure all interactive elements are properly sized for touch */
    .toggle-btn,
    .submit-btn,
    .form-group input {
        min-height: 48px;
        /* Larger touch targets for small screens */
    }

    /* Prevent horizontal scrolling */
    .login-container {
        padding: 10px;
        overflow-x: hidden;
    }

    .login-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
}

/* Animation for form switching */
.form-container {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input validation styles */
.form-group input.invalid {
    border-color: #dc3545;
    background: #fff5f5;
}

.form-group input.valid {
    border-color: #28a745;
    background: #f8fff8;
}

/* Icons in buttons */
.toggle-btn i,
.submit-btn i {
    font-size: 16px;
}

/* RTL Support */
[dir="rtl"] .form-group input {
    text-align: right;
}

[dir="rtl"] input[type="tel"] {
    text-align: left !important;
}

[dir="rtl"] .form-group input::placeholder {
    text-align: left;
}

/* Additional mobile optimizations */
@media (max-width: 768px) {

    /* Prevent zoom on input focus for iOS */
    input[type="text"],
    input[type="tel"],
    input[type="email"] {
        font-size: 16px !important;
        -webkit-appearance: none;
        -webkit-border-radius: 0;
    }

    /* Improve button accessibility on touch devices */
    .toggle-btn,
    .submit-btn {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Ensure proper scrolling on mobile */
    body {
        -webkit-overflow-scrolling: touch;
    }

    /* Fix for viewport issues on mobile browsers */
    .login-container {
        min-height: calc(100vh - 80px);
        min-height: calc(100dvh - 80px);
        /* Dynamic viewport height for modern browsers */
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .login-container {
        min-height: calc(100vh - 60px);
        padding: 10px;
    }

    .login-card {
        padding: 20px 15px;
    }

    .form-title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .form-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .toggle-buttons {
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 15px;
    }
}
