@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('background-login.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.1;
    z-index: -1;
}

/* Animated background particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.particle:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 120px;
    height: 120px;
    top: 60%;
    left: 80%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    width: 60px;
    height: 60px;
    top: 80%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

.wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.8s ease-out;
}

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

.wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 300% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.title {
    text-align: center;
    margin-bottom: 35px;
    position: relative;
}

.title span {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    display: inline-block;
}

.title span::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.row {
    position: relative;
    margin-bottom: 25px;
}

.row input {
    width: 100%;
    padding: 18px 60px 18px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 15px;
    font-size: 16px;
    font-family: 'Cairo', sans-serif;
    background: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    outline: none;
    color: #2c3e50;
    font-weight: 500;
}

.row input:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    color: #2c3e50;
}

.row input::placeholder {
    color: #7f8c8d;
    font-weight: 400;
    opacity: 0.8;
}

.row input:not(:placeholder-shown) {
    color: #2c3e50;
    background: rgba(255, 255, 255, 1);
}

/* تحسين وضوح النص عند الكتابة */
.row input[type="text"],
.row input[type="password"],
.row input[type="email"],
.row input[type="tel"] {
    color: #2c3e50 !important;
    font-weight: 500;
    text-shadow: none;
}

.row input[type="text"]:focus,
.row input[type="password"]:focus,
.row input[type="email"]:focus,
.row input[type="tel"]:focus {
    color: #2c3e50 !important;
    background: rgba(255, 255, 255, 1) !important;
}

/* تحسين مظهر النص عند الكتابة */
.row input[type="text"]::selection,
.row input[type="password"]::selection,
.row input[type="email"]::selection,
.row input[type="tel"]::selection {
    background: rgba(102, 126, 234, 0.3);
    color: #2c3e50;
}

.row i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 18px;
    transition: all 0.3s ease;
}

.row input:focus + i,
.row input:not(:placeholder-shown) + i {
    color: #764ba2;
    transform: translateY(-50%) scale(1.1);
}

.row.button {
    margin-top: 35px;
    margin-bottom: 25px;
}

.row.button input {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.row.button input::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.row.button input:hover::before {
    left: 100%;
}

.row.button input:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.row.button input:active {
    transform: translateY(-1px);
}

.signup-link {
    text-align: center;
    font-size: 16px;
    color: #666;
    margin-top: 20px;
}

.signup-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.signup-link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.signup-link a:hover::after {
    width: 100%;
}

.signup-link a:hover {
    color: #764ba2;
}

.message {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    animation: shake 0.5s ease-in-out;
    display: none;
}

.message.success {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.3);
}

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

#error-message {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    animation: shake 0.5s ease-in-out;
    display: none;
}

#error-message.success {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.3);
}

/* Loading animation */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 480px) {
    .wrapper {
        padding: 30px 25px;
        margin: 10px;
    }
    
    .title span {
        font-size: 24px;
    }
    
    .row input {
        padding: 16px 55px 16px 18px;
        font-size: 15px;
    }
    
    .row i {
        right: 18px;
        font-size: 16px;
    }
    
    .row.button input {
        font-size: 16px;
        padding: 16px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .wrapper {
        background: rgba(44, 62, 80, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .row input {
        background: rgba(52, 73, 94, 0.9);
        border-color: #34495e;
        color: #ecf0f1;
        font-weight: 500;
    }
    
    .row input:focus {
        background: rgba(52, 73, 94, 1);
        border-color: #667eea;
        color: #ecf0f1;
    }
    
    .row input:not(:placeholder-shown) {
        color: #ecf0f1;
        background: rgba(52, 73, 94, 1);
    }
    
    .row input::placeholder {
        color: #bdc3c7;
        opacity: 0.8;
    }
    
    /* تحسين وضوح النص في الوضع المظلم */
    .row input[type="text"],
    .row input[type="password"],
    .row input[type="email"],
    .row input[type="tel"] {
        color: #ecf0f1 !important;
        background: rgba(52, 73, 94, 0.9) !important;
    }
    
    .row input[type="text"]:focus,
    .row input[type="password"]:focus,
    .row input[type="email"]:focus,
    .row input[type="tel"]:focus {
        color: #ecf0f1 !important;
        background: rgba(52, 73, 94, 1) !important;
    }
    
    .row input[type="text"]::selection,
    .row input[type="password"]::selection,
    .row input[type="email"]::selection,
    .row input[type="tel"]::selection {
        background: rgba(102, 126, 234, 0.3);
        color: #ecf0f1;
    }
    
    .signup-link {
        color: #bdc3c7;
    }
}

/* Enhanced animations */
.wrapper:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 60px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Focus trap for accessibility */
.row input:focus {
    z-index: 10;
    position: relative;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}
