:root {
    --background: #09090b;
    --foreground: #fafafa;

    --card: #09090b;
    --card-foreground: #fafafa;

    --primary: #fafafa;
    --primary-foreground: #18181b;

    --secondary: #27272a;
    --secondary-foreground: #fafafa;

    --muted: #27272a;
    --muted-foreground: #a1a1aa;

    --destructive: #7f1d1d;
    --destructive-foreground: #fafafa;

    --border: #27272a;
    --input: #27272a;
    --ring: #d4d4d8;

    --radius: 0.5rem;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--background);
    color: var(--foreground);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    /* Dot Grid Background */
    background-image: radial-gradient(#27272ab0 1px, transparent 1px);
    background-size: 24px 24px;
    position: relative;
    overflow: hidden;
    /* Lock scroll strictly */
}

/* Spotlight Effect */
body::before {
    content: "";
    position: fixed;
    /* Fixed to viewport */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle at center, rgba(247, 99, 0, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.login-wrapper {
    /* Glassmorphism */
    background-color: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);

    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 95%;
    max-width: 400px;
    color: var(--card-foreground);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease-in-out;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 8px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 10;
}

.brand-section {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.brand-section img {
    height: 48px;
    width: auto;
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.login-subtitle {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, ring 0.2s;
    height: 2.5rem;
}

input:focus {
    border-color: var(--ring);
    /* box-shadow: 0 0 0 1px var(--ring); */
}

input::placeholder {
    color: var(--muted-foreground);
}

button {
    width: 100%;
    height: 2.5rem;
    padding: 0 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    opacity: 0.9;
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.login-footer.error {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Premium Transition */
body.login-success-transition {
    overflow: hidden;
    /* Prevent scrollbars during zoom */
}

/* 1. Fade out the card */
body.login-success-transition .login-wrapper {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* 2. Zoom the background "into" the dashboard */
body.login-success-transition::before {
    /* 
       Reuse existing ::before style but animate it.
       We want it to expand or move to simulate entering the system.
    */
    transform: scale(3) rotate(5deg);
    /* Extreme zoom */
    opacity: 0;
    /* Fade out eventually to reveal dashboard? Or keep it? */
    transition: transform 1s cubic-bezier(0.7, 0, 0.3, 1), opacity 0.8s ease 0.2s;
    background-color: #09090b;
    /* Ensure it darkens towards dashboard color */
}

/* Optional: Add a flash effect */
body.login-success-transition::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #09090b;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    animation: flashToDashboard 0.8s forwards;
}

@keyframes flashToDashboard {
    0% {
        opacity: 0;
    }

    50% {
        opacity: 0.1;
    }

    /* Subtle flash */
    100% {
        opacity: 1;
    }

    /* Full black before redirect */
}

/* Language Switcher */
.lang-dropdown-wrapper {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 20;
    cursor: pointer;
    animation: fadeIn 0.5s ease-out 0.2s backwards;
}

.lang-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background-color 0.2s;
    background: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--foreground);
    cursor: pointer;
}

.lang-dropdown-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.lang-dropdown-trigger img {
    width: 22px;
    height: auto;
    border-radius: 2px;
    display: block;
}

.lang-dropdown-trigger i {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    transition: transform 0.2s;
}

.lang-dropdown-wrapper:hover .lang-dropdown-trigger i {
    transform: rotate(180deg);
}


.lang-dropdown-wrapper:hover div.lang-dropdown-content {
    display: flex;
}

div.lang-dropdown-content {
    display: none;
    padding-top: 0.5rem;
}

ul.lang-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 95px;
    background: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 0.5rem;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 9999;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    margin: 0;
}

.lang-dropdown-menu li {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s;
    color: #e4e4e7;
    width: 100%;
    font-size: 0.875rem;
}

.lang-dropdown-menu li:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.lang-dropdown-menu li img {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

@media (max-width: 640px) {
    .login-wrapper {
        background: transparent;
        box-shadow: none;
    }

    .lang-dropdown-wrapper {
        top: 1rem;
        right: 1rem;
    }
}