/* ============================
   Modern Animated Login Page
   ============================ */

/* Background */
.fi-simple-layout {
    background: url('/images/login_cover_image.webp') no-repeat center center;
    background-size: cover;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    animation: bgZoom 20s ease-in-out infinite alternate;
}

@keyframes bgZoom {
    0% { background-size: 100%; }
    100% { background-size: 110%; }
}

/* Animated gradient overlay */
.fi-simple-layout::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(102, 126, 234, 0.3) 0%,
        rgba(118, 75, 162, 0.3) 50%,
        rgba(240, 147, 43, 0.2) 100%
    );
    animation: gradientShift 8s ease-in-out infinite;
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Floating particles */
.fi-simple-layout::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    top: -100px;
    right: -100px;
    animation: floatBubble 6s ease-in-out infinite;
    z-index: 0;
}

@keyframes floatBubble {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(30px) scale(1.05); }
}

/* Container */
.fi-simple-main-ctn {
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
    padding: 2rem;
}

/* Login Card */
.fi-simple-main {
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px !important;
    padding: 2.5rem !important;
    animation: cardSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(40px);
    max-width: 440px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Card glow effect */
.fi-simple-main::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.1)
    );
    border-radius: 21px;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes cardSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Heading animation */
.fi-simple-main h1,
.fi-simple-main .fi-simple-main-heading {
    animation: fadeInDown 0.6s 0.3s ease-out forwards;
    opacity: 0;
    transform: translateY(-15px);
}

@keyframes fadeInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form inputs - Color block style */
.fi-simple-main input[type="email"],
.fi-simple-main input[type="password"],
.fi-simple-main input[type="text"],
.fi-simple-main .fi-input-wrapper {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid rgba(102, 126, 234, 0.3) !important;
    border-radius: 12px !important;
    color: #1a1a2e !important;
    font-weight: 500 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.fi-simple-main input[type="email"]:focus,
.fi-simple-main input[type="password"]:focus,
.fi-simple-main input[type="text"]:focus,
.fi-simple-main .fi-input-wrapper:focus-within {
    background: #fff !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25), 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px);
}

/* Staggered input animation */
.fi-simple-main .fi-fo-field-wrp:nth-child(1) { animation-delay: 0.4s; }
.fi-simple-main .fi-fo-field-wrp:nth-child(2) { animation-delay: 0.5s; }
.fi-simple-main .fi-fo-field-wrp:nth-child(3) { animation-delay: 0.6s; }

/* Placeholder color */
.fi-simple-main input::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}

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

/* Labels */
.fi-simple-main label,
.fi-simple-main .fi-fo-field-label {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Submit button */
.fi-simple-main button[type="submit"],
.fi-simple-main .fi-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s 0.6s ease-out forwards;
    opacity: 0;
    transform: translateY(15px);
    width: 100%;
    cursor: pointer;
}

.fi-simple-main button[type="submit"]:hover,
.fi-simple-main .fi-btn-primary:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4) !important;
    background: linear-gradient(135deg, #7c8ef5 0%, #8b5fbf 100%) !important;
}

.fi-simple-main button[type="submit"]:active,
.fi-simple-main .fi-btn-primary:active {
    transform: translateY(-1px) !important;
}

/* Button shimmer effect */
.fi-simple-main button[type="submit"]::after,
.fi-simple-main .fi-btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 40%;
    height: 200%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    transition: all 0.6s ease;
}

.fi-simple-main button[type="submit"]:hover::after,
.fi-simple-main .fi-btn-primary:hover::after {
    left: 120%;
}

/* Remember me checkbox */
.fi-simple-main .fi-checkbox-input {
    accent-color: #667eea;
}

.fi-simple-main .fi-fo-field-wrp-label span {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Logo / Brand */
.fi-simple-main .fi-simple-main-logo img,
.fi-simple-main svg.fi-simple-main-logo-icon {
    animation: logoFadeIn 0.8s 0.2s ease-out forwards;
    opacity: 0;
    transform: scale(0.8);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

@keyframes logoFadeIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Error messages */
.fi-simple-main .fi-notification,
.fi-simple-main .fi-alert {
    animation: shakeIn 0.5s ease-out;
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    backdrop-filter: blur(10px);
    border-radius: 12px !important;
    color: #fca5a5 !important;
}

@keyframes shakeIn {
    0% { transform: translateX(-10px); opacity: 0; }
    20% { transform: translateX(8px); }
    40% { transform: translateX(-6px); }
    60% { transform: translateX(4px); }
    80% { transform: translateX(-2px); }
    100% { transform: translateX(0); opacity: 1; }
}

/* Footer text */
.fi-simple-main p,
.fi-simple-main .fi-simple-main-subheading {
    color: rgba(255, 255, 255, 0.6) !important;
    font-size: 0.85rem;
}

/* Links */
.fi-simple-main a {
    color: #a5b4fc !important;
    text-decoration: none;
    transition: all 0.3s ease;
}

.fi-simple-main a:hover {
    color: #c7d2fe !important;
    text-shadow: 0 0 10px rgba(165, 180, 252, 0.3);
}

/* Responsive */
@media (max-width: 480px) {
    .fi-simple-main {
        padding: 1.5rem !important;
        margin: 1rem;
        border-radius: 16px !important;
    }

    .fi-simple-main-ctn {
        padding: 1rem;
    }
}

/* Scrollbar styling */
.fi-simple-layout::-webkit-scrollbar {
    width: 6px;
}

.fi-simple-layout::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.fi-simple-layout::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Loading state */
.fi-simple-main button[type="submit"][disabled],
.fi-simple-main .fi-btn-primary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Pulse effect on card when focused */
.fi-simple-main:focus-within {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(102, 126, 234, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

/* ============================
   Welcome Popup Animation
   ============================ */

.rith-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.rith-popup-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px;
    padding: 3rem 4rem;
    text-align: center;
    color: white;
    box-shadow: 0 25px 80px rgba(102, 126, 234, 0.5);
    animation: popupBounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.rith-popup-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: popupShimmer 2s ease-in-out infinite;
}

@keyframes popupBounceIn {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
    50% { transform: scale(1.05) rotate(2deg); }
    70% { transform: scale(0.95) rotate(-1deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes popupShimmer {
    0%, 100% { transform: translate(-30%, -30%); }
    50% { transform: translate(10%, 10%); }
}

.rith-popup-icon {
    margin-bottom: 1.5rem;
    animation: iconSpin 1s ease-out;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

@keyframes iconSpin {
    0% { transform: scale(0) rotate(-180deg); }
    60% { transform: scale(1.2) rotate(20deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.rith-popup-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: titleSlideUp 0.5s 0.2s ease-out both;
}

.rith-popup-subtitle {
    font-size: 1rem;
    opacity: 0.85;
    margin: 0 0 1.5rem;
    animation: titleSlideUp 0.5s 0.35s ease-out both;
}

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

.rith-popup-spinner {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.rith-popup-spinner::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 2px;
    animation: spinnerSlide 1.5s ease-in-out infinite;
}

@keyframes spinnerSlide {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* Transition classes for Alpine */
.rith-popup-enter { transition: all 0.3s ease-out; }
.rith-popup-enter-start { opacity: 0; }
.rith-popup-enter-end { opacity: 1; }
.rith-popup-leave { transition: all 0.3s ease-in; }
.rith-popup-leave-start { opacity: 1; }
.rith-popup-leave-end { opacity: 0; }
