/* ═══════════════════════════════════════════════════
   PREMIUM ANIMATIONS LAYER — mainindex-animations.css
   Add AFTER mainindex.css:
   <link href="css/mainindex-animations.css" rel="stylesheet">
   No HTML changes required.
═══════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────
   1. AMBIENT BACKGROUND — slow breathing aurora
   ───────────────────────────────────────────────── */

/* Two pseudo-element orbs that swim behind everything */
.erp-page::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 55% 40% at 20% 30%,
            rgba(3, 87, 77, 0.22) 0%,
            transparent 70%),
        radial-gradient(ellipse 45% 35% at 80% 70%,
            rgba(232, 101, 10, 0.10) 0%,
            transparent 65%);
    animation: auroraDrift 18s ease-in-out infinite alternate;
}

@keyframes auroraDrift {
    0%   { transform: scale(1)    translate(0px,   0px); opacity: 0.85; }
    33%  { transform: scale(1.08) translate(18px, -12px); opacity: 1;    }
    66%  { transform: scale(0.95) translate(-10px, 20px); opacity: 0.75; }
    100% { transform: scale(1.05) translate(8px,  -6px);  opacity: 0.95; }
}

/* Particles layer — pure CSS, no JS */
.erp-page::before {
    /* keep the original darkening overlay but also add tiny twinkling dots */
    background:
        linear-gradient(160deg,
            rgba(1, 42, 38, 0.32) 0%,
            rgba(2, 55, 48, 0.14) 50%,
            rgba(1, 38, 34, 0.28) 100%),
        radial-gradient(circle 1px at 15% 22%, rgba(255,255,255,0.55) 0%, transparent 2px),
        radial-gradient(circle 1px at 42% 8%,  rgba(255,255,255,0.40) 0%, transparent 2px),
        radial-gradient(circle 1px at 68% 17%, rgba(255,255,255,0.50) 0%, transparent 2px),
        radial-gradient(circle 1px at 85% 5%,  rgba(255,255,255,0.35) 0%, transparent 2px),
        radial-gradient(circle 1px at 30% 88%, rgba(255,255,255,0.30) 0%, transparent 2px),
        radial-gradient(circle 1px at 72% 80%, rgba(255,255,255,0.45) 0%, transparent 2px),
        radial-gradient(circle 1px at 55% 50%, rgba(255,255,255,0.25) 0%, transparent 2px),
        radial-gradient(circle 1.5px at 8%  60%, rgba(232,101,10,0.45) 0%, transparent 3px),
        radial-gradient(circle 1.5px at 92% 38%, rgba(232,101,10,0.35) 0%, transparent 3px);
    animation: starTwinkle 6s ease-in-out infinite alternate;
}

@keyframes starTwinkle {
    0%   { opacity: 0.80; }
    30%  { opacity: 1.00; }
    60%  { opacity: 0.65; }
    100% { opacity: 0.90; }
}

/* ─────────────────────────────────────────────────
   2. LOGIN CARD — richer entrance + float
   ───────────────────────────────────────────────── */

.login-card {
    animation:
        cardIn    0.65s cubic-bezier(0.22, 1, 0.36, 1) both,
        cardFloat 7s   ease-in-out 0.65s infinite;
}

/* Override the original @keyframes cardIn with a more theatrical version */
@keyframes cardIn {
    0%   { opacity: 0; transform: translateY(40px) scale(0.94) rotateX(6deg); filter: blur(4px); }
    60%  { opacity: 1; filter: blur(0); }
    100% { opacity: 1; transform: translateY(0)  scale(1)    rotateX(0deg); filter: blur(0); }
}

@keyframes cardFloat {
    0%,100% { transform: translateY(0px);  box-shadow: 0 28px 60px rgba(1,42,38,0.55), 0 6px 20px rgba(1,42,38,0.35); }
    50%      { transform: translateY(-6px); box-shadow: 0 38px 75px rgba(1,42,38,0.65), 0 10px 28px rgba(1,42,38,0.45); }
}

