:root {
    --primary: #dc2626; /* Red from the logo */
    --primary-dark: #b91c1c;
    --primary-light: #ef4444;
    --secondary: #0f172a;
    --accent: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-dark: #020617;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(0, 0, 0, 0.2);
    --font-ar: "Cairo", sans-serif;
    --font-en: "Outfit", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-ar);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Background Animation */
.auth-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
}

.glass-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(100px);
    -webkit-backdrop-filter: blur(100px);
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    opacity: 0.4;
    animation: move 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    bottom: -50px;
    left: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: var(--accent);
    top: 40%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(100px, 50px) scale(1.1);
    }
}

/* Main Layout */
.login-wrapper {
    width: 100%;
    max-width: 1000px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    animation: fadeIn 0.8s ease-out;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    background: var(--glass);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Brand Section */
.brand-section {
    padding: 60px;
    background: rgba(220, 38, 38, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-left: 1px solid var(--glass-border);
}

.logo-wrapper {
    width: 140px;
    height: 140px;
    background: white;
    padding: 20px;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-logo {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.brand-text h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: white;
}

.brand-text .text-accent {
    color: var(--primary);
}

.brand-text p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

/* Form Section */
.form-section {
    padding: 60px;
    background: rgba(0, 0, 0, 0.2);
}

.form-header {
    margin-bottom: 40px;
}

.form-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Inputs */
.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forgot-link {
    color: var(--primary-light);
    text-decoration: none;
    font-size: 0.85rem;
    transition: opacity 0.3s;
}

.input-field {
    position: relative !important;
    width: 100% !important;
    display: block !important;
}

.input-field > i.fa-lock,
.input-field > i.fa-envelope,
.input-field > i.fa-phone-alt {
    position: absolute !important;
    top: 50% !important;
    right: 15px !important;
    transform: translateY(-50%) !important;
    color: var(--text-muted) !important;
    font-size: 1rem !important;
    transition: color 0.3s !important;
    pointer-events: none !important;
    z-index: 5 !important;
}

.input-field input {
    width: 100% !important;
    display: block !important;
    padding: 16px 50px 16px 50px !important;
    background: var(--input-bg) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 16px !important;
    color: white !important;
    font-size: 1rem !important;
    font-family: var(--font-en) !important;
    box-sizing: border-box !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.input-field input:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    background: rgba(220, 38, 38, 0.05) !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1) !important;
}

.input-field input:focus + i {
    color: var(--primary) !important;
}

button.toggle-pass {
    position: absolute !important;
    top: 50% !important;
    left: 10px !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    padding: 8px !important;
    margin: 0 !important;
    width: 35px !important;
    height: 35px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s !important;
    z-index: 5 !important;
}

button.toggle-pass:hover {
    color: rgb(214, 48, 48) !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px !important;
}

button.toggle-pass i {
    position: static !important;
    transform: none !important;
    pointer-events: none !important;
}

/* Checkbox */
.options-row {
    margin-bottom: 30px;
}

.checkbox-container {
    display: block;
    position: relative;
    padding-right: 35px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    color: var(--text-muted);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    right: 0;
    height: 22px;
    width: 22px;
    background-color: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    transition: all 0.3s;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    border: none;
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(220, 38, 38, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-icon {
    transition: transform 0.3s;
}

.submit-btn:hover .btn-icon {
    transform: translateX(-5px);
}

/* Footer Section */
.form-footer {
    margin-top: 30px;
    text-align: center;
}

.form-footer p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-footer span {
    color: white;
    font-weight: 600;
}

/* Meta Section */
.login-meta {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.meta-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}

.meta-links a:hover {
    color: white;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Improvements */
@media (max-width: 992px) {
    .login-wrapper {
        max-width: 600px;
        padding: 15px;
    }
    .login-container {
        grid-template-columns: 1fr;
        border-radius: 24px;
    }
    .brand-section {
        padding: 40px 20px;
        border-left: none;
        border-bottom: 1px solid var(--glass-border);
        flex-direction: row;
        gap: 20px;
        text-align: right;
    }
    .logo-wrapper {
        width: 80px;
        height: 80px;
        margin-bottom: 0;
        padding: 12px;
        border-radius: 20px;
    }
    .brand-text h1 {
        font-size: 1.6rem;
        margin-bottom: 5px;
    }
    .brand-text p {
        font-size: 0.9rem;
    }
    .form-section {
        padding: 40px 30px;
    }
}

@media (max-width: 600px) {
    body {
        overflow-y: hidden; /* Try to keep it contained */
        height: 100vh;
        padding: 0;
        display: flex;
        align-items: center;
    }
    .login-wrapper {
        margin: 0 auto;
        width: 95%;
        gap: 15px;
    }
    .brand-section {
        flex-direction: row; /* Keep it back to row on very small screens to save vertical space */
        text-align: right;
        padding: 15px 20px;
        gap: 15px;
    }
    .logo-wrapper {
        width: 50px;
        height: 50px;
        margin: 0;
        padding: 8px;
        border-radius: 12px;
    }
    .brand-text h1 {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }
    .brand-text p {
        font-size: 0.8rem;
        display: none; /* Hide sub-text to save space */
    }
    .form-section {
        padding: 20px;
    }
    .form-header {
        margin-bottom: 20px;
    }
    .form-header h2 {
        font-size: 1.3rem;
    }
    .form-header p {
        display: none; /* Hide "Please enter your data" to save space */
    }
    .input-group {
        margin-bottom: 15px;
    }
    .options-row {
        margin-bottom: 15px;
    }
    .submit-btn {
        padding: 12px;
        font-size: 1rem;
    }
    .login-meta {
        margin-top: 10px;
    }
    .form-footer {
        margin-top: 15px;
    }
}

@media (max-height: 700px) and (min-width: 601px) {
    body {
        overflow-y: auto;
        align-items: flex-start;
        padding: 40px 0;
    }
}
