/**
 * OFFMARKET24 - Auth Pages Stylesheet
 * Login, Register, Forgot Password
 */

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    --color-primary-600: #EE294E;
    --gradient-primary: linear-gradient(135deg, #EE294E 0%, #FF1BA5 100%);
    --gradient-primary-hover: linear-gradient(135deg, #d6233f 0%, #e5189a 100%);
    --color-neutral-50: #f9fafb;
    --color-neutral-100: #f3f4f6;
    --color-neutral-200: #e5e7eb;
    --color-neutral-300: #d1d5db;
    --color-neutral-400: #9ca3af;
    --color-neutral-500: #6b7280;
    --color-neutral-600: #4b5563;
    --color-neutral-700: #374151;
    --color-neutral-800: #1f2937;
    --color-neutral-900: #111827;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Base Reset for Auth Pages
   ========================================================================== */
.auth-page {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-neutral-900);
    background: var(--color-neutral-50);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ==========================================================================
   Layout
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(238, 41, 78, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 27, 165, 0.03) 0%, transparent 50%),
        var(--color-neutral-50);
}

.auth-container {
    width: 100%;
    position: relative;
    z-index: 1;
}

.auth-container--sm {
    max-width: 460px;
}

.auth-container--md {
    max-width: 540px;
}

.auth-container--lg {
    max-width: 640px;
}

/* ==========================================================================
   Card
   ========================================================================== */
.auth-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.03),
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 8px 16px rgba(0, 0, 0, 0.04),
        0 24px 48px rgba(0, 0, 0, 0.03);
    padding: 48px 40px 40px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 36px 24px 32px;
        border-radius: 16px;
    }
}

/* ==========================================================================
   Logo
   ========================================================================== */
.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo img {
    height: 22px;
    width: auto;
}

/* ==========================================================================
   Header / Title
   ========================================================================== */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header__title {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-neutral-900);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-header__subtitle {
    font-size: 15px;
    color: var(--color-neutral-500);
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   Alerts (Error / Success)
   ========================================================================== */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}

.auth-alert__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-alert--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert--error .auth-alert__icon {
    color: #ef4444;
}

.auth-alert--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-alert--success .auth-alert__icon {
    color: #22c55e;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */
.auth-form {
    width: 100%;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-neutral-700);
    margin-bottom: 6px;
}

.form-label--required::after {
    content: ' *';
    color: var(--color-primary-600);
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: var(--font-sans);
    color: var(--color-neutral-900);
    background: #ffffff;
    border: 1.5px solid var(--color-neutral-200);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    appearance: none;
}

.form-input::placeholder {
    color: var(--color-neutral-400);
}

.form-input:hover {
    border-color: var(--color-neutral-300);
}

.form-input:focus {
    border-color: var(--color-primary-600);
    box-shadow: 0 0 0 3px rgba(238, 41, 78, 0.1);
}

.form-input--error {
    border-color: #ef4444;
}

.form-input--error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Select */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 42px;
    cursor: pointer;
}

/* Password Field */
.form-password {
    position: relative;
}

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

.form-password__toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-neutral-400);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.form-password__toggle:hover {
    color: var(--color-neutral-600);
    background: var(--color-neutral-100);
}

.form-password__toggle svg {
    width: 20px;
    height: 20px;
}

/* Form Hint */
.form-hint {
    font-size: 13px;
    color: var(--color-neutral-400);
    margin-top: 6px;
    display: block;
}

/* Form Grid */
.form-grid {
    display: grid;
    gap: 20px;
}

.form-grid--2 {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 540px) {
    .form-grid--2 {
        grid-template-columns: 1fr;
    }
}

/* Form Row (flex) */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

/* ==========================================================================
   Toggle / Switch
   ========================================================================== */
.auth-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-neutral-600);
    user-select: none;
}

.auth-toggle__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.auth-toggle__slider {
    width: 40px;
    height: 22px;
    background: var(--color-neutral-200);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.auth-toggle__slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.auth-toggle__input:checked + .auth-toggle__slider {
    background: var(--color-primary-600);
}

.auth-toggle__input:checked + .auth-toggle__slider::before {
    transform: translateX(18px);
}

/* ==========================================================================
   Checkbox
   ========================================================================== */
.auth-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-neutral-600);
    line-height: 1.5;
}

.auth-checkbox__input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--color-primary-600);
    flex-shrink: 0;
}

.auth-checkbox a {
    color: var(--color-neutral-900);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-checkbox a:hover {
    color: var(--color-primary-600);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-sans);
    color: #ffffff;
    background: var(--gradient-primary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.auth-btn:hover {
    background: var(--gradient-primary-hover);
    box-shadow: 0 4px 12px rgba(238, 41, 78, 0.3);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(238, 41, 78, 0.2);
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Links
   ========================================================================== */
.auth-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-neutral-600);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-link:hover {
    color: var(--color-primary-600);
}

.auth-link--primary {
    color: var(--color-primary-600);
    font-weight: 600;
}

.auth-link--primary:hover {
    color: #d6233f;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.auth-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--color-neutral-200);
}

.auth-footer p {
    margin: 0;
    font-size: 14px;
    color: var(--color-neutral-500);
}

.auth-footer a {
    color: var(--color-neutral-900);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-footer a:hover {
    color: var(--color-primary-600);
}

/* ==========================================================================
   Copyright
   ========================================================================== */
.auth-copyright {
    text-align: center;
    margin-top: 32px;
    font-size: 13px;
    color: var(--color-neutral-400);
}

/* ==========================================================================
   Role Selection (Register)
   ========================================================================== */
.role-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

.role-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    border: 2px solid var(--color-neutral-200);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.role-card:hover {
    border-color: rgba(238, 41, 78, 0.3);
    background: rgba(238, 41, 78, 0.02);
}

.role-card.selected {
    border-color: var(--color-primary-600);
    background: rgba(238, 41, 78, 0.04);
    box-shadow: 0 0 0 3px rgba(238, 41, 78, 0.1);
}

.role-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.role-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 10px;
    color: var(--color-neutral-400);
    transition: color 0.2s ease;
}

.role-icon svg {
    width: 100%;
    height: 100%;
}

.role-card:hover .role-icon,
.role-card.selected .role-icon {
    color: var(--color-primary-600);
}

.role-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-neutral-900);
    margin-bottom: 4px;
}

.role-desc {
    font-size: 13px;
    color: var(--color-neutral-500);
    line-height: 1.4;
}

@media (max-width: 480px) {
    .role-selection {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Divider
   ========================================================================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--color-neutral-400);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-neutral-200);
}

/* ==========================================================================
   Password Strength Indicator
   ========================================================================== */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.password-strength__bar {
    flex: 1;
    height: 3px;
    background: var(--color-neutral-200);
    border-radius: 2px;
    transition: background 0.3s ease;
}

.password-strength__bar.active.weak {
    background: #ef4444;
}

.password-strength__bar.active.medium {
    background: #f59e0b;
}

.password-strength__bar.active.strong {
    background: #22c55e;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 480px) {
    .auth-wrapper {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-header__title {
        font-size: 22px;
    }

    .auth-btn {
        padding: 13px 20px;
    }
}

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

.auth-card {
    animation: auth-fadeIn 0.4s ease;
}

/* ==========================================================================
   Back Link
   ========================================================================== */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-neutral-500);
    text-decoration: none;
    margin-bottom: 24px;
    transition: color 0.15s ease;
}

.auth-back:hover {
    color: var(--color-neutral-900);
}

.auth-back svg {
    width: 16px;
    height: 16px;
}