/* Gloss sheen sweeps across the card on page load */
.login-card::after {
    content: '';
    position: absolute;
    top: -50%; left: -80%;
    width: 60%; height: 200%;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,0.13) 50%,
        transparent 70%
    );
    transform: skewX(-15deg);
    pointer-events: none;
    z-index: 2;
    animation: glossSweep 5s ease-in-out 0.8s infinite;
}

@keyframes glossSweep {
    0%   { left: -80%; opacity: 0; }
    10%  { opacity: 1; }
    40%  { left: 120%; opacity: 1; }
    41%  { opacity: 0; }
    100% { left: 120%; opacity: 0; }
}

/* ─────────────────────────────────────────────────
   3. ORANGE UNDERLINE — pulse glow
   ───────────────────────────────────────────────── */

.card-underline {
    animation: underlinePulse 3s ease-in-out infinite;
}

@keyframes underlinePulse {
    0%,100% { box-shadow: 0 0 8px rgba(232,101,10,0.55); width: 60px; }
    50%      { box-shadow: 0 0 20px rgba(232,101,10,0.90), 0 0 40px rgba(232,101,10,0.35); width: 80px; }
}

/* ─────────────────────────────────────────────────
   4. ROLE TABS — staggered slide-in
   ───────────────────────────────────────────────── */

.role-tabs { perspective: 800px; }

.role-tab {
    animation: tabSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
    transform-origin: bottom center;
}

.role-tab:nth-child(1) { animation-delay: 0.45s; }
.role-tab:nth-child(2) { animation-delay: 0.55s; }
.role-tab:nth-child(3) { animation-delay: 0.65s; }
.role-tab:nth-child(4) { animation-delay: 0.75s; }

@keyframes tabSlideIn {
    from { opacity: 0; transform: translateY(14px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

/* Active tab — beating glow ring */
.role-tab.active {
    animation:
        tabSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both,
        tabActiveGlow 2.5s ease-in-out 0.6s infinite;
}

@keyframes tabActiveGlow {
    0%,100% { box-shadow: 0 4px 20px rgba(3,87,77,0.55), 0 1px 0 rgba(255,255,255,0.40) inset; }
    50%      { box-shadow: 0 4px 30px rgba(3,87,77,0.85), 0 0 18px rgba(3,87,77,0.40), 0 1px 0 rgba(255,255,255,0.40) inset; }
}

/* Active tab icon — gentle pulse */
.role-tab.active .r-ico {
    animation: iconPulse 2.5s ease-in-out infinite;
}

@keyframes iconPulse {
    0%,100% { transform: scale(1); }
    50%      { transform: scale(1.10); }
}

/* Inactive tab hover ripple */
.role-tab:not(.active):hover::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at center, rgba(255,255,255,0.15) 0%, transparent 70%);
    animation: rippleFade 0.55s ease-out both;
    pointer-events: none;
}

@keyframes rippleFade {
    from { opacity: 1; transform: scale(0.7); }
    to   { opacity: 0; transform: scale(1.4); }
}

/* ─────────────────────────────────────────────────
   5. FORM PANELS — slide + fade
   ───────────────────────────────────────────────── */

@keyframes panIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ─────────────────────────────────────────────────
   6. FORM FIELDS — stagger reveal
   ───────────────────────────────────────────────── */

.form-panel.active .fg,
.form-panel.active .cap-row,
.form-panel.active .btn-sub,
.form-panel.active .fl,
.form-panel.active .register-link,
.form-panel.active .sec-lbl {
    animation: fieldReveal 0.40s cubic-bezier(0.22,1,0.36,1) both;
}

.form-panel.active .fg:nth-child(1)     { animation-delay: 0.05s; }
.form-panel.active .fg:nth-child(2)     { animation-delay: 0.10s; }
.form-panel.active .fg:nth-child(3)     { animation-delay: 0.15s; }
.form-panel.active .fg:nth-child(4)     { animation-delay: 0.20s; }
.form-panel.active .fg:nth-child(5)     { animation-delay: 0.25s; }
.form-panel.active .cap-row             { animation-delay: 0.28s; }
.form-panel.active .btn-sub             { animation-delay: 0.33s; }
.form-panel.active .fl                  { animation-delay: 0.38s; }
.form-panel.active .register-link       { animation-delay: 0.42s; }

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

/* ─────────────────────────────────────────────────
   7. INPUTS — glow ring on focus
   ───────────────────────────────────────────────── */

.fw input:focus,
.fw select:focus {
    animation: inputFocusGlow 0.25s ease-out both;
}

@keyframes inputFocusGlow {
    from { box-shadow: 0 0 0 0 rgba(3,87,77,0); }
    to   { box-shadow: 0 0 0 3px rgba(3,87,77,0.28), 0 1px 0 rgba(255,255,255,0.90) inset; }
}

/* ─────────────────────────────────────────────────
   8. SUBMIT BUTTON — shimmer + press
   ───────────────────────────────────────────────── */

.btn-sub {
    position: relative;
    overflow: hidden;
}

/* Shimmer streak across the button on loop */
.btn-sub::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.18) 50%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: btnShimmer 3.5s ease-in-out 1.2s infinite;
    pointer-events: none;
}

