@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ═══════════════════════════════════════════════════
   VARIÁVEIS
   ═══════════════════════════════════════════════════ */
:root {
    color-scheme: light only;

    --primary:        #ff521d;
    --primary-hover:  #e8451a;
    --primary-ring:   rgba(255, 82, 29, 0.18);

    --text-header:    #111827;
    --text-input:     #1f2937;
    --text-placeholder:#9ca3af;
    --text-icon:      #6b7280;

    --input-bg:       #ffffff;
    --input-border:   transparent;

    --danger:         #dc2626;
    --danger-bg:      rgba(220, 38, 38, 0.96);
    --danger-text:    #ffffff;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    --pill: 999px;
}

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

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

body {
    font-family: var(--font);
    background: #f7f9fc;
    color: var(--text-header);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════════════
   TELA — imagem de fundo cobrindo toda a área
   ═══════════════════════════════════════════════════ */
.login-screen {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background-color: #f7f9fc;
    background-image: radial-gradient(ellipse at 12% 12%, rgba(255, 82, 29, 0.09), transparent 34%), radial-gradient(ellipse at 88% 88%, rgba(255, 82, 29, 0.06), transparent 32%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════
   CABEÇALHO
   ═══════════════════════════════════════════════════ */
.login-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.75rem 2.25rem;
}

.login-header-left,
.login-header-right {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-header);
    text-shadow:
        0 1px 2px rgba(255, 255, 255, 0.85),
        0 0 8px rgba(255, 255, 255, 0.5);
}

.login-header-left {
    max-width: 60%;
    letter-spacing: 0.01em;
}

.login-header-right {
    text-align: right;
    white-space: nowrap;
}

.login-security { display: inline-flex; align-items: center; gap: .55rem; }
.login-security svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ═══════════════════════════════════════════════════
   CORPO CENTRAL
   ═══════════════════════════════════════════════════ */
.login-body {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-form {
    width: 100%;
    max-width: 360px;
    animation: fade-up 0.5s ease both;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* LOGO AUMENTADA */
.login-company-logo {
    display: block;
    width: min(100%, 340px);
    max-height: 160px;
    object-fit: contain;
    object-position: center;
    margin: -0.5rem auto 1rem;
}

.login-identify {
    margin: 0 auto 1.25rem;
    text-align: center;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .09em;
    color: var(--text-placeholder);
}

/* ═══════════════════════════════════════════════════
   INPUTS PILL-SHAPED COM ÍCONES
   ═══════════════════════════════════════════════════ */
.input-wrap {
    position: relative;
    margin-bottom: 1.1rem;
}

.input-wrap input {
    width: 100%;
    height: 54px;
    padding: 0 1.5rem 0 3.5rem;
    border: 1.5px solid var(--input-border);
    border-radius: var(--pill);
    background: var(--input-bg);
    color: var(--text-input);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 400;
    outline: none;
    box-shadow:
        0 2px 6px rgba(15, 23, 42, 0.06),
        0 4px 14px rgba(15, 23, 42, 0.05);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    -webkit-appearance: none;
    appearance: none;
}

.input-wrap input::placeholder {
    color: var(--text-placeholder);
    font-weight: 400;
}

.input-wrap input:hover {
    box-shadow:
        0 2px 8px rgba(15, 23, 42, 0.08),
        0 6px 18px rgba(15, 23, 42, 0.07);
}

.input-wrap input:focus {
    border-color: var(--primary);
    box-shadow:
        0 0 0 3px var(--primary-ring),
        0 4px 14px rgba(255, 82, 29, 0.12);
}

.input-wrap input.invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:hover,
.input-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-input);
    -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
    caret-color: var(--text-input);
    transition: background-color 9999s ease-out 0s;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 1.3rem;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-icon);
    pointer-events: none;
    transition: color 0.18s ease;
}

.input-icon svg { width: 100%; height: 100%; display: block; }
.input-wrap:focus-within .input-icon { color: var(--primary); }

