/* MesaGo Auth Pages — login & register */

:root {
    --auth-primary: #0088cc;
    --auth-primary-light: #00a8ff;
    --auth-bg: #0a0e14;
    --auth-panel: #111b21;
    --auth-card: rgba(17, 27, 33, 0.98);
    --auth-input: #1e2a35;
    --auth-border: #2a3942;
    --auth-text: #e9edef;
    --auth-muted: #8696a0;
    --auth-success: #34c759;
    --auth-danger: #ff3b30;
    --auth-radius: 14px;
    --auth-radius-lg: 20px;
}

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

html.auth-root {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.auth-page {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', system-ui, sans-serif;
    background: var(--auth-bg);
    color: var(--auth-text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.auth-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Brand panel — desktop */
.auth-brand {
    flex: 1;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background:
        radial-gradient(circle at 20% 30%, rgba(0, 136, 204, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 149, 0, 0.12) 0%, transparent 45%),
        linear-gradient(145deg, #0a1628 0%, #111b21 50%, #0a0e14 100%);
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(0, 136, 204, 0.08);
    top: -100px;
    right: -100px;
}

.auth-brand-inner {
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-brand-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    font-size: 48px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0, 136, 204, 0.45);
}

.auth-brand h1 {
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(90deg, var(--auth-primary), #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand-tagline {
    font-size: 16px;
    color: var(--auth-muted);
    line-height: 1.5;
    margin-bottom: 32px;
}

.auth-features {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    font-size: 14px;
}

.auth-feature i {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(0, 136, 204, 0.15);
    color: var(--auth-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Form panel */
.auth-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 32px);
    padding-bottom: max(clamp(16px, 4vw, 32px), env(safe-area-inset-bottom));
    background: var(--auth-panel);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-mobile-logo {
    text-align: center;
    margin-bottom: clamp(20px, 5vw, 28px);
}

.auth-mobile-logo .auth-brand-logo {
    width: clamp(64px, 16vw, 80px);
    height: clamp(64px, 16vw, 80px);
    font-size: clamp(28px, 7vw, 36px);
    margin-bottom: 12px;
}

.auth-mobile-logo h1 {
    font-size: clamp(22px, 5.5vw, 28px);
    font-weight: 700;
    background: linear-gradient(90deg, var(--auth-primary), #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-mobile-logo p {
    font-size: 14px;
    color: var(--auth-muted);
    margin-top: 4px;
}

.auth-heading {
    margin-bottom: clamp(20px, 4vw, 28px);
}

.auth-heading h2 {
    font-size: clamp(22px, 5vw, 26px);
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-heading p {
    font-size: 14px;
    color: var(--auth-muted);
}

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

.auth-alert i { margin-top: 2px; flex-shrink: 0; }

.auth-alert-error {
    background: rgba(255, 59, 48, 0.12);
    border: 1px solid rgba(255, 59, 48, 0.4);
    color: #ff6b6b;
}

.auth-alert-success {
    background: rgba(52, 199, 89, 0.12);
    border: 1px solid rgba(52, 199, 89, 0.4);
    color: var(--auth-success);
}

/* Form */
.auth-form { display: flex; flex-direction: column; gap: clamp(12px, 3vw, 16px); }

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-muted);
    margin-bottom: 6px;
}

.auth-field label .required { color: var(--auth-danger); }

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

.auth-input-wrap > i.field-icon {
    position: absolute;
    left: 14px;
    color: var(--auth-muted);
    font-size: 15px;
    pointer-events: none;
    z-index: 1;
}

.auth-input-wrap input {
    width: 100%;
    padding: clamp(12px, 3vw, 14px) 44px clamp(12px, 3vw, 14px) 42px;
    background: var(--auth-input);
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    color: var(--auth-text);
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 48px;
    -webkit-appearance: none;
}

.auth-input-wrap input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.2);
}

.auth-input-wrap input::placeholder { color: #6b7b84; }

.auth-input-wrap input.input-error { border-color: var(--auth-danger); }

.auth-toggle-pw {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-muted);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.auth-toggle-pw:hover { color: var(--auth-primary); background: rgba(255,255,255,0.05); }

.auth-field-hint {
    font-size: 12px;
    color: var(--auth-muted);
    margin-top: 5px;
}

.auth-field-hint.valid { color: var(--auth-success); }
.auth-field-hint.invalid { color: var(--auth-danger); }

.auth-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Password strength */
.auth-strength { margin-top: 8px; }
.auth-strength-bar {
    height: 4px;
    background: var(--auth-input);
    border-radius: 2px;
    overflow: hidden;
}
.auth-strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    transition: width 0.3s, background 0.3s;
    border-radius: 2px;
}
.auth-strength-label {
    font-size: 11px;
    color: var(--auth-muted);
    margin-top: 5px;
}

.auth-rules {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
}
.auth-rules li {
    font-size: 11px;
    color: var(--auth-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.auth-rules li.valid { color: var(--auth-success); }
.auth-rules li i { font-size: 6px; }
.auth-rules li.valid i::before { content: '\f058'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 11px; }

/* Options row */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 13px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--auth-muted);
    user-select: none;
}
.auth-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

/* Submit */
.auth-submit {
    width: 100%;
    padding: clamp(13px, 3vw, 15px);
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-light));
    border: none;
    border-radius: var(--auth-radius);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    touch-action: manipulation;
    margin-top: 4px;
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

.auth-submit:active:not(:disabled) { transform: scale(0.98); }

/* Footer links */
.auth-footer {
    text-align: center;
    margin-top: clamp(20px, 4vw, 28px);
    padding-top: 20px;
    border-top: 1px solid var(--auth-border);
    font-size: 14px;
    color: var(--auth-muted);
}

.auth-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
}

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

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--auth-muted);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 16px;
    transition: color 0.2s;
}
.auth-back:hover { color: var(--auth-primary); }

/* Desktop */
@media (min-width: 900px) {
    .auth-brand { display: flex; }
    .auth-mobile-logo { display: none; }
    .auth-panel {
        flex: 0 0 min(480px, 45vw);
        border-left: 1px solid var(--auth-border);
    }
}

@media (max-width: 899px) {
    .auth-layout { flex-direction: column; }
    .auth-panel { min-height: 100dvh; justify-content: flex-start; padding-top: max(20px, env(safe-area-inset-top)); }
    .auth-heading { display: none; }
}

@media (max-width: 480px) {
    .auth-row-2 { grid-template-columns: 1fr; gap: 12px; }
    .auth-card { max-width: 100%; }
    .auth-input-wrap input { font-size: 16px; } /* prevent iOS zoom */
}

@media (max-width: 360px) {
    .auth-options { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit, .auth-input-wrap input { transition: none; }
}
