/* ============================================================
   Gyanam Portal — Login Page Styles v3.0
   Premium split-screen design with natural logo display
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---------- Full-screen wrapper ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    position: relative;
    overflow: hidden;
    background: #0f172a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---------- Left Panel — Brand showcase ---------- */
.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 3rem 2rem;
    overflow: hidden;
}

/* Animated gradient background */
.login-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 500px at 20% 30%, rgba(99, 102, 241, 0.25), transparent),
        radial-gradient(ellipse 500px 600px at 80% 70%, rgba(16, 185, 129, 0.15), transparent),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(59, 130, 246, 0.12), transparent),
        linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    animation: bgShift 15s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgShift {
    0%   { background-position: 0% 0%, 100% 100%, 50% 50%, 0% 0%; }
    100% { background-position: 100% 100%, 0% 0%, 50% 50%, 100% 100%; }
}

/* Floating orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
    z-index: 0;
    animation: orbFloat 20s ease-in-out infinite;
}
.orb-1 {
    width: 300px; height: 300px;
    background: linear-gradient(135deg, #6366f1, #3b82f6);
    top: -5%; left: -8%;
}
.orb-2 {
    width: 250px; height: 250px;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    bottom: -10%; right: -5%;
    animation-delay: -7s;
}
.orb-3 {
    width: 180px; height: 180px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    top: 60%; left: 60%;
    animation-delay: -14s;
    opacity: 0.25;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25%      { transform: translate(40px, -30px) scale(1.1); }
    50%      { transform: translate(-20px, 40px) scale(0.9); }
    75%      { transform: translate(30px, 20px) scale(1.05); }
}

/* Grid overlay */
.grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
}

/* Logo — displayed naturally, no card */
.brand-logo {
    position: relative;
    z-index: 1;
    margin-bottom: 2rem;
    animation: logoEnter 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
}

.brand-logo img {
    width: 180px;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 32px rgba(99, 102, 241, 0.3));
    transition: transform 0.5s ease, filter 0.5s ease;
}

.brand-logo:hover img {
    transform: scale(1.05);
    filter: drop-shadow(0 12px 40px rgba(99, 102, 241, 0.45));
}

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

/* Brand text */
.brand-text {
    position: relative;
    z-index: 1;
    text-align: center;
    animation: fadeUp 0.8s ease 0.3s both;
}

.brand-text h1 {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.brand-text p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Feature highlights */
.brand-features {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 2.5rem;
    animation: fadeUp 0.8s ease 0.5s both;
}

.brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
    font-weight: 500;
}

.brand-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-feature-icon svg {
    width: 18px;
    height: 18px;
    stroke: #818cf8;
}

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

/* ---------- Right Panel — Login form ---------- */
.login-right {
    width: 520px;
    min-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 3.5rem;
    background: #fff;
    position: relative;
    z-index: 2;
    box-shadow: -20px 0 60px rgba(0,0,0,0.15);
}

/* Decorative top accent on the form side */
.login-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #3b82f6, #10b981);
}

.form-container {
    width: 100%;
    max-width: 380px;
}

/* Welcome heading */
.form-header {
    margin-bottom: 2rem;
    animation: fadeUp 0.6s ease 0.1s both;
}

.form-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.35rem;
}

.form-header p {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* ---------- Role Selector ---------- */
.role-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.75rem;
    animation: fadeUp 0.6s ease 0.2s both;
}

.role-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
    font-family: inherit;
    text-transform: uppercase;
}

.role-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Role icons */
.role-btn .role-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.role-btn .role-icon svg {
    width: 22px;
    height: 22px;
}

