* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #00A859;
    --primary-green-dark: #008045;
    --primary-green-light: #00C96B;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #E0E0E0;
    --bg-light: #F5F5F5;
    --white: #FFFFFF;
    --error-color: #E74C3C;
    --success-color: #27AE60;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    direction: rtl;
    overflow-x: hidden;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
}

.splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.splash-screen img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Main Container */
.main-container {
    display: flex;
    min-height: 100vh;
    background: var(--white);
}

/* Side Image */
.side-image {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.side-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/></svg>') repeat;
    opacity: 0.3;
}

.side-logo {
    position: absolute;
    top: 30px;
    right: 30px;
    left: 30px;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
}

.side-logo-img {
    max-width: 180px;
    height: auto;
    filter: brightness(0) invert(1);
}

.login-mobile-img {
    max-width: 100%;
    height: auto;
    z-index: 1;
    position: relative;
    margin-top: 60px;
}

/* Login Section */
.login-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--white);
}

.login-content {
    width: 100%;
    max-width: 450px;
}

/* Logo */
.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.main-logo {
    max-width: 200px;
    height: auto;
}

/* Login Tabs */
.login-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.tab-button:hover {
    color: var(--primary-green);
}

.tab-button.active {
    color: var(--primary-green);
    border-bottom-color: var(--primary-green);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.login-form,
.register-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Cairo', sans-serif;
    color: var(--text-dark);
    background: var(--white);
    transition: all 0.3s ease;
    direction: rtl;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 168, 89, 0.1);
}

.form-group input::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

/* Phone Input */
.phone-input-wrapper {
    display: flex;
    gap: 10px;
}

.country-code {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 120px;
}

.flag-image {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
}

.country-code .code {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.phone-input-wrapper input {
    flex: 1;
}

/* Select Wrapper */
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.select-icon {
    position: absolute;
    right: 16px;
    width: 20px;
    height: 15px;
    z-index: 1;
    pointer-events: none;
}

.select-wrapper select {
    padding-right: 50px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    background-size: 12px;
}

/* Toggle Password */
.toggle-password {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    margin-top: 20px;
}

.form-group {
    position: relative;
}

.form-group input[type="password"] {
    padding-left: 50px;
}

/* Password Requirements */
.password-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.req-item {
    font-size: 12px;
    padding: 4px 8px;
    background: var(--bg-light);
    border-radius: 4px;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.req-item.valid {
    background: var(--success-color);
    color: var(--white);
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
}

.forgot-password {
    color: var(--primary-green);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: var(--primary-green-dark);
    text-decoration: underline;
}

/* Submit Button */
.submit-button {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.submit-button:hover {
    background: var(--primary-green-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.submit-button:active {
    transform: translateY(0);
}

/* Register Section */
.register-section {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.register-section p {
    font-size: 14px;
    color: var(--text-light);
}

.register-section a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s ease;
}

.register-section a:hover {
    color: var(--primary-green-dark);
    text-decoration: underline;
}

/* Register Modal */
.register-modal,
.otp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.register-modal.active,
.otp-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.close-modal {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 30px;
}

.register-subtitle,
.otp-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 16px;
}

.otp-phone {
    text-align: center;
    color: var(--primary-green);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 30px;
}

.otp-form {
    width: 100%;
}

.otp-attempts {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--text-dark);
}

.resend-otp-button {
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    color: var(--primary-green);
    border: 2px solid var(--primary-green);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.resend-otp-button:hover:not(:disabled) {
    background: var(--primary-green);
    color: var(--white);
}

.resend-otp-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer */
.main-footer {
    background: var(--white);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 968px) {
    .main-container {
        flex-direction: column;
    }

    .side-image {
        min-height: 300px;
        padding: 20px;
    }

    .side-logo {
        top: 20px;
        right: 20px;
        left: 20px;
    }

    .side-logo-img {
        max-width: 150px;
    }

    .login-mobile-img {
        max-width: 300px;
        margin-top: 40px;
    }

    .login-section {
        padding: 30px 20px;
    }
}

@media (max-width: 768px) {
    .login-tabs {
        flex-direction: column;
        gap: 0;
    }

    .tab-button {
        border-bottom: 1px solid var(--border-color);
        border-left: none;
        border-right: none;
    }

    .tab-button.active {
        border-bottom-color: var(--primary-green);
        border-bottom-width: 3px;
    }

    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .side-logo {
        top: 15px;
        right: 15px;
        left: 15px;
    }

    .side-logo-img {
        max-width: 120px;
    }

    .login-mobile-img {
        margin-top: 30px;
    }

    .phone-input-wrapper {
        flex-direction: column;
    }

    .country-code {
        width: 100%;
        justify-content: center;
    }

    .password-requirements {
        flex-direction: column;
    }
}

/* Loading State */
.submit-button.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.submit-button.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid var(--white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error States */
.form-group.error input,
.form-group.error select {
    border-color: var(--error-color);
}

.form-group .error-message {
    display: block;
    color: var(--error-color);
    font-size: 12px;
    margin-top: 5px;
}

.error-message {
    display: none;
}
