/* ==========================================================================
   Plugin N4 Login Personalizado — Custom CSS (Responsive & Mobile-First)
   ========================================================================== */

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

/* ── Reset (aplicado somente na tela de login anônima) ── */
html:has(body.welcome-anonymous) {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
}

/* ── Background ── */
body.welcome-anonymous {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
    background: #010b1e !important;
    position: relative !important;
    -webkit-tap-highlight-color: transparent;
}

/* Fixed background image — always fills visible viewport, no bars */
body.welcome-anonymous::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    background: url('../pics/background.png') center center / cover no-repeat;
    pointer-events: none;
}

/* Completely hide original GLPI page layout so it takes 0 height in DOM flow */
body.welcome-anonymous main#page,
body.welcome-anonymous #page {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* ── Full-page overlay layout (injected by JS) ── */
#n4-layout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.n4-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
}

/* ── Header: logo ── */
.n4-pg-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 28px;
    pointer-events: all;
    background: linear-gradient(to bottom, rgba(1, 8, 22, 0.8) 0%, transparent 100%);
    box-sizing: border-box;
}

.n4-pg-logo-right {
    display: flex;
    align-items: center;
}

.n4-pg-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.n4-pg-brand {
    display: flex;
    flex-direction: column;
}

.n4-pg-brand-name {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 300;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.n4-pg-brand-name strong {
    font-weight: 900;
}

.n4-pg-brand-tag {
    font-size: clamp(0.55rem, 0.75vw, 0.68rem);
    color: #94a3b8;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-top: 2px;
}

.n4-pg-brand-tag em {
    color: #00bfff;
    font-style: normal;
    font-weight: 600;
}

.n4-logo-img {
    height: clamp(68px, 8vw, 120px);
    width: auto;
    display: block;
    object-fit: contain;
    transition: height 0.3s ease;
}

/* ── Main area ── */
.n4-pg-main {
    flex: 1 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    box-sizing: border-box;
    min-height: 0;
}

/* ── Left panel — service items ── */
.n4-pg-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 20px 0 clamp(24px, 3vw, 48px);
    gap: 12px;
    pointer-events: all;
    box-sizing: border-box;
}

.n4-service {
    display: flex;
    align-items: center;
    gap: 13px;
    background: rgba(0, 20, 60, 0.55);
    border: 1px solid rgba(0, 140, 255, 0.22);
    border-radius: 12px;
    padding: 11px 15px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: border-color 0.25s, background 0.25s, transform 0.2s;
    box-sizing: border-box;
    width: 280px;
    max-width: 100%;
}

.n4-service:hover {
    border-color: rgba(0, 170, 255, 0.5);
    background: rgba(0, 30, 80, 0.65);
    transform: translateY(-1px);
}

.n4-service-icon {
    color: #00aaff;
    flex-shrink: 0;
    margin-top: 2px;
    display: flex;
    align-items: center;
}

.n4-service-title {
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.4px;
    margin-bottom: 3px;
}

.n4-service-desc {
    font-size: clamp(0.68rem, 0.8vw, 0.78rem);
    color: #94a3b8;
    line-height: 1.45;
}

/* ── Center — GLPI card (perfeitamente centralizado no PC) ── */
.n4-pg-center {
    flex: 0 0 auto;
    width: min(420px, 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: all;
    box-sizing: border-box;
}

.n4-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: min(400px, 100%);
}

#n4-card-slot {
    width: min(400px, 100%);
    box-sizing: border-box;
    margin: 0 auto;
}

/* ── Right spacer (equilibra o lado esquerdo para manter o centro exato) ── */
.n4-pg-right {
    flex: 1;
}

/* ── Bottom bar ── */
.n4-pg-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    background: rgba(1, 10, 28, 0.92);
    border-top: 1px solid rgba(0, 140, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: all;
    box-sizing: border-box;
}

.n4-footer-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #cbd5e1 !important;
    text-decoration: none !important;
    font-size: clamp(0.72rem, 0.85vw, 0.84rem);
    padding: 5px 10px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
    white-space: nowrap;
    box-sizing: border-box;
}

.n4-footer-item svg {
    color: #00aaff;
    flex-shrink: 0;
}

.n4-footer-item:hover {
    color: #ffffff !important;
    background: rgba(0, 140, 255, 0.16);
}

.n4-footer-sep {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    user-select: none;
}

.n4-footer-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(0, 140, 255, 0.25);
}

.n4-footer-brand-wrap {
    display: flex;
    flex-direction: column;
}

.n4-footer-brand-name {
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    font-weight: 300;
    color: #ffffff;
    line-height: 1.1;
}

.n4-footer-brand-name strong {
    font-weight: 900;
}

