/**
 * JelyaHome — Login Desktop CSS
 */

/* === Page layout === */
.jh-auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

/* === Fond décoratif — orbes flottants === */
.jh-login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.jh-login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: jhOrbFloat 20s ease-in-out infinite;
}

.jh-login-orb--1 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    top: -15%;
    right: -10%;
    animation-delay: 0s;
}

.jh-login-orb--2 {
    width: 400px;
    height: 400px;
    background: var(--bg-primary);
    bottom: -10%;
    left: -8%;
    animation-delay: -7s;
}

.jh-login-orb--3 {
    width: 300px;
    height: 300px;
    background: var(--bg-tertiary);
    top: 40%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes jhOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.05); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(15px, 15px) scale(1.02); }
}

/* === Wrapper centré === */
.jh-login-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2xl);
    width: 100%;
    max-width: 420px;
    padding: var(--space-2xl);
    animation: jhFadeInUp 0.6s var(--ease-default) both;
}

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

/* === Brand === */
.jh-login-brand {
    text-align: center;
}

.jh-login-logo {
    font-family: var(--font-title);
    font-size: 38px;
    font-weight: var(--fw-bold);
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.jh-login-subtitle {
    margin-top: var(--space-sm);
    font-size: var(--fs-base);
    color: var(--text-secondary);
    font-weight: var(--fw-medium);
}

/* === Card === */
.jh-login-card {
    width: 100%;
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    backdrop-filter: var(--backdrop);
    padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
    transition: all var(--duration-base) var(--ease-default);
}

/* === Labels === */
.jh-login-label {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    text-align: center;
    margin-bottom: var(--space-xl);
}

.jh-login-username-highlight {
    color: var(--accent);
}

/* === Étape 1 — Choix utilisateur === */
.jh-login-users {
    display: flex;
    gap: var(--space-xl);
    justify-content: center;
}

.jh-login-user-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    border-radius: var(--radius);
    border: 2px solid transparent;
    background: var(--input-bg);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-default);
    min-width: 140px;
}

.jh-login-user-btn:hover {
    border-color: var(--accent-border);
    background: var(--accent-chip);
    transform: translateY(-2px);
    box-shadow: var(--accent-shadow);
}

.jh-login-user-btn:active {
    transform: translateY(0) scale(0.98);
}

.jh-login-user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: box-shadow var(--duration-base) var(--ease-default);
}

.jh-login-user-btn:hover .jh-login-user-avatar {
    box-shadow: var(--accent-shadow);
}

.jh-login-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jh-login-user-avatar .jh-avatar-initial {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--btn-text);
}

.jh-login-user-name {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
}

/* === Skeleton === */
.jh-login-user-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    min-width: 140px;
}

.jh-skeleton-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--toggle-bg);
    animation: jhSkeleton 1.5s ease-in-out infinite;
}

.jh-skeleton-name {
    width: 70px;
    height: 16px;
    border-radius: 8px;
    background: var(--toggle-bg);
    animation: jhSkeleton 1.5s ease-in-out infinite;
    animation-delay: 0.15s;
}

@keyframes jhSkeleton {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* === Étape 2 — Header === */
.jh-login-step2-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.jh-login-selected-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--accent-shadow);
}

.jh-login-selected-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jh-login-selected-avatar .jh-avatar-initial {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--btn-text);
}

/* === Formulaire auth === */
.jh-auth-form {
    margin-bottom: var(--space-lg);
}

/* Password */
.jh-password-wrapper {
    position: relative;
}

.jh-password-wrapper .jh-input {
    padding-right: 48px;
}

.jh-password-toggle {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    padding: var(--space-xs);
    font-size: var(--fs-lg);
    transition: color var(--duration-fast) var(--ease-default);
}

.jh-password-toggle:hover {
    color: var(--accent);
}

/* PIN */
.jh-pin-container {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.jh-pin-input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    font-family: var(--font-ui);
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: all var(--duration-base) var(--ease-default);
    -moz-appearance: textfield;
}

.jh-pin-input::-webkit-outer-spin-button,
.jh-pin-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.jh-pin-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.jh-pin-input.filled {
    border-color: var(--accent);
    background: var(--accent-chip);
}

/* Pattern */
.jh-pattern-container {
    display: flex;
    justify-content: center;
    margin: var(--space-lg) 0;
}

.jh-pattern-wrap {
    position: relative;
    width: 210px;
    height: 210px;
}

.jh-pattern-svg {
    position: absolute;
    inset: 0;
    width: 210px;
    height: 210px;
    pointer-events: none;
    z-index: 1;
}

.jh-pattern-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    width: 210px;
    height: 210px;
    user-select: none;
    z-index: 2;
}

.jh-pattern-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    cursor: pointer;
}

.jh-pattern-dot-inner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.3;
    transition: all 0.15s var(--ease-default);
}

.jh-pattern-dot.active .jh-pattern-dot-inner {
    width: 28px;
    height: 28px;
    background: var(--accent);
    opacity: 1;
    box-shadow: 0 0 12px var(--accent-glow);
}

.jh-pattern-hint {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

/* === Erreur === */
.jh-login-error {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-lg);
    color: #dc3545;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    animation: jhShake 0.4s var(--ease-default);
}

.jh-login-error i {
    font-size: var(--fs-md);
    flex-shrink: 0;
}

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

/* === Bouton submit === */
.jh-login-submit {
    width: 100%;
    padding: var(--space-lg);
    font-size: var(--fs-md);
    margin-bottom: var(--space-lg);
    position: relative;
}

.jh-login-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.jh-login-submit:not(:disabled):hover {
    filter: brightness(1.08);
}

/* === Spinner === */
.jh-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--btn-text);
    border-radius: 50%;
    animation: jhSpin 0.6s linear infinite;
}

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

/* === Bouton retour === */
.jh-login-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    transition: color var(--duration-base) var(--ease-default);
}

.jh-login-back:hover {
    color: var(--accent);
}

.jh-login-back i {
    font-size: var(--fs-base);
}

/* === Transitions entre étapes === */
.jh-login-step {
    animation: jhStepIn 0.35s var(--ease-default) both;
}

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

.jh-login-step--out {
    animation: jhStepOut 0.25s var(--ease-default) both;
}

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

.jh-login-step--back-in {
    animation: jhStepBackIn 0.35s var(--ease-default) both;
}

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


/* Remember me */
.jh-remember-me { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-lg); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.jh-remember-me input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.jh-remember-me span { font-size: var(--fs-sm); color: var(--text-secondary); font-weight: var(--fw-medium); }
