/* ==========================================================================
   MTN NG - authentication pages
   --------------------------------------------------------------------------
   Shared by resources/views/mtnng/auth/*. Loaded BEFORE forms-common.css so
   that file keeps its documented contract of winning equal-specificity ties
   for field shape, focus rings and invalid states.

   Do not define --mtn-blue or any --form-* token here. Those belong to
   public/css/forms-common.css.
   ========================================================================== */

:root {
    --mtn-yellow: #FFCC00;
    --mtn-dark: #000000;
    --mtn-grey: #4A4A4A;
    --header-height: 64px;

    --auth-border: #e0e0e0;
    --auth-card-radius: 16px;
    --auth-card-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
    --auth-card-border: 1px solid rgba(15, 23, 42, 0.06);
    --auth-hover: #e6b800;
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */
body.auth-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--mtn-dark);
}

.auth-body *,
.auth-body *::before,
.auth-body *::after {
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Top bar - mirrors .top-navbar in mtnng/layouts/partner.blade.php
   -------------------------------------------------------------------------- */
.auth-topbar {
    position: sticky;
    top: 0;
    z-index: 1050;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--header-height);
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid var(--auth-border);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.auth-brand-logo {
    height: 36px;
    width: auto;
    display: block;
}

.auth-brand-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--mtn-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.auth-main {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2.5rem 1rem 3rem;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border: var(--auth-card-border);
    border-radius: var(--auth-card-radius);
    box-shadow: var(--auth-card-shadow);
    overflow: hidden;
    animation: authFadeIn 0.35s ease-out;
}

.auth-card--sm {
    max-width: 480px;
}

.auth-card--md {
    max-width: 500px;
}

.auth-card--lg {
    max-width: 560px;
}

.auth-card-header {
    padding: 2rem 2rem 0;
    text-align: center;
}

.auth-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: rgba(255, 204, 0, 0.18);
    color: var(--mtn-dark);
    font-size: 1.5rem;
}

.auth-title {
    margin: 0 0 0.35rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--mtn-dark);
}

.auth-subtitle {
    margin: 0;
    font-size: 0.925rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--mtn-grey);
}

.auth-card-body {
    padding: 1.75rem 2rem 2rem;
}

.auth-card-header + .auth-card-body {
    padding-top: 1.5rem;
}

.auth-card-footer {
    padding: 1.1rem 2rem;
    border-top: 1px solid var(--auth-border);
    background: #fcfcfc;
    text-align: center;
    font-size: 0.9rem;
    color: var(--mtn-grey);
}

.auth-card-footer p {
    margin: 0;
}

.auth-card-footer a {
    color: var(--mtn-blue, #26A9E0);
    font-weight: 600;
    text-decoration: none;
}

.auth-card-footer a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Alerts and text
   -------------------------------------------------------------------------- */
.auth-alerts .alert {
    margin-bottom: 1.25rem;
    border-radius: 10px;
    animation: authSlideIn 0.3s ease-out;
}

.auth-alerts .alert:last-child {
    margin-bottom: 1.25rem;
}

.auth-alerts .alert ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.auth-alerts .alert li + li {
    margin-top: 0.25rem;
}

.auth-lead,
.info-text {
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--mtn-grey);
}

.auth-success-panel {
    padding: 1.5rem 1.25rem;
    border-radius: 10px;
    text-align: center;
}

.auth-success-panel > i {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 2.5rem;
}