.n4-footer-brand-tag {
    font-size: 0.52rem;
    color: #64748b;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.n4-footer-brand-tag em {
    color: #00bfff;
    font-style: normal;
}

/* ─────────────────────────────────────────────────────────────────────────
   LOGIN CARD (moved from GLPI into #n4-card-slot)
   ───────────────────────────────────────────────────────────────────────── */

/* Hide GLPI defaults inside the card */
#n4-card-slot .glpi-logo,
#n4-card-slot .text-center.text-muted,
#n4-card-slot .card-header h2,
#n4-card-slot .form-label,
#n4-card-slot .rich_text_container,
#n4-card-slot .col-auto {
    display: none !important;
}

/* Fix GLPI grid columns */
#n4-card-slot .row,
#n4-card-slot .col-md-5,
#n4-card-slot .col-md,
#n4-card-slot form {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 100% !important;
    box-sizing: border-box !important;
}

/* Card shell */
#n4-card-slot .main-content-card,
#n4-card-slot .card.card-md {
    background: rgba(3, 12, 32, 0.93) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    border: 1.5px solid #0088ee !important;
    border-radius: 18px !important;
    box-shadow: 0 0 32px rgba(0, 140, 255, 0.38), inset 0 0 20px rgba(0, 140, 255, 0.1) !important;
    padding: 24px 22px 20px !important;
    color: #ffffff !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    width: 100% !important;
}

#n4-card-slot .card-header,
#n4-card-slot .card-body {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Card header: title + subtitle */
.n4-login-header {
    text-align: center;
    margin-bottom: 18px;
    position: relative;
}

.n4-login-title {
    color: #00d2ff;
    font-size: clamp(0.88rem, 1.1vw, 1rem);
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    margin-bottom: 4px;
    cursor: pointer;
    user-select: none;
}

.n4-login-subtitle {
    color: #94a3b8;
    font-size: clamp(0.72rem, 0.85vw, 0.8rem);
    line-height: 1.4;
}

/* Botão secreto para equipe interna */
.n4-btn-secret {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s ease, color 0.25s ease, transform 0.25s ease;
    color: #4a6080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 4px;
    z-index: 10;
}

#n4-card-slot:hover .n4-btn-secret,
.n4-login-header:hover .n4-btn-secret {
    opacity: 0.18;
}

.n4-btn-secret:hover {
    opacity: 1 !important;
    color: #00d2ff !important;
    background: rgba(0, 140, 255, 0.15);
    transform: rotate(30deg);
}

.n4-btn-secret.active {
    opacity: 0.9 !important;
    color: #00d2ff !important;
}

/* Dropdown de autenticação (oculto para clientes, animado ao abrir) */
.n4-auth-container {
    animation: n4SlideDown 0.25s ease;
}

@keyframes n4SlideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input wrapper */
.n4-field {
    position: relative;
    margin-bottom: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.n4-field-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #4a6080;
    display: flex;
    align-items: center;
    z-index: 2;
    pointer-events: none;
    transition: color 0.25s;
}

.n4-field:focus-within .n4-field-icon {
    color: #00aaff;
}

.n4-field input.form-control {
    background: rgba(6, 20, 50, 0.88) !important;
    border: 1px solid #1a3a7a !important;
    border-radius: 9px !important;
    color: #ffffff !important;
    padding: 11px 40px 11px 40px !important;
    font-size: 0.9rem !important;
    height: 44px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: border-color 0.25s, box-shadow 0.25s !important;
    font-family: inherit !important;
}

.n4-field input.form-control:focus {
    border-color: #0099ff !important;
    box-shadow: 0 0 12px rgba(0, 153, 255, 0.45) !important;
    outline: none !important;
}

.n4-field input.form-control::placeholder {
    color: #4a6080 !important;
    opacity: 1 !important;
}

/* Eye toggle */
.n4-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #4a6080;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    z-index: 2;
    transition: color 0.2s;
    touch-action: manipulation;
}

.n4-eye:hover {
    color: #00aaff;
}

/* Auth dropdown */
.n4-select {
    background: rgba(6, 20, 50, 0.88) !important;
    border: 1px solid #1a3a7a !important;
    border-radius: 9px !important;
    color: #ffffff !important;
    padding: 10px 14px !important;
    font-size: 0.88rem !important;
    height: 44px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 12px !important;
    outline: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
}

.n4-select option {
    background: #050e26;
    color: #fff;
}

/* Options row: remember + forgot */
.n4-options {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin: 2px 0 14px !important;
    box-sizing: border-box !important;
    gap: 8px;
}

.n4-remember {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    color: #cbd5e1 !important;
    font-size: 0.82rem !important;
    user-select: none !important;
}