@keyframes btnShimmer {
    0%   { left: -100%; opacity: 0; }
    5%   { opacity: 1; }
    40%  { left: 140%; opacity: 1; }
    41%  { opacity: 0; }
    100% { left: 140%; opacity: 0; }
}

/* Idle glow pulse when not hovered */
.btn-sub:not(:hover):not(:active) {
    animation: btnIdlePulse 3.5s ease-in-out infinite;
}

@keyframes btnIdlePulse {
    0%,100% { box-shadow: 0 1px 0 rgba(255,255,255,0.30) inset, 0 6px 20px rgba(3,87,77,0.50); }
    50%      { box-shadow: 0 1px 0 rgba(255,255,255,0.30) inset, 0 8px 28px rgba(3,87,77,0.75), 0 0 18px rgba(3,87,77,0.30); }
}

/* Click press ripple */
.btn-sub:active::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    animation: pressFlash 0.30s ease-out both;
    pointer-events: none;
}

@keyframes pressFlash {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* Arrow icon — bounce on hover */
.btn-sub:hover svg {
    animation: arrowBounce 0.6s ease-in-out infinite alternate;
}

@keyframes arrowBounce {
    from { transform: translateX(0); }
    to   { transform: translateX(5px); }
}

/* ─────────────────────────────────────────────────
   9. CAPTCHA BOX — subtle rotation hint + glow
   ───────────────────────────────────────────────── */

.cap-box {
    animation: capBoxPulse 4s ease-in-out infinite;
}

@keyframes capBoxPulse {
    0%,100% { box-shadow: 0 3px 12px rgba(3,87,77,0.45), 0 1px 0 rgba(255,255,255,0.30) inset; }
    50%      { box-shadow: 0 5px 22px rgba(3,87,77,0.70), 0 0 14px rgba(3,87,77,0.30), 0 1px 0 rgba(255,255,255,0.30) inset; }
}

.cap-box:hover {
    animation: capBoxSpin 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes capBoxSpin {
    0%   { transform: scale(1)    rotate(0deg); }
    40%  { transform: scale(1.04) rotate(-4deg); }
    70%  { transform: scale(1.04) rotate(3deg); }
    100% { transform: scale(1.02) rotate(0deg); }
}

/* ─────────────────────────────────────────────────
   10. TAB CHECK BADGE — pop in
   ───────────────────────────────────────────────── */

.tab-check {
    animation: badgePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes badgePop {
    from { transform: scale(0) rotate(-45deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

/* ─────────────────────────────────────────────────
   11. ALERTS — richer entrance
   ───────────────────────────────────────────────── */

@keyframes fadeDn {
    from { opacity: 0; transform: translateY(-10px) scaleY(0.90); }
    to   { opacity: 1; transform: translateY(0)     scaleY(1); }
}

/* Error alert — red left border pulse */
.erp-alert-danger {
    border-left: 3px solid #ef4444;
    animation: fadeDn 0.3s ease both, dangerPulse 1.8s ease-in-out 0.4s 3;
}

@keyframes dangerPulse {
    0%,100% { border-left-color: #ef4444; box-shadow: none; }
    50%      { border-left-color: #f87171; box-shadow: -2px 0 12px rgba(239,68,68,0.35); }
}

/* ─────────────────────────────────────────────────
   12. SECTION LABEL LINES — extend animation
   ───────────────────────────────────────────────── */

.sec-lbl .sec-line {
    transform-origin: left center;
    animation: lineExpand 0.6s cubic-bezier(0.22,1,0.36,1) both;
}
.sec-lbl .sec-line:last-child {
    transform-origin: right center;
}

@keyframes lineExpand {
    from { transform: scaleX(0); opacity: 0; }
    to   { transform: scaleX(1); opacity: 1; }
}

.sec-lbl .sec-txt {
    animation: textFadeUp 0.45s ease both 0.15s;
}

@keyframes textFadeUp {
    from { opacity: 0; transform: translateY(6px); letter-spacing: 4px; }
    to   { opacity: 1; transform: translateY(0);   letter-spacing: 2px; }
}

/* ─────────────────────────────────────────────────
   13. FOOTER DOT — heartbeat
   ───────────────────────────────────────────────── */

.ft-dot {
    animation: heartbeat 1.8s ease-in-out infinite;
}

@keyframes heartbeat {
    0%,100% { transform: scale(1);    box-shadow: 0 0 6px rgba(232,101,10,0.55); }
    14%     { transform: scale(1.35); box-shadow: 0 0 14px rgba(232,101,10,0.90); }
    28%     { transform: scale(1);    box-shadow: 0 0 6px rgba(232,101,10,0.55); }
    42%     { transform: scale(1.20); box-shadow: 0 0 10px rgba(232,101,10,0.75); }
    56%     { transform: scale(1);    box-shadow: 0 0 6px rgba(232,101,10,0.55); }
}

/* ─────────────────────────────────────────────────
   14. CARD HEADER — word-by-word reveal
   ───────────────────────────────────────────────── */

.card-welcome {
    animation: fadeSlideUp 0.5s ease both 0.20s;
}
.card-hd h3 {
    animation: fadeSlideUp 0.55s cubic-bezier(0.22,1,0.36,1) both 0.28s;
}
.card-underline {
    animation: underlineGrow 0.45s cubic-bezier(0.22,1,0.36,1) both 0.42s,
               underlinePulse 3s ease-in-out 1s infinite;
}

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

@keyframes underlineGrow {
    from { width: 0; opacity: 0; }
    to   { width: 60px; opacity: 1; }
}

/* ─────────────────────────────────────────────────
   15. LINK HOVER — underline sweep
   ───────────────────────────────────────────────── */

.fl a,
.register-link a {
    position: relative;
}

.fl a:not(.fl-back)::after,
.register-link a::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 0;
    width: 0; height: 1.5px;
    background: #ffb380;
    border-radius: 1px;
    transition: width 0.25s cubic-bezier(0.22,1,0.36,1);
}

.fl a:not(.fl-back):hover::after,
.register-link a:hover::after {
    width: 100%;
}

/* ─────────────────────────────────────────────────
   16. CARD BORDER — slow color rotation
   ───────────────────────────────────────────────── */

.login-card {
    border-color: rgba(255,255,255,0.40);
    animation:
        cardIn    0.65s cubic-bezier(0.22,1,0.36,1) both,
        cardFloat 7s   ease-in-out 0.65s infinite,
        borderGlow 8s  ease-in-out 1.5s infinite alternate;
}

@keyframes borderGlow {
    0%   { border-color: rgba(255,255,255,0.40); }
    50%  { border-color: rgba(3,87,77,0.65); }
    100% { border-color: rgba(232,101,10,0.45); }
}

/* ─────────────────────────────────────────────────
   17. REDUCE MOTION — full kill switch
   ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