.auth-success-panel h5 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.auth-success-panel p {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Buttons and links
   -------------------------------------------------------------------------- */
.btn-login,
.btn-register,
.btn-reset,
.btn-verify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 48px;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: var(--form-radius, 10px);
    background: var(--mtn-yellow);
    color: var(--mtn-dark);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.btn-login:hover:not(:disabled),
.btn-register:hover:not(:disabled),
.btn-reset:hover:not(:disabled),
.btn-verify:hover:not(:disabled) {
    background: var(--auth-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.btn-login:disabled,
.btn-register:disabled,
.btn-reset:disabled,
.btn-verify:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-back,
.btn-secondary.btn-back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.8rem 1rem;
    border: 2px solid var(--auth-border);
    border-radius: var(--form-radius, 10px);
    background: transparent;
    color: var(--mtn-grey);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.btn-back:hover {
    border-color: var(--mtn-yellow);
    color: var(--mtn-dark);
    text-decoration: none;
}

.auth-card .btn-secondary {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--auth-border);
    border-radius: var(--form-radius, 10px);
    background: #f4f5f7;
    color: var(--mtn-grey);
    font-weight: 600;
}

.auth-card .btn-secondary:hover {
    background: #e9ecef;
    border-color: #d5d5d5;
    color: var(--mtn-dark);
}

/* Register step 2: Previous sits directly above the submit button */
.auth-card #prevBtn {
    margin-bottom: 0.75rem;
}

.forgot-link,
.back-link,
.auth-link {
    color: var(--mtn-blue, #26A9E0);
    font-weight: 600;
    text-decoration: none;
}

.forgot-link:hover,
.back-link:hover,
.auth-link:hover {
    text-decoration: underline;
}

.remember-forgot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.25rem 0 1.25rem;
}

.remember-forgot .form-check {
    margin: 0;
}

.form-check-input:checked {
    background-color: var(--mtn-yellow);
    border-color: var(--mtn-yellow);
}

.form-label {
    color: var(--form-label-color, var(--mtn-grey));
}

.required-field::after {
    content: " *";
    color: #dc3545;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: #8a8a8a;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

/* --------------------------------------------------------------------------
   Password fields
   -------------------------------------------------------------------------- */
.auth-password-wrap {
    position: relative;
}

.auth-password-wrap .form-control {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 1rem;
    z-index: 3;
    transform: translateY(-50%);
    padding: 0.25rem;
    color: #8a8a8a;
    cursor: pointer;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--mtn-blue, #26A9E0);
}

/* --------------------------------------------------------------------------
   Password strength and requirements
   -------------------------------------------------------------------------- */
.password-strength {
    width: 100%;
    height: 4px;
    margin: 0.5rem 0 0.35rem;
    border-radius: 999px;
    background: #ececec;
    overflow: hidden;
}

.password-strength-bar {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: #dc3545;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-bar.weak {
    width: 33%;
    background: #dc3545;
}

.password-strength-bar.medium {
    width: 66%;
    background: #f0ad4e;
}

.password-strength-bar.strong {
    width: 100%;
    background: #198754;
}

.password-hint {
    display: block;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    color: var(--mtn-grey);
}

.requirement.met {
    color: #198754;
}

.requirement.unmet {
    color: #dc3545;
}

.validation-error-msg,
.captcha-error {
    display: none;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: #dc3545;
}

.validation-error-msg.show,
.captcha-error.show {
    display: block;
}

.g-recaptcha {
    margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Register progress indicator
   -------------------------------------------------------------------------- */
.progress-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin: 1.25rem 0 0.5rem;
}

.step {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
}

.step-circle {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid #d9d9d9;
    border-radius: 50%;
    background: #fff;
    color: #8a8a8a;
    font-size: 0.9rem;
    font-weight: 700;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.step-label {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: #6c757d;
    white-space: nowrap;
}

.step-line {
    position: absolute;
    top: 17px;
    left: 50%;
    z-index: 0;
    width: 100%;
    height: 2px;
    background: var(--auth-border);
}

.step:last-child .step-line {
    display: none;
}

.step.active .step-circle {
    border-color: var(--mtn-yellow);
    background: var(--mtn-yellow);
    color: var(--mtn-dark);
}

.step.active .step-label {
    color: var(--mtn-dark);
    font-weight: 600;
}

.step.completed .step-circle {
    border-color: var(--mtn-dark);
    background: var(--mtn-dark);
    color: var(--mtn-yellow);
}

.step.completed .step-line {
    background: var(--mtn-yellow);
}

/* --------------------------------------------------------------------------
   OTP verification
   -------------------------------------------------------------------------- */
.email-display {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--auth-border);
    border-radius: var(--form-radius, 10px);
    background: #f8f9fa;
    text-align: center;
    font-weight: 600;
    color: var(--mtn-dark);
    word-break: break-all;
}

.otp-label {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mtn-grey);
    text-align: center;
}

.countdown-wrapper,
.resend-wrapper {
    text-align: center;
}

.otp-inputs {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin: 1rem 0;
}

.otp-inputs input {
    width: 48px;
    height: 56px;
    padding: 0;
    border: 2px solid var(--form-border-color, #e0e0e0);
    border-radius: var(--form-radius, 10px);
    background: #fff;
    color: var(--mtn-dark);
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.otp-inputs input.filled {
    border-color: var(--mtn-yellow);
    background: rgba(255, 204, 0, 0.10);
}

.otp-inputs input.error {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.06);
}

.countdown-label {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    color: var(--mtn-grey);
    text-align: center;
}

.countdown-timer {
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--mtn-dark);
}

.countdown-timer.expiring {
    color: #dc3545;
    animation: authPulse 1s ease-in-out infinite;
}

.btn-resend {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--mtn-blue, #26A9E0);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-resend:disabled {
    color: #9aa0a6;
    cursor: not-allowed;
}

.resend-msg {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    text-align: center;
}

.resend-msg.success {
    color: #198754;
}

.resend-msg.error {
    color: #dc3545;
}

/* --------------------------------------------------------------------------
   Shared incidental components
   -------------------------------------------------------------------------- */
.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    margin: 0 auto;
    border: 3px solid rgba(0, 0, 0, 0.15);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: authSpin 0.9s linear infinite;
}

.auth-card fieldset[disabled] {
    opacity: 0.75;
}

.skeleton-loader {
    display: none;
}

.skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: authShimmer 1.4s ease infinite;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 0.75rem;
}

.skeleton-input {
    height: 48px;
    margin-bottom: 1rem;
}

.skeleton-button {
    height: 48px;
}

.shake {
    animation: authShake 0.45s ease-in-out;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

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

@keyframes authPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .auth-brand-logo {
        height: 28px;
    }

    .auth-main {
        padding: 1.5rem 0.75rem 2rem;
    }
}

@media (max-width: 576px) {
    .auth-brand-title {
        display: none;
    }

    .auth-card {
        border-radius: 14px;
    }

    .auth-card-header {
        padding: 1.5rem 1.25rem 0;
    }

    .auth-card-body {
        padding: 1.25rem;
    }

    .auth-card-footer {
        padding: 1rem 1.25rem;
    }

    .otp-inputs {
        gap: 0.4rem;
    }

    .otp-inputs input {
        width: 42px;
        height: 50px;
        font-size: 1.2rem;
    }

    .step-label {
        font-size: 0.7rem;
    }
}

@media (max-width: 360px) {
    /* Keep the 304px reCAPTCHA widget inside the card */
    .g-recaptcha {
        transform: scale(0.9);
        transform-origin: left top;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-alerts .alert,
    .password-strength-bar,
    .step-circle,
    .btn-login,
    .btn-register,
    .btn-reset,
    .btn-verify {
        animation: none;
        transition: none;
    }
}
