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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #97D754;
    --primary-dim:   rgba(151, 215, 84, 0.15);
    --primary-glow:  rgba(151, 215, 84, 0.35);
    --glass-border:  rgba(151, 215, 84, 0.2);
    --bg:            #0d0d0d;
    --surface:       rgba(17, 17, 17, 0.75);
    --text:          #e8e8e8;
    --text-muted:    rgba(232, 232, 232, 0.45);
    --error:         #ef4444;
    --error-dim:     rgba(239, 68, 68, 0.15);
    --radius:        12px;
}

html, body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
}

/* Animated grid background */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(151,215,84,0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(151,215,84,0.05) 0%, transparent 50%);
}
.auth-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(151,215,84,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(151,215,84,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 100%);
}

/* Center layout */
.auth-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

/* Glass card */
.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow:
        0 0 0 1px rgba(151,215,84,0.05) inset,
        0 32px 80px rgba(0,0,0,0.6);
}

/* Corner bracket decorations */
.bracket {
    position: absolute;
    width: 16px;
    height: 16px;
}
.bracket.tl { top: -1px; left: -1px; border-top: 2px solid var(--primary); border-left: 2px solid var(--primary); border-radius: 3px 0 0 0; }
.bracket.tr { top: -1px; right: -1px; border-top: 2px solid var(--primary); border-right: 2px solid var(--primary); border-radius: 0 3px 0 0; }
.bracket.bl { bottom: -1px; left: -1px; border-bottom: 2px solid var(--primary); border-left: 2px solid var(--primary); border-radius: 0 0 0 3px; }
.bracket.br { bottom: -1px; right: -1px; border-bottom: 2px solid var(--primary); border-right: 2px solid var(--primary); border-radius: 0 0 3px 0; }

/* Header */
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.6rem;
}
.auth-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(151,215,84,0.2));
}
.logo-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 0.25em;
    color: var(--text);
}
.auth-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Form title */
.auth-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.5rem;
    letter-spacing: 0.02em;
}

/* Error banner */
.auth-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--error-dim);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    color: #fca5a5;
}

/* Success banner */
.auth-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(151,215,84,0.1);
    border: 1px solid rgba(151,215,84,0.3);
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Form */
.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.form-group input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    width: 100%;
}
.form-group input::placeholder { color: rgba(232,232,232,0.2); }
.form-group input:focus {
    border-color: var(--primary);
    background: rgba(151,215,84,0.04);
    box-shadow: 0 0 0 3px rgba(151,215,84,0.1);
}
.form-group input.error { border-color: var(--error); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }

/* Submit button */
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: #111;
    border: none;
    border-radius: 8px;
    padding: 0.78rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin-top: 0.4rem;
    letter-spacing: 0.02em;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(151,215,84,0.25);
}
.auth-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(151,215,84,0.35);
}
.auth-btn:active { transform: translateY(0); }

/* Footer link */
.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.8rem;
    color: var(--text-muted);
}
.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.auth-footer a:hover { opacity: 0.75; }

/* Field-level error text */
.field-error {
    font-size: 0.72rem;
    color: #fca5a5;
    margin-top: 0.15rem;
}

/* Role selector */
.role-select {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(232,232,232,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.9rem center;
}
.role-select option { background: #1a1a1a; }
.role-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(151,215,84,0.1);
}

/* Password visibility toggle */
.input-wrapper {
    position: relative;
}
.input-wrapper input {
    padding-right: 2.75rem;
    width: 100%;
}
.pw-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.2s;
    line-height: 0;
}
.pw-toggle:hover { color: var(--text); }

@media (max-width: 480px) {
    .auth-card { padding: 2rem 1.25rem; }
    .form-row { grid-template-columns: 1fr; }
}
