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

:root {
    --primary-color: #41848d;
    --primary-gradient: linear-gradient(135deg, #41848d 0%, #12b5cf 100%);
    --secondary-color: #12b5cf;
    --text-color: #2d3748;
    --text-muted: #718096;
    --bg-color: #f7fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: 'Inter', 'Cairo', sans-serif;
    background: #f0f4f8;
    background-image: 
        radial-gradient(at 0% 0%, rgba(65, 132, 141, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(18, 181, 207, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(65, 132, 141, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(18, 181, 207, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 2rem;
    overflow-x: hidden;
}

.login-wrapper {
    width: 100%;
    max-width: 1000px;
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    width: 100%;
    max-width: 450px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-header {
    background: var(--primary-gradient);
    padding: 3rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.6;
}

.logo-icon-wrapper {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.logo-icon {
    font-size: 2.5rem;
    color: white;
}

.login-title {
    font-weight: 700;
    font-size: 1.75rem;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card-body {
    padding: 2.5rem;
}

.form-floating {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-control {
    border: 2px solid var(--input-border);
    border-radius: 12px;
    padding: 1rem 1rem 1rem 3rem; /* Extra padding for icon */
    height: auto;
    background-color: var(--input-bg);
    transition: all 0.3s ease;
    font-size: 1rem;
    color: var(--text-color);
}

/* RTL Support for inputs */
html[dir="rtl"] .form-control {
    padding: 1rem 3rem 1rem 1rem;
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(18, 181, 207, 0.1);
    background-color: white;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: color 0.3s ease;
    z-index: 10;
}

html[dir="rtl"] .input-icon {
    left: auto;
    right: 1rem;
}

.form-control:focus + .input-icon,
.form-control:focus ~ .input-icon {
    color: var(--primary-color);
}

/* Password field: extra padding for eye toggle only (no left icon) */
.password-input {
    padding-left: 1rem;
    padding-right: 3rem;
}

html[dir="rtl"] .password-input {
    padding-left: 3rem;
    padding-right: 1rem;
}

/* Password show/hide toggle button */
.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    padding: 0.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s ease;
}

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

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

html[dir="rtl"] .password-toggle {
    right: auto;
    left: 0.75rem;
}

/* Remember me checkbox */
.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-label {
    user-select: none;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    box-shadow: 0 8px 15px rgba(65, 132, 141, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.alert-danger {
    background-color: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: shake 0.5s ease-in-out;
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Animations for form fields */
.form-group-anim {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.form-group-anim:nth-child(1) { animation-delay: 0.2s; }
.form-group-anim:nth-child(2) { animation-delay: 0.3s; }
.btn-anim { opacity: 0; animation: fadeIn 0.5s ease forwards; animation-delay: 0.4s; }

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

footer {
    position: fixed;
    bottom: 1rem;
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}