/* ==========================================
   Modern Login Page - Custom CSS3
   RTL Support with Animations
   ========================================== */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors matching the design */
    --primary-main: #323e7d;
    --primary-secondary: #00b5b4;
    --primary-cyan: #00b5b4;
    --primary-turquoise: #00b5b4;
    --dark-blue: #323e7d;
    --light-blue: #4a5a9d;
    --gradient-blue: linear-gradient(135deg, #323e7d 0%, #4a5a9d 100%);
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --gray: #6c757d;
    --dark-gray: #343a40;
    --error-red: #dc3545;
    --success-green: #28a745;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 5px 20px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--light-gray);
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
}

/* ==========================================
   Main Container - Grid Layout
   ========================================== */
.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    animation: fadeIn 0.6s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   Right Side Panel - Blue Gradient
   ========================================== */
.login-side-panel {
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

/* Animated Background Pattern */
.login-side-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
}

@keyframes moveBackground {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

.side-panel-content {
    position: relative;
    z-index: 1;
    color: var(--white);
    text-align: center;
    animation: slideInRight 0.8s ease-out;
}

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

/* Logo Section */
.logo-section {
    margin-bottom: 1rem;
}

.logo-circle {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(255, 255, 255, 0);
    }
}

.logo-circle i {
    font-size: 2rem;
    color: var(--white);
}

.system-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.system-subtitle {
    font-size: 0.8rem;
    font-weight: 300;
    opacity: 0.9;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

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

/* Features List */
.features-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: floatUp 3s ease-in-out infinite;
}

@keyframes floatUp {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.feature-item:nth-child(1) {
    animation-delay: 0s;
}

.feature-item:nth-child(2) {
    animation-delay: 0.5s;
}

.feature-item:nth-child(3) {
    animation-delay: 1s;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-10px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.feature-icon {
    width: 35px;
    height: 35px;
    background: var(--white);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.feature-item:hover .feature-icon {
    transform: rotate(360deg) scale(1.1);
}

.feature-icon i {
    font-size: 1.1rem;
    background: var(--gradient-blue);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feature-text {
    text-align: right;
}

.feature-text h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.feature-text p {
    font-size: 0.75rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ==========================================
   Left Side Panel - Login Form
   ========================================== */
.login-form-panel {
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: slideInLeft 0.8s ease-out;
}

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

.form-wrapper {
    width: 100%;
    max-width: 500px;
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.form-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-gray);
    margin-bottom: 0.5rem;
    animation: fadeInDown 0.6s ease-out;
}

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

.title-underline {
    width: 60px;
    height: 3px;
    background: var(--primary-turquoise);
    margin: 0 auto;
    border-radius: 2px;
    animation: expandWidth 0.8s ease-out 0.3s both;
}

@keyframes expandWidth {
    from {
        width: 0;
    }
    to {
        width: 80px;
    }
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    animation: slideDown 0.4s ease-out;
}

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

.alert i {
    font-size: 1.3rem;
    margin-top: 0.2rem;
}

.alert-error {
    background: #ffe6e6;
    color: var(--error-red);
    border: 1px solid #ffcccc;
}

.alert-success {
    background: #e6f7e6;
    color: var(--success-green);
    border: 1px solid #ccf0cc;
}

.alert-content p {
    margin: 0.3rem 0;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-group {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-out;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.3rem;
}

.label-icon {
    color: var(--primary-turquoise);
    font-size: 1.1rem;
}

.required {
    color: var(--error-red);
    font-weight: 700;
}

.input-wrapper {
    position: relative;
    transition: all 0.3s ease;
}

.input-wrapper.input-focused {
    transform: translateY(-2px);
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-family: 'Cairo', sans-serif;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--light-gray);
    color: var(--dark-gray);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.form-input::placeholder {
    color: var(--gray);
    opacity: 0.7;
}

.form-input:focus {
    border-color: var(--primary-turquoise);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(23, 162, 184, 0.1);
    transform: translateY(-2px);
}

.form-input:hover {
    border-color: var(--primary-cyan);
}

.input-error {
    border-color: var(--error-red) !important;
}

.input-error:focus {
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1) !important;
}

/* Password Toggle */
.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: var(--primary-turquoise);
    transform: translateY(-50%) scale(1.1);
}

.toggle-password i {
    font-size: 1rem;
}

.password-wrapper .form-input {
    padding-left: 3.5rem;
}

.error-message {
    display: block;
    color: var(--error-red);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.checkbox-custom::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--white);
    font-size: 0.7rem;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.remember-me input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary-turquoise);
    border-color: var(--primary-turquoise);
}

.remember-me input[type="checkbox"]:checked + .checkbox-custom::after {
    opacity: 1;
    transform: scale(1);
}

.checkbox-label {
    font-size: 0.95rem;
    color: var(--dark-gray);
}

.forgot-password {
    color: var(--primary-turquoise);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.forgot-password::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--primary-turquoise);
    transition: width 0.3s ease;
}

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

.forgot-password:hover::after {
    width: 100%;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: var(--white);
    background: var(--primary-turquoise);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0, 181, 180, 0.2);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.submit-btn:hover::before {
    width: 300px;
    height: 300px;
}

.submit-btn:hover {
    background: var(--primary-cyan);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(23, 162, 184, 0.4);
}

.submit-btn:active {
    transform: translateY(-1px);
}

.btn-text,
.btn-icon {
    position: relative;
    z-index: 1;
}

.btn-icon {
    transition: transform 0.3s ease;
}

.submit-btn:hover .btn-icon {
    transform: translateX(-5px);
}

/* Register Section */
.register-section {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(20px);
}

.register-text {
    color: var(--gray);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.register-links {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
}

.register-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--light-gray);
    color: var(--dark-gray);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.register-link:hover {
    background: var(--primary-turquoise);
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3);
}

.register-link i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.register-link:hover i {
    transform: scale(1.2) rotate(5deg);
}

/* ==========================================
   Responsive Design - Media Queries
   ========================================== */

/* Tablets */
@media (max-width: 1024px) {
    .login-container {
        grid-template-columns: 1fr;
    }
    
    .login-side-panel {
        display: none;
    }
    
    .login-form-panel {
        padding: 2rem;
    }
}

/* Mobile Landscape */
@media (max-width: 768px) {
    .form-wrapper {
        max-width: 100%;
    }
    
    .form-title {
        font-size: 1.7rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .register-links {
        flex-direction: column;
        width: 100%;
    }
    
    .register-link {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .login-form-panel {
        padding: 1.5rem;
    }
    
    .form-header {
        margin-bottom: 2rem;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    .form-input {
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }
    
    .submit-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    .login-form-panel {
        padding: 1rem;
    }
    
    .form-title {
        font-size: 1.3rem;
    }
    
    .title-underline {
        width: 60px;
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .login-side-panel,
    .register-section {
        display: none;
    }
}

/* ==========================================
   Accessibility
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Visible for Keyboard Navigation */
.form-input:focus-visible,
.submit-btn:focus-visible,
.register-link:focus-visible,
.forgot-password:focus-visible {
    outline: 3px solid var(--primary-turquoise);
    outline-offset: 3px;
}
