/**
 * SafeClick - Login Stylesheet
 * Location: assets/css/login.css
 */

:root {
    --bg-deep: #030712;
    --bg-surface: #060d1f;
    --bg-card: rgba(11, 20, 42, 0.85);
    --border-cyan: rgba(0, 242, 254, 0.28);
    --border-emerald: rgba(0, 255, 135, 0.28);
    --accent-cyan: #00f2fe;
    --accent-emerald: #00ff87;
    --accent-purple: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
}

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

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
    position: relative;
}

/* Ambient Cyber Grid & Glow Mesh */
.ambient-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(0, 242, 254, 0.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 255, 135, 0.035) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 1;
}

.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 1;
    opacity: 0.55;
}

.glow-1 {
    top: -120px;
    left: 25%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.22), transparent 70%);
}

.glow-2 {
    bottom: -100px;
    right: 15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(0, 255, 135, 0.18), transparent 70%);
}

#cyberCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0.45;
}

/* Top Bar */
.login-topbar {
    position: relative;
    z-index: 10;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.25s ease;
}

.back-link:hover {
    color: var(--accent-cyan);
    border-color: var(--border-cyan);
    background: rgba(0, 242, 254, 0.08);
    transform: translateX(-3px);
}

/* Language Dropdown Component */
.lang-dropdown {
    position: relative;
    display: inline-block;
    user-select: none;
    z-index: 1000;
}

.lang-dropdown-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    background: rgba(11, 20, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 9px;
    color: #f8fafc;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    outline: none;
}

.lang-dropdown-btn:hover,
.lang-dropdown.open .lang-dropdown-btn {
    background: rgba(15, 28, 60, 0.95);
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.25);
    color: #ffffff;
}

.lang-current-flag {
    font-size: 1.05rem;
    line-height: 1;
}

.lang-current-code {
    letter-spacing: 0.05em;
    color: #38bdf8;
    font-weight: 700;
}

.lang-dropdown-arrow {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.25s ease;
    margin-left: 1px;
}

.lang-dropdown.open .lang-dropdown-arrow {
    transform: rotate(180deg);
    color: #38bdf8;
}

/* Dropdown Menu Popup */
.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 155px;
    background: rgba(11, 20, 42, 0.96);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.15);
    backdrop-filter: blur(16px);
    display: none;
    flex-direction: column;
    gap: 3px;
    z-index: 10000;
    animation: langDropdownFadeIn 0.2s ease;
}

.lang-dropdown.open .lang-dropdown-menu {
    display: flex;
}

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

.lang-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-radius: 7px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.18s ease;
    cursor: pointer;
    white-space: nowrap;
}

.lang-dropdown-item:hover {
    background: rgba(56, 189, 248, 0.14);
    color: #ffffff;
}

.lang-dropdown-item.active {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    font-weight: 700;
}

.lang-item-name {
    font-family: 'Space Grotesk', sans-serif;
}

.lang-item-check {
    font-size: 0.85rem;
    color: #38bdf8;
    font-weight: 800;
    margin-left: 6px;
}

.lang-item-code {
    font-size: 0.72rem;
    font-family: 'Fira Code', monospace;
    color: #64748b;
    font-weight: 700;
}

.lang-item-check {
    font-size: 0.85rem;
    color: #38bdf8;
    font-weight: 800;
}

/* Legacy fallback */
.lang-badge {
    display: inline-flex;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.lang-badge a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 5px;
    transition: all 0.2s ease;
}

.lang-badge a.active {
    color: #030712;
    background: var(--accent-cyan);
    font-weight: 700;
}

/* Central Login Wrapper */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 520px;
    margin: 20px auto 40px;
    padding: 0 20px;
    animation: fadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-cyan);
    border-radius: 26px;
    padding: 44px 40px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 
        0 30px 70px -15px rgba(0, 0, 0, 0.9),
        0 0 45px -10px rgba(0, 242, 254, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

/* Top Cyber Accent Line */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-emerald), transparent);
    box-shadow: 0 0 14px var(--accent-cyan);
}

/* Card Header */
.card-header {
    text-align: center;
    margin-bottom: 30px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: rgba(0, 255, 135, 0.08);
    border: 1px solid rgba(0, 255, 135, 0.3);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-emerald);
    margin-bottom: 16px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    background-color: var(--accent-emerald);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-emerald);
    animation: pulse 2s infinite ease-in-out;
}

.logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.logo-img {
    height: 160px;
    max-width: 400px;
    width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 24px rgba(0, 242, 254, 0.45));
    transition: transform 0.3s ease;
}

.logo-img:hover {
    transform: scale(1.02);
}

.card-subtitle {
    font-size: 0.94rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 4px;
}

/* Error Alert */
.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.88rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Fira Code', monospace;
    animation: shake 0.4s ease-in-out;
}

/* Form Controls */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-family: 'Fira Code', monospace;
    letter-spacing: 0.02em;
}

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

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-dim);
    pointer-events: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-input {
    width: 100%;
    background: rgba(3, 7, 18, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 14px 16px 14px 48px;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.25s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(6, 13, 31, 0.9);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.25);
}

.form-input:focus + .input-icon,
.input-box:focus-within .input-icon {
    color: var(--accent-cyan);
}

.form-input::placeholder {
    color: rgba(148, 163, 184, 0.45);
}

/* Toggle Password Button */
.btn-toggle-pwd {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-toggle-pwd:hover {
    color: var(--accent-cyan);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 15px 24px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-emerald) 100%);
    color: #030712;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 25px rgba(0, 242, 254, 0.35);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(0, 242, 254, 0.5), 0 0 20px rgba(0, 255, 135, 0.35);
}

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

/* Card Footer */
.card-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Bottom Footer */
.login-bottom-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 20px;
    font-size: 0.84rem;
    color: var(--text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.85); opacity: 0.4; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@media (max-width: 580px) {
    .login-card {
        padding: 32px 22px;
        border-radius: 20px;
    }
    .logo-img {
        height: 125px;
    }
    .login-topbar {
        padding: 14px 18px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px 8px;
    }
    .login-wrapper {
        padding: 10px 0;
    }
    .login-card {
        padding: 24px 16px;
        border-radius: 16px;
    }
    .logo-img {
        height: 110px;
    }
    .brand-title {
        font-size: 1.5rem;
    }
    .brand-subtitle {
        font-size: 0.82rem;
    }
    .form-input {
        padding: 13px 14px 13px 44px;
        font-size: 0.92rem;
    }
    .btn-submit {
        padding: 13px 18px;
        font-size: 0.96rem;
    }
    .back-link {
        font-size: 0.8rem;
    }
    .lang-badge a {
        padding: 4px 8px;
        font-size: 0.72rem;
    }
}

@media (max-width: 360px) {
    .logo-img {
        height: 90px;
    }
    .login-card {
        padding: 20px 12px;
    }
    .brand-title {
        font-size: 1.35rem;
    }
}