/* Cadre sign-in. Palette is taken from the Scout/Steward marks: navy ink, teal accent. */

:root {
    --cadre-navy: #182442;
    --cadre-teal: #34c6a0;
    --cadre-teal-dark: #22a583;
    --cadre-ink: #1e293b;
    --cadre-muted: #64748b;
    --cadre-line: #e1e8ef;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.auth-body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e1e8ef 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Wide enough to seat both product marks side by side without shrinking them. */
.login-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(24, 36, 66, 0.12);
    width: 100%;
    max-width: 620px;
    overflow: hidden;
}

.login-header {
    background: #ffffff;
    border-bottom: 1px solid var(--cadre-line);
    padding: 36px 40px 32px;
    text-align: center;
}

/* Scout and Steward as peers, hairline between them. Stacks on narrow screens. */
.logo-lockup {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.logo-mark {
    display: block;
    width: 240px;
    max-width: 100%;
    height: auto;
}

.logo-divider {
    display: block;
    flex: 0 0 auto;
    width: 1px;
    align-self: stretch;
    background: var(--cadre-line);
}

/* The form itself stays a comfortable reading width inside the wider card. */
.login-body {
    padding: 40px;
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--cadre-ink);
    margin-bottom: 8px;
    text-align: center;
}

.login-description {
    color: var(--cadre-muted);
    font-size: 14px;
    text-align: center;
    margin-bottom: 32px;
}

.login-description strong {
    color: var(--cadre-ink);
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cadre-ink);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cadre-muted);
    font-size: 16px;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    border: 2px solid var(--cadre-line);
    border-radius: 8px;
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
    color: var(--cadre-ink);
}

.form-input:focus {
    outline: none;
    border-color: var(--cadre-teal);
    box-shadow: 0 0 0 3px rgba(52, 198, 160, 0.15);
}

.form-input::placeholder {
    color: #cbd5e0;
}

/* The code is read back digit by digit — space it out and centre it. */
.otp-input {
    letter-spacing: 8px;
    font-weight: 600;
    text-align: center;
    padding-left: 46px;
    padding-right: 38px;
}

.btn {
    width: 100%;
    padding: 14px;
    background: var(--cadre-navy);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    background: #101a31;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(24, 36, 66, 0.28);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.help-text {
    text-align: center;
    font-size: 13px;
    color: var(--cadre-muted);
    margin-top: 24px;
}

.help-text a {
    color: var(--cadre-teal-dark);
    text-decoration: none;
    font-weight: 600;
}

.help-text a:hover {
    text-decoration: underline;
}

.version-text {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 16px;
    font-weight: 400;
}

.success-message {
    background: #d1fae5;
    border: 1px solid var(--cadre-teal);
    color: #065f46;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
}

.success-message.show {
    display: flex;
}

.error-message {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
}

.error-message.show {
    display: flex;
}

.otp-expiry {
    text-align: center;
    font-size: 13px;
    color: var(--cadre-muted);
    margin-bottom: 20px;
}

.otp-expiry.expiring {
    color: #ef4444;
    font-weight: 600;
}

.otp-step {
    display: none;
}

.otp-step.active {
    display: block;
}

.email-step.hidden {
    display: none;
}

.back-button {
    color: var(--cadre-teal-dark);
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    font-weight: 600;
}

.back-button:hover {
    text-decoration: underline;
}

.resend-timer {
    text-align: center;
    font-size: 13px;
    color: var(--cadre-muted);
    margin-top: 16px;
}

.resend-link {
    color: var(--cadre-teal-dark);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}

.resend-link:hover {
    text-decoration: underline;
}

.resend-link.disabled {
    color: #cbd5e0;
    cursor: not-allowed;
    text-decoration: none;
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 32px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--cadre-ink);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid var(--cadre-line);
    border-radius: 4px;
    transition: all 0.2s;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--cadre-teal);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--cadre-teal);
    border-color: var(--cadre-teal);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-weight: 500;
    color: var(--cadre-ink);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(24, 36, 66, 0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
    color: #fff;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(52, 198, 160, 0.25);
    border-top-color: var(--cadre-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

/* Below the side-by-side threshold the two marks stack and the divider turns
   horizontal, so neither logo has to shrink into illegibility. */
@media (max-width: 600px) {
    .logo-lockup {
        flex-direction: column;
        gap: 18px;
    }

    .logo-divider {
        width: 60px;
        height: 1px;
        align-self: center;
    }
}

@media (max-width: 480px) {
    .login-body {
        padding: 32px 24px;
    }

    .login-header {
        padding: 32px 24px 24px;
    }

    .login-title {
        font-size: 20px;
    }
}
