:root {
    --bg-primary: #090d16;
    --bg-card: rgba(15, 23, 42, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(56, 189, 248, 0.4);
    --accent-blue: #0284c7;
    --accent-cyan: #38bdf8;
    --accent-indigo: #6366f1;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --success: #10b981;
    --card-radius: 24px;
    --btn-radius: 14px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Background effects */
.bg-mesh {
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(14, 165, 233, 0.05) 0px, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    animation: floatOrb 10s infinite alternate ease-in-out;
}

.orb-1 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #0284c7, transparent 70%);
    top: 10%;
    left: 15%;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #4f46e5, transparent 70%);
    bottom: 10%;
    right: 15%;
    animation-delay: -5s;
}

@keyframes floatOrb {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-40px) scale(1.1); }
}

/* Main Container */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 1.5rem;
}

/* Card */
.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 2.25rem 2rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-card.shake {
    animation: shakeCard 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shakeCard {
    10%, 90% { transform: translate3d(-3px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* Brand Header */
.brand-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-container {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-ring {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
    opacity: 0.3;
    filter: blur(8px);
    animation: pulseRing 3s infinite ease-in-out;
}

.logo-core {
    position: relative;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

@keyframes pulseRing {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.brand-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: #38bdf8;
    border-radius: 50%;
    box-shadow: 0 0 8px #38bdf8;
    animation: blinkDot 2s infinite;
}

@keyframes blinkDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Tabs */
.auth-tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: rgba(56, 189, 248, 0.12);
    color: var(--accent-cyan);
    font-weight: 600;
    border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.pin-instructions {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
}

/* MPIN Input Boxes */
.pin-display-group {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.pin-box {
    width: 48px;
    height: 56px;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    color: var(--accent-cyan);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: all var(--transition-bounce);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    font-family: 'JetBrains Mono', monospace;
}

.pin-box:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0,0,0,0.4);
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.8);
}

.pin-box.filled {
    border-color: rgba(56, 189, 248, 0.5);
}

.pin-box.error {
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

/* Error Banner */
.error-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    color: #fca5a5;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    animation: fadeIn 0.2s ease;
}

/* Keypad Grid */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.key-btn {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
}

.key-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

.key-btn:active {
    transform: scale(0.95);
    background: rgba(56, 189, 248, 0.25);
}

.key-btn.action-key {
    background: rgba(15, 23, 42, 0.4);
    color: var(--text-muted);
}

.key-btn.action-key:hover {
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrap svg {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon-wrap input {
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1rem 0.85rem 2.85rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.input-icon-wrap input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

/* Unlock Button */
.unlock-btn {
    width: 100%;
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: var(--btn-radius);
    padding: 0.95rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px -5px rgba(2, 132, 199, 0.4);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.unlock-btn:hover {
    background: linear-gradient(135deg, #0369a1, #1d4ed8);
    box-shadow: 0 12px 25px -4px rgba(2, 132, 199, 0.6);
    transform: translateY(-1px);
}

.unlock-btn:active {
    transform: translateY(1px);
}

.unlock-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s infinite linear;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer */
.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.security-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: #64748b;
}

.security-tag svg {
    color: var(--success);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.75rem 1.25rem;
    }
    .pin-box {
        width: 42px;
        height: 50px;
        font-size: 1.3rem;
    }
}
