/* Login page */

/* --- Login Page --- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(59, 130, 246, 0.08) 0%,
        transparent 50%
    ),
    radial-gradient(
        ellipse at 70% 80%,
        rgba(139, 92, 246, 0.06) 0%,
        transparent 50%
    );
    pointer-events: none;
}

.login-theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.login-theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 24px;
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.login-logo {
    width: 64px;
    height: 64px;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 auto 20px;
    border-radius: 0;
}

.login-title {
    /* The login brand is an SVG image; size it through its containing title
       so the wordmark remains crisp instead of scaling a raster asset. */
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.login-title .ideavibes-wordmark {
    display: block;
    width: auto;
    height: 1em;
    max-width: 100%;
    margin: 0 auto;
}

.login-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-btn-github {
    background: #24292e;
    color: #fff;
    border-color: #24292e;
}

.login-btn-github:hover:not(:disabled) {
    background: #2f363d;
    box-shadow: 0 4px 16px rgba(36, 41, 46, 0.3);
}

.login-btn-google {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border);
}

.login-btn-google:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.login-btn-icon {
    display: flex;
    align-items: center;
}

.login-btn-email {
    width: 100%;
}

.login-email-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin: 0;
}

.login-input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    outline: none;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.login-code-input {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 650;
    letter-spacing: 0;
}

.login-email-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 32px;
}

.login-email-note {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    text-align: center;
}

.login-email-note strong {
    color: var(--text-primary);
}

.login-email-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.login-link-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0;
    font: inherit;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
}

.login-link-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.login-email-status {
    min-height: 18px;
    color: var(--danger);
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
    text-align: center;
}

.login-btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: login-spin 0.6s linear infinite;
}

.login-btn-google .login-btn-spinner {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--text-primary);
}

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

.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-footer {
    text-align: center;
}

.login-footer p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Light theme adjustments */
[data-theme="light"] .login-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .login-page::before {
    background: radial-gradient(
        ellipse at 30% 20%,
        rgba(59, 130, 246, 0.04) 0%,
        transparent 50%
    ),
    radial-gradient(
        ellipse at 70% 80%,
        rgba(139, 92, 246, 0.03) 0%,
        transparent 50%
    );
}

@media (max-width: 480px) {
    .login-page {
        /* Avoid 100vw-style overflow when the soft keyboard or scrollbar appears. */
        overflow-x: hidden;
        overflow-y: auto;
    }

    .login-container {
        max-width: 100%;
        padding: 20px 16px;
        box-sizing: border-box;
    }

    .login-card {
        padding: 36px 24px;
        box-sizing: border-box;
    }

    .login-title {
        font-size: 2.625rem;
    }

    .login-title .ideavibes-wordmark {
        max-width: 100%;
    }

    .login-footer p {
        white-space: normal;
    }
}

/* Phone portrait (~390): tighter card so nothing forces horizontal scroll. */
@media (max-width: 400px) {
    .login-theme-toggle {
        top: 12px;
        right: 12px;
    }

    .login-container {
        padding: 16px 12px;
    }

    .login-card {
        padding: 28px 16px;
        border-radius: 14px;
    }

    .login-title {
        font-size: 2.25rem;
    }

    .login-subtitle {
        font-size: 15px;
    }

    .login-btn {
        padding: 12px 14px;
    }
}

