﻿/* ===============================
   Body & Background
   =============================== */
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #f0f4f8, #A3C6FF); /* visible light gradient */
    overflow: hidden;
    position: relative; /* required for pseudo elements */
}

    /* Floating circles animation behind the card */
    body::before {
        content: "";
        position: absolute;
        width: 120%;
        height: 120%;
        top: -10%;
        left: -10%;
        background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
        animation: floatBG 30s linear infinite;
        z-index: 0; /* behind everything */
    }

@keyframes floatBG {
    0% {
        transform: rotate(0deg) translate(0,0);
    }

    50% {
        transform: rotate(180deg) translate(20px, 30px);
    }

    100% {
        transform: rotate(360deg) translate(0,0);
    }
}

/* Ensure login card stays above background */
.login-card {
    position: relative;
    z-index: 10; /* above animated background */
}



/* ===============================
   Floating Background Icons
   =============================== */
.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 0; /* behind login card */
}

    .floating-icons i {
        position: absolute;
        font-size: 40px;
        color: rgba(0,0,0,0.05);
        animation: floatIcon 15s linear infinite;
    }

        .floating-icons i:nth-child(1) {
            top: 10%;
            left: 20%;
            animation-duration: 18s;
        }

        .floating-icons i:nth-child(2) {
            top: 50%;
            left: 70%;
            animation-duration: 20s;
        }

        .floating-icons i:nth-child(3) {
            top: 70%;
            left: 30%;
            animation-duration: 16s;
        }

        .floating-icons i:nth-child(4) {
            top: 30%;
            left: 50%;
            animation-duration: 22s;
        }

@keyframes floatIcon {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-20px) rotate(15deg);
    }

    50% {
        transform: translateY(0) rotate(-15deg);
    }

    75% {
        transform: translateY(20px) rotate(15deg);
    }

    100% {
        transform: translateY(0) rotate(0deg);
    }
}


/* ===============================
   Login Card
   =============================== */
.login-card {
    position: relative;
    z-index: 10;
    width: 400px;
    padding: 3rem 2rem;
    border-radius: 25px;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeSlideIn 1s ease forwards;
    transition: transform 0.3s, box-shadow 0.3s;
}

    .login-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 25px 60px rgba(0,0,0,0.35);
    }

/* Card entrance animation */
@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }

    60% {
        opacity: 1;
        transform: translateY(-10px);
    }

    80% {
        transform: translateY(5px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Title */
.login-card h3 {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 700;
    color: #222;
    font-size: 2rem;
}

/* ===============================
   Logout / Error message
   =============================== */
.logout-msg {
    text-align: center;
    font-weight: 600;
    color: #dc3545;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    animation: shakeMsg 0.5s ease;
}

@keyframes shakeMsg {
    0%,100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }
}

/* ===============================
   Inputs & Icons
   =============================== */
.input-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 2.2rem; /* enough space for error message */
}

    .input-wrapper .form-control {
        width: 100%;
        padding: 12px 40px;
        border-radius: 12px;
        border: 1px solid #ccc;
        font-size: 15px;
        background: #fff;
        color: #333;
        box-sizing: border-box;
    }

    /* Icon inside input line */
    .input-wrapper .input-icon {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: #555;
        font-size: 16px;
        pointer-events: none;
        z-index: 10;
    }

    .input-wrapper .toggle-password {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        cursor: pointer;
        z-index: 5;
    }


    /* Error message absolutely positioned below input */
    .input-wrapper .error-msg {
        position: absolute;
        bottom: -18px; /* adjust based on font-size/margin */
        left: 0;
        font-size: 0.875rem;
        color: #dc3545;
        font-weight: 500;
        display: none;
    }

.form-control {
    width: 100%;
    padding: 12px 40px; /* leave space for icon and toggle */
    padding-left: 40px;
    border-radius: 12px;
    border: 1px solid #ccc;
    font-size: 15px;
    background: #fff;
    color: #333;
    transition: all 0.3s ease-in-out;
    position: relative;
    z-index: 1; /* behind icon */
}

    .form-control:focus {
        outline: none;
        border-color: #0d6efd;
        box-shadow: 0 0 10px rgba(13,110,253,0.25);
    }

/* ===============================
   Login Button
   =============================== */
.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 15px;
    border: none;
    background-color: #0d6efd;
    color: #fff;
    cursor: pointer;
    margin-top: 10px;
    animation: fadeSlideUp 1s ease 0.5s forwards;
    opacity: 1; /* make it visible immediately */
    transition: all 0.3s ease;
}

    .btn-login:hover {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 10px 25px rgba(13,110,253,0.4);
        background-color: #0b5ed7;
    }
/* ===============================
   Loader Overlay
   =============================== */
.loader-overlay {
    display: none; /* hide initially */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loader {
    border: 6px solid rgba(0,0,0,0.1);
    border-top: 6px solid #0d6efd;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin-top: 1rem;
    font-weight: 500;
    color: #333;
}

/* ===============================
   Animations
   =============================== */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeSlideIn {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }

    60% {
        opacity: 1;
        transform: translateY(-10px);
    }

    80% {
        transform: translateY(5px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logout / Error message */
.logout-msg {
    text-align: center;
    font-weight: 600;
    color: #dc3545;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    animation: shakeMsg 0.5s ease;
}

@keyframes shakeMsg {
    0%,100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }
}

@keyframes floatBG {
    0% {
        transform: translate(0,0) rotate(0deg);
    }

    50% {
        transform: translate(30px, 20px) rotate(180deg);
    }

    100% {
        transform: translate(0,0) rotate(360deg);
    }
}

.input-error {
    border-color: #dc3545 !important; /* red border for error */
    box-shadow: 0 0 5px rgba(220,53,69,0.5);
    transition: all 0.3s ease;
}

.error-msg {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 4px;
    font-weight: 500;
    display: none; /* show only on error */
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}
