/* ============================================
   AgendaFarma — Auth Pages v2
   Premium Glassmorphism Design
   ============================================ */

/* --- Body & Background --- */
body.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    position: relative;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(-45deg, #0f172a, #1e293b, #2563eb, #0891b2, #0f172a);
    background-size: 400% 400%;
    animation: authGradientShift 20s ease infinite;
}

@keyframes authGradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Particles --- */
.auth-particles {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.auth-particle {
    position: absolute;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    animation: authFloat linear infinite;
}

@keyframes authFloat {
    0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) rotate(720deg); opacity: 0; }
}

/* --- Container & Card --- */
.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
    animation: authFadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes authFadeInUp {
    from { opacity: 0; transform: translateY(40px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 36px 72px rgba(0, 0, 0, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* --- Logo / Icon --- */
.auth-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: authPulse 3s ease-in-out infinite;
}

@keyframes authPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15); }
    50%      { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0); }
}

/* --- Typography --- */
.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9375rem;
    margin-bottom: 2.25rem;
    font-weight: 400;
    line-height: 1.5;
}

/* --- Form --- */
.auth-form .form-group {
    margin-bottom: 1.25rem;
    text-align: left;
    position: relative;
}

.auth-form .form-label {
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    z-index: 2;
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.1rem;
    pointer-events: none;
}

.auth-form .form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    font-size: 0.9375rem;
    font-family: inherit;
    color: #ffffff;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.auth-form .form-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.auth-form .form-input:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
    outline: none;
}

/* Input with icon padding */
.auth-form .auth-input-wrapper .form-input {
    padding-left: 2.8rem;
}

/* --- Password Toggle --- */
.auth-password-toggle {
    position: relative;
}

.auth-toggle-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.15rem;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.auth-toggle-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.06);
}

/* --- Submit Button --- */
.auth-btn {
    width: 100%;
    padding: 0.95rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.35);
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
    letter-spacing: -0.01em;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.45);
}

.auth-btn:active {
    transform: translateY(0);
}.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-btn-link {
  text-decoration: none;
}

/* Button loading state */
.auth-btn .btn-text {
    position: relative;
    z-index: 1;
}

.auth-btn .btn-loader {
    display: none;
    position: relative;
    z-index: 1;
    width: 22px;
    height: 22px;
    margin: 0 auto;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

.auth-btn.loading .btn-text { display: none; }
.auth-btn.loading .btn-loader { display: block; }

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

/* --- Messages --- */
.auth-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: none;
    font-size: 0.875rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-error.visible {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #86efac;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* --- Footer --- */
.auth-footer {
    margin-top: 1.75rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.45);
}

.auth-footer a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* --- TOTP Digits (2FA) --- */
.auth-totp-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-totp-digit {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    outline: none;
    caret-color: transparent;
    transition: all 0.2s;
}

.auth-totp-digit:focus {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.auth-totp-digit.filled {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.06);
}

.auth-help-text {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    body.auth-page {
        overflow-y: auto;
    }

    .auth-container {
        padding: 0.75rem;
        max-width: 100%;
    }

    .auth-card {
        padding: 1.5rem 1.25rem;
        border-radius: 16px;
    }

    .auth-title {
        font-size: 1.35rem;
    }

    .auth-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    .auth-logo {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .auth-form .form-input {
        padding: 0.8rem 1rem;
        font-size: 16px; /* Prevent iOS zoom */
    }

    .auth-btn {
        padding: 0.85rem;
        font-size: 0.95rem;
    }

    .auth-footer {
        margin-top: 1.25rem;
        font-size: 0.75rem;
    }

    .auth-totp-digit {
        width: 40px;
        height: 46px;
        font-size: 1.2rem;
        border-radius: 10px;
    }

    .auth-totp-group {
        gap: 5px;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .auth-bg { animation: none; }
    .auth-particle { animation: none; opacity: 0.04; }
    .auth-container { animation: none; }
    .auth-logo { animation: none; }
    .auth-card { transition: none; }
    .auth-card:hover { transform: none; }
    .auth-btn { transition: none; }
    .auth-btn:hover { transform: none; }
}