/* Head Office — Indigo */
.role-btn:nth-child(1) .role-icon {
    background: #eef2ff;
    color: #6366f1;
}
.role-btn:nth-child(1).active {
    border-color: #818cf8;
    color: #4338ca;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    box-shadow: 0 8px 24px rgba(99,102,241,0.15);
    transform: translateY(-3px);
}
.role-btn:nth-child(1).active .role-icon {
    background: linear-gradient(135deg, #6366f1, #4338ca);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

/* DLC — Amber */
.role-btn:nth-child(2) .role-icon {
    background: #fffbeb;
    color: #d97706;
}
.role-btn:nth-child(2).active {
    border-color: #fbbf24;
    color: #b45309;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    box-shadow: 0 8px 24px rgba(245,158,11,0.15);
    transform: translateY(-3px);
}
.role-btn:nth-child(2).active .role-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}

/* ATC — Emerald */
.role-btn:nth-child(3) .role-icon {
    background: #ecfdf5;
    color: #059669;
}
.role-btn:nth-child(3).active {
    border-color: #34d399;
    color: #047857;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    box-shadow: 0 8px 24px rgba(16,185,129,0.15);
    transform: translateY(-3px);
}
.role-btn:nth-child(3).active .role-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

/* Training — Purple */
.role-btn:nth-child(4) .role-icon {
    background: #faf5ff;
    color: #9333ea;
}
.role-btn:nth-child(4).active {
    border-color: #c084fc;
    color: #7e22ce;
    background: linear-gradient(135deg, #faf5ff, #f3e8ff);
    box-shadow: 0 8px 24px rgba(147,51,234,0.15);
    transform: translateY(-3px);
}
.role-btn:nth-child(4).active .role-icon {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #fff;
    box-shadow: 0 4px 12px rgba(147,51,234,0.35);
}

/* Active indicator */
.role-btn.active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.6rem;
    font-weight: 900;
}
.role-btn:nth-child(1).active::after { color: #6366f1; }
.role-btn:nth-child(2).active::after { color: #f59e0b; }
.role-btn:nth-child(3).active::after { color: #10b981; }
.role-btn:nth-child(4).active::after { color: #a855f7; }

.role-btn span:last-child {
    position: relative;
    z-index: 1;
}

/* ---------- Form ---------- */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    animation: fadeUp 0.6s ease 0.35s both;
}

.form-group {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    color: #0f172a;
    background: #f8fafc;
    transition: all 0.25s ease;
    outline: none;
    box-sizing: border-box;
}

.form-group input:hover {
    border-color: #cbd5e1;
    background: #fff;
}

.form-group input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: #fff;
}

.form-group input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.form-group .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    transition: all 0.25s ease;
    pointer-events: none;
}

.form-group .input-icon svg {
    width: 18px;
    height: 18px;
}

.form-group input:focus ~ .input-icon {
    color: #6366f1;
}

.form-group .toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: all 0.2s;
    border-radius: 6px;
}

.form-group .toggle-password:hover {
    color: #6366f1;
    background: #eef2ff;
}

.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: #64748b;
    font-weight: 500;
}

.remember-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #6366f1;
    cursor: pointer;
    border-radius: 4px;
}

/* ---------- Submit Button ---------- */
.btn-login {
    width: 100%;
    padding: 0.95rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 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 cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 4px 15px rgba(99, 102, 241, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    letter-spacing: 0.02em;
    margin-top: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    background-position: right center;
}

.btn-login:active {
    transform: translateY(0);
}

/* Shimmer */
.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 */
.btn-login.loading { pointer-events: none; opacity: 0.85; }
.btn-login .btn-text { transition: opacity 0.2s; }
.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: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-left: 4px solid #ef4444;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: shakeIn 0.5s ease;
}

.alert-error svg {
    width: 18px; height: 18px;
    flex-shrink: 0; opacity: 0.8;
}

@keyframes shakeIn {
    0%, 100% { transform: translateX(0); }
    15%  { transform: translateX(-8px); }
    30%  { transform: translateX(6px); }
    45%  { transform: translateX(-4px); }
    60%  { transform: translateX(2px); }
}

/* ---------- Footer ---------- */
.login-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.78rem;
    color: #94a3b8;
    font-weight: 500;
    animation: fadeUp 0.6s ease 0.5s both;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .login-wrapper {
        flex-direction: column;
    }

    .login-left {
        padding: 2.5rem 2rem 2rem;
        min-height: auto;
    }

    .brand-logo img {
        width: 120px;
    }

    .brand-text h1 {
        font-size: 1.6rem;
    }

    .brand-features {
        display: none;
    }

    .login-right {
        width: 100%;
        min-width: unset;
        padding: 2rem 2rem 3rem;
        border-radius: 24px 24px 0 0;
        margin-top: -1rem;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    }
}

@media (max-width: 480px) {
    .login-left {
        padding: 2rem 1.5rem 1.5rem;
    }

    .brand-logo img {
        width: 100px;
    }

    .brand-text h1 {
        font-size: 1.3rem;
    }

    .brand-text p {
        font-size: 0.8rem;
    }

    .login-right {
        padding: 1.75rem 1.5rem 2.5rem;
    }

    .form-header h2 {
        font-size: 1.3rem;
    }

    .role-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .role-btn {
        padding: 0.75rem 0.35rem;
        font-size: 0.65rem;
    }

    .role-btn .role-icon {
        width: 38px;
        height: 38px;
    }

    .role-btn .role-icon svg {
        width: 18px;
        height: 18px;
    }
}