/* =====================================================
   Liman Panel - Login & 2FA Dark Professional Theme
   ===================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0d1117;
    color: #e6edf3;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(51, 137, 202, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(51, 137, 202, 0.05) 0%, transparent 50%),
        #0d1117;
}

.login-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(51, 137, 202, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(51, 137, 202, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* Card */
.login-card {
    width: 100%;
    max-width: 420px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow:
        0 0 0 1px rgba(51, 137, 202, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 4px 20px rgba(0, 0, 0, 0.3);
    animation: cardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Brand */
.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 16px rgba(51, 137, 202, 0.4));
}

.login-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e6edf3;
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.login-brand p {
    font-size: 0.875rem;
    color: #8b949e;
    margin: 0;
}

/* Divider */
.login-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #30363d, transparent);
    margin: 0 -2rem 1.75rem;
}

/* Form labels */
.login-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #c9d1d9;
    margin-bottom: 0.4rem;
}

/* Inputs */
.login-input {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 0.9375rem;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
}

.login-input:focus {
    border-color: #3389ca;
    box-shadow: 0 0 0 3px rgba(51, 137, 202, 0.15);
}

.login-input::placeholder {
    color: #484f58;
}

.login-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0d1117 inset;
    -webkit-text-fill-color: #e6edf3;
    caret-color: #e6edf3;
}

/* Input validation states */
.login-input:invalid:not(:placeholder-shown) {
    border-color: #f85149;
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.12);
}

.login-input:valid:not(:placeholder-shown) {
    border-color: #3fb950;
}

/* Browser native tooltip dark override */
.login-input:user-invalid {
    border-color: #f85149;
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.12);
}

/* Input group with icon */
.login-input-group {
    position: relative;
    margin-bottom: 1rem;
}

.login-input-group .login-input {
    padding-left: 2.5rem;
}

.login-input-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #484f58;
    font-size: 0.875rem;
    pointer-events: none;
    transition: color 0.2s;
}

.login-input-group:focus-within .login-input-icon {
    color: #3389ca;
}

/* Password toggle */
.login-input-toggle {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #484f58;
    font-size: 0.875rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s;
    z-index: 2;
}

.login-input-toggle:hover {
    color: #8b949e;
}

/* Remember me */
.login-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.login-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #3389ca;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 3px;
}

.login-remember label {
    font-size: 0.8125rem;
    color: #8b949e;
    cursor: pointer;
    user-select: none;
    margin: 0;
}

/* Honeypot */
.hidden-group {
    display: none !important;
    visibility: hidden;
}

/* reCAPTCHA wrapper */
.recaptcha-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
    transform-origin: left top;
}

/* Submit button */
.login-btn {
    width: 100%;
    padding: 0.6875rem 1rem;
    background: linear-gradient(135deg, #2d78b5, #3389ca);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 12px rgba(51, 137, 202, 0.3);
    letter-spacing: 0.01em;
}

.login-btn:hover {
    opacity: 0.92;
    box-shadow: 0 4px 20px rgba(51, 137, 202, 0.4);
}

.login-btn:active {
    transform: scale(0.98);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Footer text */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #484f58;
}

/* 2FA specific - code input */
.tfa-code-input {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.5em;
    padding-left: calc(0.875rem + 0.5em);
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
}

.tfa-code-input::placeholder {
    letter-spacing: 0.3em;
    font-size: 1.25rem;
}

/* 2FA hint dots */
.tfa-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1.25rem;
}

.tfa-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #30363d;
    transition: background 0.15s, transform 0.15s;
}

.tfa-dot.filled {
    background: #3389ca;
    transform: scale(1.1);
}

/* Resend button */
.tfa-resend-btn {
    background: none;
    border: none;
    color: #3389ca;
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s, opacity 0.2s;
    text-decoration: none;
}

.tfa-resend-btn:hover {
    color: #58a6ff;
    text-decoration: underline;
}

.tfa-resend-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: none;
}

/* Alert / notification area */
.login-alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.login-alert-error {
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.3);
    color: #f85149;
}

.login-alert-success {
    background: rgba(46, 160, 67, 0.1);
    border-color: rgba(46, 160, 67, 0.3);
    color: #3fb950;
}

/* Badge - security indicator */
.login-secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    color: #3fb950;
    margin-top: 0.5rem;
}

/* Mobile PWA optimizations */
@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.25rem;
        border-radius: 12px;
        border-left: none;
        border-right: none;
        border-radius: 0;
        max-width: 100%;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: none;
        border: none;
        background: #0d1117;
    }

    .login-bg {
        padding: 0;
        align-items: stretch;
        background: #0d1117;
    }

    .login-bg::before {
        display: none;
    }

    .tfa-code-input {
        font-size: 1.5rem;
    }

    .recaptcha-wrapper {
        transform: scale(0.9);
        margin-left: -5%;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .login-card {
        max-width: 380px;
    }
}

/* Landscape mobile - compact */
@media (max-height: 600px) and (orientation: landscape) {
    .login-brand img {
        width: 48px;
        height: 48px;
        margin-bottom: 0.5rem;
    }
    .login-brand {
        margin-bottom: 1rem;
    }
    .login-divider {
        margin-bottom: 1rem;
    }
}
