/* ============================================================
   Gyanam Portal — Login Page Styles v2.0
   Premium glassmorphism, animated mesh gradient, 3D depth
   ============================================================ */

/* ---------- Animated Background ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
    background: #f0f2f8;
}

/* Mesh gradient background */
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 10% 20%, rgba(67, 97, 238, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 80% at 80% 10%, rgba(46, 144, 250, 0.10), transparent 50%),
        radial-gradient(ellipse 70% 50% at 90% 80%, rgba(54, 215, 183, 0.08), transparent 50%),
        radial-gradient(ellipse 50% 70% at 20% 90%, rgba(67, 97, 238, 0.06), transparent 50%),
        linear-gradient(135deg, #f5f7fa 0%, #eaeff8 50%, #f5f7fa 100%);
    animation: meshMove 20s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes meshMove {
    0% {
        transform: scale(1) rotate(0deg);
    }

    33% {
        transform: scale(1.02) rotate(1deg);
    }

    66% {
        transform: scale(0.98) rotate(-1deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Floating geometric shapes */
.login-wrapper .shape {
    position: absolute;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    filter: blur(60px);
    opacity: 0;
    animation: shapeFloat 25s ease-in-out infinite, shapeAppear 1.5s ease forwards;
    pointer-events: none;
    z-index: 0;
}

.login-wrapper .shape-1 {
    width: 450px;
    height: 450px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.18), rgba(46, 144, 250, 0.12));
    top: -10%;
    left: -5%;
    animation-delay: 0s;
}

.login-wrapper .shape-2 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, rgba(54, 215, 183, 0.15), rgba(67, 97, 238, 0.08));
    bottom: -8%;
    right: -3%;
    animation-delay: -8s;
}

.login-wrapper .shape-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, rgba(46, 144, 250, 0.12), rgba(249, 112, 102, 0.08));
    top: 60%;
    left: 15%;
    animation-delay: -15s;
}

@keyframes shapeFloat {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    20% {
        transform: translate(50px, -30px) rotate(72deg) scale(1.05);
    }

    40% {
        transform: translate(-30px, 40px) rotate(144deg) scale(0.95);
    }

    60% {
        transform: translate(40px, 20px) rotate(216deg) scale(1.08);
    }

    80% {
        transform: translate(-20px, -40px) rotate(288deg) scale(0.98);
    }
}

@keyframes shapeAppear {
    to {
        opacity: 1;
    }
}

/* Subtle grid pattern overlay */
.login-wrapper .grid-pattern {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(67, 97, 238, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(67, 97, 238, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
    pointer-events: none;
}

/* ---------- Card ---------- */
.login-card {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-2xl);
    padding: 3rem 2.75rem;
    box-shadow:
        0 0 0 1px rgba(67, 97, 238, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.02),
        0 12px 24px rgba(0, 0, 0, 0.04),
        0 32px 64px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 1;
    animation: cardEntrance 0.8s var(--ease-spring) forwards;
    opacity: 0;
    transform: translateY(40px) scale(0.97);
}

/* Gradient border glow */
.login-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.15), rgba(46, 144, 250, 0.1), rgba(54, 215, 183, 0.12), rgba(67, 97, 238, 0.08));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---------- Branding ---------- */
.login-brand {
    text-align: center;
    margin-bottom: 2.25rem;
}

.login-brand .logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    border-radius: var(--radius-xl);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    box-shadow:
        0 8px 16px rgba(67, 97, 238, 0.25),
        0 4px 8px rgba(67, 97, 238, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: logoFloat 4s ease-in-out infinite;
    position: relative;
}

.login-brand .logo-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.15), transparent, rgba(46, 144, 250, 0.1));
    animation: logoGlow 4s ease-in-out infinite;
    pointer-events: none;
}

.login-brand .logo-icon svg {
    width: 34px;
    height: 34px;
    color: #fff;
    position: relative;
    z-index: 1;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-8px) rotate(2deg);
    }
}

@keyframes logoGlow {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.login-brand h1 {
    font-size: 1.7rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-500) 50%, var(--primary-600) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
    animation: textGradient 4s ease-in-out infinite alternate;
}

@keyframes textGradient {
    from {
        background-position: 0% center;
    }

    to {
        background-position: 100% center;
    }
}

.login-brand .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ---------- Role Selector ---------- */
.role-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s var(--ease-smooth) 0.2s both;
}

.role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 1rem 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.role-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.role-btn:nth-child(1)::before {
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.06), rgba(46, 144, 250, 0.04));
}

.role-btn:nth-child(2)::before {
    background: linear-gradient(135deg, rgba(247, 144, 9, 0.06), rgba(220, 104, 3, 0.04));
}

.role-btn:nth-child(3)::before {
    background: linear-gradient(135deg, rgba(18, 183, 106, 0.06), rgba(54, 215, 183, 0.04));
}

.role-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.role-btn:hover::before {
    opacity: 1;
}

