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

:root {
    --primary: #427bd2;
    --primary-hover: #3568b8;
    --bg-card: rgba(255, 255, 255, 0.92);
    --text-primary: #333;
    --text-secondary: #777;
    --border: #d8d8d8;
    --input-bg: #f5f5f5;
    --input-focus-bg: #fff;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, "Helvetica Neue", Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        linear-gradient(135deg, #1a2332 0%, #2c3e5a 25%, #1e3a5f 50%, #2a4a6b 75%, #1a2332 100%);
    background-size: cover;
}

.background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(70, 130, 180, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(100, 160, 200, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(40, 80, 120, 0.2) 0%, transparent 50%);
}

.login-container {
    position: relative;
    z-index: 1;
}

.login-card {
    width: 400px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px 36px 32px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease;
}

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

@keyframes slideLeft {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.login-card.slide-left {
    animation: slideLeft 0.3s ease;
}

.login-card.slide-right {
    animation: slideRight 0.3s ease;
}

.hidden {
    display: none !important;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.server-icon {
    margin-bottom: 12px;
}

.server-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: all 0.2s ease;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 3px rgba(66, 123, 210, 0.1);
}

.input-group input::placeholder {
    color: #aaa;
}

.options-row {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 1.5px solid #c0c0c0;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.remember-me input[type="checkbox"]:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.remember-me input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.btn-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    margin-left: auto;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-next:hover {
    background: var(--primary-hover);
}

.btn-next:active {
    transform: scale(0.95);
}

.btn-signin {
    width: 100%;
    height: 44px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn-signin:hover {
    background: var(--primary-hover);
}

.btn-signin:active {
    transform: scale(0.98);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f0f4fa;
    border-radius: 24px;
    margin-bottom: 24px;
    cursor: pointer;
    transition: background 0.15s ease;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.user-badge:hover {
    background: #e4ecf5;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.edit-icon {
    color: var(--text-secondary);
    transform: rotate(45deg);
}

.forgot-link {
    text-align: center;
    margin-top: 16px;
}

.forgot-link a {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.forgot-link a:hover {
    text-decoration: underline;
}

.footer {
    position: fixed;
    bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    z-index: 1;
}

.footer-logo {
    display: flex;
    align-items: center;
}

.footer-text {
    opacity: 0.7;
}

.footer-version {
    opacity: 0.5;
    margin-left: 4px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

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

.input-error {
    border-color: #e74c3c !important;
    animation: shake 0.4s ease;
}

.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

.error-message.visible {
    display: block;
}

/* Responsive */
@media (max-width: 480px) {
    .login-card {
        width: calc(100vw - 32px);
        padding: 32px 24px 24px;
    }
}
