/**
 * MasterPDV — Tela de login (usa variáveis de theme.css)
 */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    height: 100%;
    margin: 0;
    overflow-x: hidden;
    font-family: var(--pdv-font, 'Inter', system-ui, sans-serif);
}

.login-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

.login-hero {
    flex: none;
    width: 100%;
    min-height: clamp(140px, 28vh, 220px);
    max-height: 32vh;
    background: url('../img/login-bg.jpg') center 30% / cover no-repeat;
    position: relative;
}

.login-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, .35) 0%, transparent 55%);
    pointer-events: none;
}

.login-hero-brand {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-hero-brand img {
    width: clamp(32px, 8vw, 44px);
    height: clamp(32px, 8vw, 44px);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .25));
}

.login-hero-brand span {
    color: #fff;
    font-size: clamp(.95rem, 3.5vw, 1.15rem);
    font-weight: 700;
    letter-spacing: -.02em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, .35);
}

.login-side {
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: linear-gradient(145deg, var(--pdv-primary) 0%, var(--pdv-primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(16px, env(safe-area-inset-top, 0px))
        max(16px, env(safe-area-inset-right, 0px))
        max(20px, env(safe-area-inset-bottom, 0px))
        max(16px, env(safe-area-inset-left, 0px));
}

.login-card {
    width: 100%;
    max-width: min(400px, 100%);
    background: var(--pdv-surface);
    border-radius: var(--pdv-radius);
    box-shadow: var(--pdv-shadow-md);
    padding: clamp(20px, 5vw, 32px) clamp(18px, 4.5vw, 36px) clamp(22px, 5vw, 36px);
}

.login-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--pdv-border);
    margin-bottom: 22px;
}

.login-card-header img {
    width: 36px;
    height: 36px;
}

.login-card-brand {
    font-size: clamp(1.1rem, 4vw, 1.35rem);
    font-weight: 700;
    color: var(--pdv-text);
    letter-spacing: -.02em;
    line-height: 1;
}

.login-card-brand span {
    color: var(--pdv-primary);
}

.login-title {
    font-size: clamp(.95rem, 2.8vw, 1.05rem);
    font-weight: 600;
    color: var(--pdv-text);
    margin-bottom: clamp(16px, 4vw, 22px);
}

.login-field {
    position: relative;
    margin-bottom: 14px;
}

.login-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pdv-text-muted);
    font-size: .85rem;
    pointer-events: none;
    z-index: 2;
}

.login-field .form-control {
    padding: .7rem .85rem .7rem 2.5rem;
    border: 1px solid var(--pdv-border);
    border-radius: var(--pdv-radius-sm);
    font-size: .9rem;
    color: var(--pdv-text-secondary);
    background: var(--pdv-surface);
}

.login-field .form-control::placeholder {
    color: var(--pdv-text-muted);
    font-size: .85rem;
}

.login-field .form-control:focus {
    border-color: var(--pdv-primary-muted);
    box-shadow: 0 0 0 0.2rem rgba(var(--pdv-primary-rgb), 0.15);
}

.login-field .form-control.is-invalid {
    border-color: var(--pdv-danger);
}

.login-hint {
    font-size: .78rem;
    color: var(--pdv-text-muted);
    margin-bottom: 18px;
    line-height: 1.45;
}

.btn-entrar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: .72rem 1rem;
    background: var(--pdv-primary);
    border: none;
    border-radius: var(--pdv-radius-sm);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    transition: background .2s;
}

.btn-entrar:hover {
    background: var(--pdv-primary-hover);
    color: #fff;
}

.alert-danger {
    border-radius: var(--pdv-radius-sm);
    font-size: .85rem;
    word-break: break-word;
}

@media (max-width: 359px) {
    .login-hero {
        min-height: 120px;
        max-height: 26vh;
    }
}

@media (max-width: 575px) {
    .login-field .form-control {
        font-size: 16px;
    }

    .btn-entrar {
        min-height: 2.75rem;
    }

    .login-side {
        align-items: flex-start;
        padding-top: 12px;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .login-hero {
        min-height: clamp(180px, 32vh, 260px);
        max-height: 36vh;
    }

    .login-side {
        padding: 28px 24px;
    }
}

@media (min-width: 768px) {
    .login-wrapper {
        flex-direction: row;
    }

    .login-hero {
        flex: 1.1;
        min-width: 0;
        min-height: 100%;
        max-height: none;
        width: auto;
    }

    .login-hero-brand {
        top: 24px;
        left: 28px;
    }

    .login-side {
        flex: 1;
        min-width: 280px;
        max-width: 52%;
        padding: 32px clamp(20px, 3vw, 40px);
    }
}

@media (min-width: 900px) {
    .login-hero { flex: 1.2; }
    .login-side { flex: 1; max-width: 48%; }
    .login-card { max-width: 420px; }
}

@media (min-width: 1200px) {
    .login-hero-brand { top: 36px; left: 48px; }
    .login-side { padding: 48px; }
    .login-card { max-width: 440px; padding: 36px 40px 40px; }
}

@media (min-width: 1600px) {
    .login-side { max-width: 640px; }
}

@media (max-height: 500px) and (orientation: landscape) {
    .login-wrapper { flex-direction: row; }
    .login-hero {
        flex: 0 0 38%;
        min-height: 100%;
        max-height: none;
    }
    .login-side {
        flex: 1;
        max-width: none;
        padding: 12px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .login-card { padding: 16px 20px 20px; }
    .login-card-header { padding-bottom: 12px; margin-bottom: 14px; }
    .login-title { margin-bottom: 12px; }
    .login-field { margin-bottom: 10px; }
    .login-hint { margin-bottom: 12px; }
}

@media (max-height: 420px) {
    .login-hero { display: none; }
    .login-wrapper { flex-direction: column; }
    .login-side { max-width: none; min-height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
    .btn-entrar { transition: none; }
}