.role-btn.active {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.role-btn.active::before {
    opacity: 1;
}

.role-btn:nth-child(1).active {
    border-color: var(--primary-400);
    color: var(--primary-700);
}

.role-btn:nth-child(2).active {
    border-color: #fbbf24;
    color: #b45309;
}

.role-btn:nth-child(3).active {
    border-color: #34d399;
    color: #047857;
}

.role-btn .role-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: all 0.3s var(--ease-spring);
}

.role-btn .role-icon svg {
    width: 22px;
    height: 22px;
}

.role-btn:nth-child(1) .role-icon {
    background: var(--primary-100);
    color: var(--primary-600);
}

.role-btn:nth-child(2) .role-icon {
    background: #fef3c7;
    color: #d97706;
}

.role-btn:nth-child(3) .role-icon {
    background: #d1fae5;
    color: #059669;
}

.role-btn.active:nth-child(1) .role-icon {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    color: #fff;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.role-btn.active:nth-child(2) .role-icon {
    background: linear-gradient(135deg, #f79009, #dc6803);
    color: #fff;
    box-shadow: 0 4px 12px rgba(247, 144, 9, 0.3);
}

.role-btn.active:nth-child(3) .role-icon {
    background: linear-gradient(135deg, #12b76a, #17b897);
    color: #fff;
    box-shadow: 0 4px 12px rgba(18, 183, 106, 0.3);
}

.role-btn span:last-child {
    position: relative;
    z-index: 1;
}

/* Active indicator dot */
.role-btn.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: dotPulse 1.5s ease-in-out infinite;
}

.role-btn:nth-child(1).active::after {
    background: var(--primary-500);
}

.role-btn:nth-child(2).active::after {
    background: #f59e0b;
}

.role-btn:nth-child(3).active::after {
    background: #10b981;
}

@keyframes dotPulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) scale(1.5);
        opacity: 0.5;
    }
}

/* ---------- Form ---------- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    animation: fadeInUp 0.6s var(--ease-smooth) 0.35s both;
}

.form-group {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 1rem 1.1rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.7);
    transition: all 0.3s var(--ease-spring);
    outline: none;
}

.form-group input:hover {
    border-color: var(--gray-300);
    background: rgba(255, 255, 255, 0.9);
}

.form-group input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), var(--shadow-sm);
    background: #fff;
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.form-group .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    transition: all 0.3s var(--ease-spring);
    pointer-events: none;
}

.form-group .input-icon svg {
    width: 19px;
    height: 19px;
}

.form-group input:focus~.input-icon {
    color: var(--primary-500);
    transform: translateY(-50%) scale(1.1);
}

.form-group .toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.form-group .toggle-password:hover {
    color: var(--primary-500);
    background: var(--primary-50);
}

.form-group .toggle-password svg {
    width: 18px;
    height: 18px;
}

/* ---------- Remember Me ---------- */
.form-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.remember-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
}

.remember-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary-600);
    cursor: pointer;
    border-radius: 4px;
}

/* ---------- Submit Button ---------- */
.btn-login {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 50%, var(--primary-500) 100%);
    background-size: 200% auto;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.35s var(--ease-spring);
    box-shadow:
        0 4px 12px rgba(67, 97, 238, 0.3),
        0 2px 4px rgba(67, 97, 238, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    letter-spacing: 0.02em;
    margin-top: 0.25rem;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow:
        0 8px 20px rgba(67, 97, 238, 0.35),
        0 4px 8px rgba(67, 97, 238, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    background-position: right center;
}

.btn-login:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Shimmer effect on hover */
.btn-login::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.btn-login:hover::after {
    left: 100%;
}

/* Ripple */
.btn-login .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0);
    animation: rippleAnim 0.7s linear;
    pointer-events: none;
}

@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Loading state */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-login .btn-text {
    transition: opacity var(--transition-fast);
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.btn-login.loading .spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ---------- Error Message ---------- */
.alert-error {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    color: var(--danger-600);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-left: 4px solid var(--danger-500);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: shakeIn 0.5s var(--ease-spring);
}

.alert-error svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

@keyframes shakeIn {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-10px);
    }

    30% {
        transform: translateX(8px);
    }

    45% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-2px);
    }
}

/* ---------- Divider ---------- */
.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* ---------- Footer ---------- */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    animation: fadeInUp 0.6s var(--ease-smooth) 0.5s both;
}

/* ---------- Particles (optional JS) ---------- */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--primary-400);
    border-radius: 50%;
    pointer-events: none;
    animation: particleFloat 8s ease-in-out infinite;
    opacity: 0.3;
    z-index: 0;
}

@keyframes particleFloat {

    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-80px) translateX(30px);
        opacity: 0.6;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
    .login-card {
        padding: 2.25rem 1.75rem;
        border-radius: var(--radius-xl);
    }

    .login-brand h1 {
        font-size: 1.4rem;
    }

    .role-selector {
        gap: 0.5rem;
    }

    .role-btn {
        padding: 0.75rem 0.35rem;
        font-size: 0.68rem;
    }

    .role-btn .role-icon {
        width: 36px;
        height: 36px;
    }

    .role-btn .role-icon svg {
        width: 18px;
        height: 18px;
    }
}