.toggle-password {
    position: absolute;
    top: 50%;
    right: 0.9rem;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: var(--text-icon);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.toggle-password:hover {
    color: var(--primary);
    background: rgba(255, 82, 29, 0.08);
}

.toggle-password:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.eye { width: 18px; height: 18px; display: block; }
.toggle-password .eye-hide { display: none; }
.toggle-password.is-visible .eye-show { display: none; }
.toggle-password.is-visible .eye-hide { display: block; }

.input-wrap:has(.toggle-password) input {
    padding-right: 3.25rem;
}

/* ═══════════════════════════════════════════════════
   BOTÃO ENTRAR
   ═══════════════════════════════════════════════════ */
.btn-login {
    width: 100%;
    height: 56px;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: var(--pill);
    background: var(--primary);
    color: #ffffff;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow:
        0 6px 16px rgba(255, 82, 29, 0.28),
        0 2px 4px rgba(255, 82, 29, 0.15);
    transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-login:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow:
        0 10px 24px rgba(255, 82, 29, 0.35),
        0 3px 6px rgba(255, 82, 29, 0.2);
}

.btn-login:active:not(:disabled) { transform: translateY(0); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-login:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.btn-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ═══════════════════════════════════════════════════
   MENSAGEM
   ═══════════════════════════════════════════════════ */
.message {
    position: fixed;
    left: 50%;
    bottom: 1.75rem;
    transform: translateX(-50%) translateY(12px);
    z-index: 100;
    display: inline-block;
    max-width: min(92vw, 480px);
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.18),
        0 2px 6px rgba(0, 0, 0, 0.10);
}

.message.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.message.error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: none;
}

/* IRPORTAL GLOBAL UI CONSISTENCY */
.btn-edit, .btn-delete, .btn-pdf, .btn-save-green, .cancel-close, .btn-new-order-header, .btn-duplicar-order-header, button.success, button.danger, input[type="checkbox"] + label { font-family: inherit; font-size: 14px; font-weight: 600; }
table:not(.items-table) thead th { background-color: #000 !important; color: #fff !important; }

/* ═══════════════════════════════════════════════════
   RESPONSIVIDADE
   ═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .login-header { padding: 1.5rem 1.75rem; }
    .login-header-left, .login-header-right { font-size: 0.88rem; }
    .login-header-left { max-width: 62%; }
}

@media (max-width: 720px) {
    .login-header { padding: 1.25rem 1.5rem; gap: 1rem; }
    .login-header-left { max-width: 58%; font-size: 0.8rem; }
    .login-header-right { font-size: 0.8rem; }
    .login-form { max-width: 340px; }
    .input-wrap input { height: 52px; font-size: 0.92rem; }
    .btn-login { height: 54px; font-size: 0.95rem; }
}

@media (max-width: 600px) {
    .login-header { padding: 1.25rem; gap: .75rem; align-items: center; }
    .login-header-left, .login-header-right { font-size: .8rem; }
    .login-company-logo { width: min(90%, 280px); max-height: 130px; margin: -0.25rem auto 1rem; }
    .login-identify { font-size: .72rem; margin-bottom: 1rem; }
}

@media (max-width: 520px) {
    .login-header { padding: 1rem 1.1rem; gap: 0.75rem; }
    .login-header-left { max-width: 60%; font-size: 0.7rem; line-height: 1.3; letter-spacing: 0; }
    .login-header-right { font-size: 0.7rem; }
    .login-body { padding: 1rem 1.1rem; }
    .login-form { max-width: 100%; }
    .input-wrap { margin-bottom: 0.95rem; }
    .input-wrap input { height: 50px; padding: 0 1.25rem 0 3.1rem; font-size: 0.9rem; }
    .input-icon { left: 1.1rem; width: 18px; height: 18px; }
    .input-wrap:has(.toggle-password) input { padding-right: 3rem; }
    .toggle-password { width: 32px; height: 32px; right: 0.7rem; }
    .eye { width: 17px; height: 17px; }
    .btn-login { height: 50px; font-size: 0.92rem; margin-top: 0.35rem; }
    .message { bottom: 1.1rem; padding: 11px 16px; font-size: 0.82rem; max-width: 94vw; }
}

@media (max-width: 380px) {
    .login-header-left, .login-header-right { font-size: 0.62rem; }
    .login-header { padding: 0.85rem 0.9rem; }
    .input-wrap input { height: 46px; font-size: 0.86rem; padding-left: 2.9rem; }
    .btn-login { height: 46px; font-size: 0.88rem; }
    .message { font-size: 0.78rem; padding: 10px 14px; }
    .login-company-logo { width: min(95%, 240px); max-height: 110px; }
}

@media (max-height: 640px) {
    .login-header { padding: 0.9rem 1.25rem; }
    .login-body { padding: 0.75rem 1.25rem; }
    .input-wrap { margin-bottom: 0.85rem; }
    .input-wrap input { height: 46px; }
    .btn-login { height: 48px; }
    .message { bottom: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
