/**
 * Login — split-screen Master Dealer (§25.10 / §25.15)
 * Paleta bege/marrom + layout FLOW; JWT via login.js
 */

:root {
    --md-primary: #8B7355;
    --md-secondary: #C4A882;
    --md-accent-gradient: linear-gradient(135deg, var(--md-primary) 0%, var(--md-secondary) 100%);
    --md-bg-brand: #E8E3DD;
    --md-bg-input: #F5F0EB;
    --md-bg-input-focus: #EDE8E2;
    --md-text-primary: #2D3748;
    --md-text-muted: #718096;
}

body.auth-page {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    height: 100vh;
    overflow: hidden;
}

body.auth-page * {
    box-sizing: border-box;
}

.login-container {
    display: flex;
    height: 100vh;
    min-height: 600px;
}

.branding-section {
    flex: 1;
    background: var(--md-bg-brand);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
    min-width: 0;
}

.branding-content {
    text-align: center;
    color: var(--md-text-primary);
    z-index: 2;
}

.welcome-text {
    font-size: 3.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--md-text-primary);
    text-align: center;
}

.flow-logo {
    margin-bottom: 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1rem;
    overflow: visible;
}

.flow-logo .logo-img {
    width: 100%;
    max-width: 300px;
    height: auto;
    object-fit: contain;
    object-position: center;
    transform: scale(1.95);
    transform-origin: center center;
}

.developer-info {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-left: clamp(12px, 4vw, 35px);
}

.techone-logo {
    width: 237px;
    height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.techone-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.1);
    transform-origin: center center;
}

.form-section {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    min-width: 0;
    position: relative;
}

.form-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.app-logo {
    width: 140px;
    height: 134px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.app-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.8);
    transform-origin: center center;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--md-text-primary);
    margin-bottom: 2rem;
    letter-spacing: 2px;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.password-group {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    color: var(--md-text-primary);
}

.password-toggle:hover {
    opacity: 1;
}

.eye-icon {
    display: inline-flex;
    user-select: none;
}

.form-input {
    width: 100%;
    padding: 1rem 1.2rem;
    border: none;
    border-radius: 12px;
    background: var(--md-bg-input);
    font-size: 1rem;
    color: var(--md-text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.password-group .form-input {
    padding-right: 3.5rem;
}

.form-input:focus {
    background: var(--md-bg-input-focus);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.2);
}

.form-input::placeholder {
    color: var(--md-text-muted);
    font-weight: 500;
}

.login-button {
    width: 100%;
    padding: 1rem;
    background: var(--md-accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

.login-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 115, 85, 0.35);
}

.login-button:active:not(:disabled) {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.75;
    cursor: wait;
}

.forgot-password {
    color: var(--md-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: var(--md-primary);
}

.copyright {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    color: var(--md-text-muted);
    font-size: 0.8rem;
}

.g-recaptcha {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.g-recaptcha > div {
    transform: scale(0.9);
    transform-origin: center;
}

.auth-error {
    background: #fee;
    color: #c33;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: center;
    display: none;
}

.auth-error.is-visible {
    display: block;
}

.hidden {
    display: none !important;
}

.form-header {
    margin-bottom: 1.5rem;
}

.form-subtitle {
    color: var(--md-text-muted);
    font-size: 0.95rem;
    margin-top: -1rem;
    margin-bottom: 0.5rem;
}

.password-strength {
    margin-top: 0.5rem;
}

.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--md-bg-input-focus);
    overflow: hidden;
}

.password-strength-bar .fill {
    height: 100%;
    width: 0;
    transition: width 0.2s, background 0.2s;
    border-radius: 2px;
}

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

.password-strength-bar.media .fill {
    width: 66%;
    background: #ffc107;
}

.password-strength-bar.forte .fill {
    width: 100%;
    background: #28a745;
}

.password-strength-label {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    color: var(--md-text-muted);
}

.password-strength-label.fraca { color: #dc3545; }
.password-strength-label.media { color: #ffc107; }
.password-strength-label.forte { color: #28a745; }

@media (max-width: 768px) {
    body.auth-page {
        overflow-y: auto;
    }

    .login-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .branding-section {
        flex: 0 0 40vh;
        min-height: 300px;
        padding: 1.5rem;
    }

    /* Mantém welcome + logo na mesma posição de antes; só o rodapé flutua */
    .branding-section::after {
        content: '';
        display: block;
        flex-shrink: 0;
        height: calc(1.5rem + 58px + 1rem);
        width: 1px;
        pointer-events: none;
        visibility: hidden;
    }

    .welcome-text {
        font-size: 2.125rem;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .flow-logo .logo-img {
        max-width: 240px;
    }

    .developer-info {
        position: absolute;
        bottom: 0.45rem;
        right: clamp(0.75rem, 5vw, 1.5rem);
        left: auto;
        justify-content: flex-end;
        margin: 0;
        padding: 0;
    }

    .techone-logo {
        width: 150px;
        height: 58px;
    }

    .form-section {
        flex: 1;
        padding: 2rem 1.5rem;
        justify-content: flex-start;
        padding-top: 3rem;
    }

    .form-container {
        max-width: 100%;
    }

    .app-logo {
        width: 80px;
        height: 76px;
        margin-bottom: 1.5rem;
    }

    .login-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .form-input {
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
    }

    .login-button {
        padding: 0.9rem;
        font-size: 1rem;
    }

    .copyright {
        position: static;
        text-align: center;
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    .branding-section {
        flex: 0 0 35vh;
        min-height: 260px;
        padding: 1.5rem 1rem;
    }

    .welcome-text {
        font-size: 1.875rem;
        margin-top: 1rem;
    }

    .flow-logo .logo-img {
        max-width: 200px;
    }
}
