/**
 * Login Component Styles
 * Glassy, centered login screen
 */

/**
 * Single flat content column — no nested card chrome.
 */
.mtune-auth-panel {
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding: var(--mtune-space-xl) var(--mtune-space-lg);
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    animation: mtuneAuthPanelIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.mtune-auth-panel--narrow {
    max-width: 440px;
}

.mtune-auth-panel--wide {
    max-width: 480px;
    width: 100%;
}

.mtune-auth-panel--welcome {
    max-width: 520px;
    width: 100%;
    text-align: center;
}

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

/* Logo */
.mtune-login-logo {
    text-align: center;
    margin-bottom: var(--mtune-space-xl);
}

@media (prefers-reduced-motion: no-preference) {
    .mtune-login-logo {
        animation: logoFloat 6s ease-in-out infinite;
    }
}

.mtune-login-logo img {
    max-width: 250px;
    height: auto;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Form Container */
.mtune-login-form-container {
    animation: formFadeIn 0.6s ease-out 0.2s both;
}

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

/* Title */
.mtune-login-title {
    font-family: var(--mtune-font-display);
    font-size: var(--mtune-text-2xl);
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--mtune-space-xs);
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.72) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mtune-login-subtitle {
    text-align: center;
    color: var(--mtune-text-tertiary);
    font-size: var(--mtune-text-sm);
    margin-bottom: var(--mtune-space-xl);
}

/* Login Form */
.mtune-login-form {
    display: flex;
    flex-direction: column;
}

.mtune-login-form .mtune-form-group {
    animation: inputSlideIn 0.4s ease-out both;
}

.mtune-login-form .mtune-form-group:nth-child(1) { animation-delay: 0.3s; }
.mtune-login-form .mtune-form-group:nth-child(2) { animation-delay: 0.4s; }

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

.mtune-login-form input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--mtune-text-primary);
    height: 52px;
}

.mtune-login-form input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--mtune-primary);
}

.mtune-login-form input::placeholder {
    color: var(--mtune-text-muted);
}

/* Password Toggle */
.mtune-password-toggle {
    position: absolute;
    right: var(--mtune-space-md);
    background: none;
    border: none;
    color: var(--mtune-text-tertiary);
    cursor: pointer;
    padding: var(--mtune-space-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--mtune-transition-fast);
}

.mtune-password-toggle:hover {
    color: var(--mtune-text-primary);
}

.mtune-password-toggle svg {
    width: 20px;
    height: 20px;
}

/* Form Row */
.mtune-form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--mtune-space-xl);
    animation: inputSlideIn 0.4s ease-out 0.5s both;
}

.mtune-forgot-link {
    font-size: var(--mtune-text-sm);
    color: var(--mtune-accent);
    transition: color var(--mtune-transition-fast);
}

.mtune-forgot-link:hover {
    color: var(--mtune-accent-light);
}

/* Login Button */
.mtune-btn-login {
    width: 100%;
    height: 52px;
    font-size: var(--mtune-text-base);
    font-weight: 600;
    animation: inputSlideIn 0.4s ease-out 0.6s both;
    position: relative;
    overflow: hidden;
}

.mtune-btn-login::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.mtune-btn-login:hover::after {
    opacity: 1;
    animation: btnShine 0.6s ease forwards;
}

@keyframes btnShine {
    from {
        transform: translateX(-100%) rotate(45deg);
    }
    to {
        transform: translateX(100%) rotate(45deg);
    }
}

/* Login Button Success State */
.mtune-btn-login .btn-success {
    display: none;
    position: absolute;
    width: 28px;
    height: 28px;
}

.mtune-btn-login.success .btn-text {
    visibility: hidden;
}

.mtune-btn-login.success .btn-loader {
    display: none;
}

.mtune-btn-login.success .btn-success {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtune-btn-login .btn-success .success-spinner {
    position: absolute;
    width: 28px;
    height: 28px;
    animation: spin 1s linear infinite;
    color: white;
}

.mtune-btn-login .btn-success .success-check {
    position: absolute;
    width: 16px;
    height: 16px;
    color: white;
    animation: checkPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes checkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.mtune-btn-login.success {
    background: linear-gradient(135deg, var(--mtune-success), #00a843);
    box-shadow: var(--mtune-shadow-md), 0 0 40px rgba(0, 200, 83, 0.3);
    pointer-events: none;
}

/* Login Message */
#mtune-login-message {
    text-align: center;
}

/* When message is shown (error/success), animate immediately */
#mtune-login-message.show {
    animation: messageSlide 0.2s ease-out forwards;
}

/* Login Footer */
.mtune-login-footer {
    text-align: center;
    margin-top: var(--mtune-space-xl);
    padding-top: var(--mtune-space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: var(--mtune-text-sm);
    color: var(--mtune-text-tertiary);
}

.mtune-login-footer a {
    color: var(--mtune-accent);
    font-weight: 500;
}

.mtune-login-footer a:hover {
    text-decoration: underline;
}

/* Responsive — phones: comfortable padding; scroll is on #mtune-app only */
@media (max-width: 639px) {
    .mtune-auth-panel {
        max-width: none;
        width: 100%;
        padding:
            max(env(safe-area-inset-top), var(--mtune-space-lg))
            max(env(safe-area-inset-right), var(--mtune-space-md))
            max(env(safe-area-inset-bottom), var(--mtune-space-xl))
            max(env(safe-area-inset-left), var(--mtune-space-md));
    }

    .mtune-auth-panel--wide {
        justify-content: flex-start;
    }

    .mtune-login-logo img {
        max-width: 160px;
    }

    .mtune-login-title {
        font-size: var(--mtune-text-xl);
    }

    .mtune-form-row {
        flex-direction: column;
        gap: var(--mtune-space-md);
        align-items: flex-start;
    }
}

/* Autofill Styling Override */
.mtune-login-form input:-webkit-autofill,
.mtune-login-form input:-webkit-autofill:hover,
.mtune-login-form input:-webkit-autofill:focus,
.mtune-login-form input:-webkit-autofill:active,
.mtune-login-form textarea:-webkit-autofill,
.mtune-login-form select:-webkit-autofill {
    -webkit-text-fill-color: #ffffff !important;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.3) inset !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.mtune-login-form input:-webkit-autofill:focus {
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.4) inset !important;
    border: 1px solid var(--mtune-primary) !important;
}