.n4-remember input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    background: rgba(6, 20, 50, 0.88) !important;
    border: 1px solid #0099ff !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    position: relative !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    transition: background 0.2s !important;
    touch-action: manipulation;
}

.n4-remember input[type="checkbox"]:checked {
    background: #0099ff !important;
}

.n4-remember input[type="checkbox"]:checked::after {
    content: '' !important;
    position: absolute !important;
    left: 5px !important;
    top: 2px !important;
    width: 4px !important;
    height: 8px !important;
    border: solid #fff !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
}

.n4-forgot {
    color: #00bfff !important;
    font-size: 0.82rem !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: color 0.2s !important;
    padding: 2px 0;
}

.n4-forgot:hover {
    color: #60d0ff !important;
    text-decoration: underline !important;
}

/* Submit button */
.n4-btn-submit {
    background: linear-gradient(135deg, #0099ff 0%, #0055dd 100%) !important;
    border: none !important;
    border-radius: 9px !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.92rem !important;
    letter-spacing: 2px !important;
    height: 44px !important;
    width: 100% !important;
    box-shadow: 0 0 20px rgba(0, 140, 255, 0.5) !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    margin-bottom: 14px !important;
    transition: all 0.3s !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    touch-action: manipulation;
}

.n4-btn-submit:hover {
    background: linear-gradient(135deg, #22aaff 0%, #0066ff 100%) !important;
    box-shadow: 0 0 28px rgba(0, 180, 255, 0.75) !important;
    transform: translateY(-1px) !important;
}

/* Card footer GLPI divider */
.n4-card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3a5070;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.n4-card-footer::before,
.n4-card-footer::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.n4-card-footer::before {
    margin-right: 12px;
}

.n4-card-footer::after {
    margin-left: 12px;
}

/* ─────────────────────────────────────────────────────────────────────────
   RESPONSIVE MEDIA QUERIES (TABLETS & MOBILE)
   ───────────────────────────────────────────────────────────────────────── */

/* ── Tablet & Small Laptops (max-width: 991px) ── */
@media screen and (max-width: 991px) {
    .n4-pg-main {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 12px 16px;
        gap: 16px;
    }

    .n4-pg-center {
        order: 1;
        flex: 0 0 auto;
        width: 100%;
        max-width: 420px;
    }

    .n4-pg-left {
        order: 2;
        flex: 0 0 auto;
        width: 100%;
        max-width: 600px;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .n4-service {
        width: 100%;
    }

    .n4-pg-right {
        display: none;
    }

    .n4-pg-header {
        justify-content: center;
        padding: 14px 20px 6px;
    }
}

/* ── Mobile Devices (max-width: 768px) ── */
@media screen and (max-width: 768px) {
    .n4-pg-header {
        padding: 14px 16px 4px;
        justify-content: center;
    }

    .n4-logo-img {
        height: 68px;
    }

    .n4-pg-main {
        padding: 8px 14px 20px;
        gap: 16px;
        justify-content: flex-start;
    }

    .n4-pg-left {
        grid-template-columns: 1fr;
        max-width: 380px;
        gap: 10px;
    }

    .n4-service {
        padding: 10px 12px;
        border-radius: 10px;
    }

    #n4-card-slot .main-content-card,
    #n4-card-slot .card.card-md {
        padding: 20px 16px 16px !important;
        border-radius: 14px !important;
    }

    .n4-login-header {
        margin-bottom: 14px;
    }

    .n4-login-title {
        font-size: 0.92rem;
    }

    .n4-login-subtitle {
        font-size: 0.78rem;
    }

    /* 16px font-size stops iOS auto-zoom on input focus */
    .n4-field input.form-control,
    .n4-select {
        font-size: 16px !important;
        height: 46px !important;
    }

    .n4-btn-submit {
        height: 46px !important;
        font-size: 0.95rem !important;
    }

    .n4-remember {
        font-size: 0.85rem !important;
    }

    .n4-forgot {
        font-size: 0.85rem !important;
    }

    .n4-pg-footer {
        flex-direction: column;
        padding: 12px 16px 16px;
        gap: 8px;
    }

    .n4-footer-sep {
        display: none !important;
    }

    .n4-footer-brand {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(0, 140, 255, 0.2);
        padding-top: 8px;
        margin-top: 4px;
        width: 100%;
        justify-content: center;
    }
}

/* ── Very Small Mobile Screens (max-width: 480px) ── */
@media screen and (max-width: 480px) {
    .n4-options {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 6px;
    }

    .n4-logo-img {
        height: 100px;
    }

    .n4-service-title {
        font-size: 0.78rem;
    }

    .n4-service-desc {
        font-size: 0.72rem;
    }
}