/*
 * Nippon mGrant login.
 *
 * Two panes: hero left (60%), white auth panel right (40%). The hero is a
 * gradient with a red glow from the lower left, one SDG badge top-left, the
 * programme headline bottom-left and the brand mark top-right on a white chip.
 *
 * ZERO hex literals in this file: every colour is a var(--*) from
 * design_tokens.css. scripts/validate_fixtures.py scans public/css/*.css
 * except design_tokens.css. login.html and templates/login/login.js bind to
 * the .nip-* class names.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; font-family: 'DM Sans', sans-serif; background: var(--nip-ink); }

.nip-page-wrapper { height: 100vh; display: flex; }

/* ═══════════════════════════════════════════
   LEFT PANEL — 60% (gradient hero)
   ═══════════════════════════════════════════ */
.nip-left { width: 60%; position: relative; overflow: hidden; background: var(--hero-grad); flex-shrink: 0; }
.nip-left::before { content: ""; position: absolute; inset: 0; z-index: 0; background: radial-gradient(120% 70% at 0% 100%, var(--hero-glow) 0%, transparent 60%); }
.nip-left::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(to bottom, var(--hero-ov-top) 0%, var(--hero-ov-upper) 28%, var(--hero-ov-mid) 62%, var(--hero-ov-foot) 100%); }

/* Single slide; carousel plumbing stays inert with one slide */
.nip-slide { position: absolute; inset: 0; opacity: 0; z-index: 1; transition: opacity 1.6s ease; }
.nip-slide.active { opacity: 1; }

/* CSR programme headline — bottom-left */
.nip-slide-text { position: absolute; bottom: 80px; left: 48px; right: 48px; z-index: 3; color: var(--text-on-dark); opacity: 0; transform: translateY(14px); transition: opacity 0.9s ease 0.4s, transform 0.9s ease 0.4s; }
.nip-slide.active .nip-slide-text { opacity: 1; transform: translateY(0); }
.nip-slide-eyebrow { font-size: 10px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; margin-bottom: 12px; color: var(--text-on-dark-muted); display: flex; align-items: center; gap: 10px; }
.nip-slide-eyebrow::before { content: ""; width: 26px; height: 3px; background: var(--nip-red); border-radius: 2px; }
.nip-slide-headline { font-size: 25px; font-weight: 300; line-height: 1.35; letter-spacing: -0.2px; max-width: 460px; margin-top: 0; margin-bottom: 10px; color: var(--text-on-dark); }
.nip-slide-headline strong { font-weight: 600; }
.nip-slide-desc { font-size: 12.5px; line-height: 1.55; max-width: 430px; color: var(--text-on-dark-muted); }
.nip-slide-desc strong { color: var(--text-on-dark); font-weight: 600; }

/* SDG badge, top-left (single official UN pictogram) */
.nip-sdg-badge { position: absolute; top: 36px; left: 48px; z-index: 5; display: flex; align-items: center; gap: 12px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45)); }
.nip-sdg-badge img { width: 48px; height: 48px; border-radius: 6px; display: block; }
.nip-sdg-badge .nip-sdg-meta { color: var(--text-on-dark); line-height: 1.2; }
.nip-sdg-badge .nip-sdg-eyebrow { font-size: 9.5px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--text-on-dark-muted); }
.nip-sdg-badge .nip-sdg-goal { font-size: 13px; font-weight: 700; color: var(--text-on-dark); }

/* Brand mark, top-right, on a white chip */
.nip-hero-brand { position: absolute; top: 30px; right: 40px; z-index: 5; background: var(--surface-0); border-radius: 8px; padding: 8px 14px; box-shadow: var(--shadow-sm); }
.nip-hero-brand img { height: 26px; width: auto; display: block; }

/* Static chrome (progress segments retained from carousel framework) */
.nip-left-chrome { position: relative; z-index: 4; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 36px 48px; pointer-events: none; }
.nip-left-chrome .nip-pr-seg { pointer-events: auto; }
.nip-left-bottom { display: flex; justify-content: space-between; align-items: flex-end; }

/* Progress bar */
.nip-progress { display: flex; gap: 5px; }
.nip-pr-seg { width: 46px; height: 2px; background: var(--hero-progress-track); border-radius: 1px; overflow: hidden; cursor: pointer; pointer-events: auto; }
.nip-pr-fill { height: 100%; width: 0%; background: var(--hero-progress-fill); border-radius: 1px; }
.nip-pr-seg.active .nip-pr-fill { animation: nip-prfill 7s linear forwards; }
.nip-pr-seg.active { } /* active tint applied via fill below */
.nip-pr-seg.active .nip-pr-fill { background: var(--nip-red); }
@keyframes nip-prfill { 0% { width: 0%; } 100% { width: 100%; } }

/* ═══════════════════════════════════════════
   RIGHT PANEL — 40% (auth)
   ═══════════════════════════════════════════ */
.nip-right {
    width: 40%; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: var(--surface-0); position: relative; padding: 24px 24px 56px;
}
.nip-auth { width: 100%; max-width: 360px; }

/* Brand logo, right panel, above the heading */
.nip-right-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.nip-right-logo img { height: 46px; width: auto; max-width: 300px; object-fit: contain; }

/* Page title */
.nip-page-title { text-align: center; margin-bottom: 26px; }
.nip-page-title h1 { font-size: 25px; font-weight: 700; color: var(--auth-title); letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 6px; }
.nip-page-title p { font-size: 13px; color: var(--auth-subtitle); font-weight: 400; }

/* Field labels */
.nip-field-label { display: block; font-size: 12px; font-weight: 600; color: var(--auth-title); margin-bottom: 5px; letter-spacing: 0.01em; }

/* Icon-inside inputs */
.nip-input-wrap { position: relative; display: flex; align-items: center; margin-bottom: 14px; }
.nip-input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--field-icon); pointer-events: none; display: flex; }
.nip-input-icon svg { width: 15px; height: 15px; }

.nip-login-box input,
.nip-forgot-box input,
.form-login-with-email-link input {
    width: 100%; height: 44px; padding: 0 42px;
    border: 1.5px solid var(--field-border); border-radius: 8px;
    font-size: 13px; font-family: 'DM Sans', sans-serif;
    color: var(--field-text); background: var(--field-bg); outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.nip-login-box input:focus,
.nip-forgot-box input:focus,
.form-login-with-email-link input:focus {
    border-color: var(--nip-red); background: var(--surface-0);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.nip-login-box input::placeholder,
.nip-forgot-box input::placeholder,
.form-login-with-email-link input::placeholder { color: var(--field-placeholder); }
.nip-login-box input:-webkit-autofill,
.nip-login-box input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--autofill-fill) inset; -webkit-text-fill-color: var(--field-text); }

/* Password toggle */
.frappe-toggle-hidden { display: none !important; }
.eye-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--field-icon); padding: 0; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; transition: color 0.2s; }
.eye-toggle:hover { color: var(--nip-red); }
.eye-toggle svg { width: 15px; height: 15px; pointer-events: none; }
.eye-toggle .icon-eye-off { display: none; }
.eye-toggle.active .icon-eye { display: none; }
.eye-toggle.active .icon-eye-off { display: block; }

/* Forgot password — right-aligned */
.nip-forgot-link { text-align: right; margin-top: -4px; margin-bottom: 18px; }
.nip-forgot-link a { font-size: 12px; color: var(--nip-red); text-decoration: none; font-weight: 500; }
.nip-forgot-link a:hover { color: var(--nip-red-hover); text-decoration: underline; }

/* Sign In button */
.login-btn { width: 100%; height: 46px; background: var(--nip-red); border: none; border-radius: 8px; color: var(--text-on-dark); font-size: 14px; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: background 0.15s, transform 0.1s; letter-spacing: 0.01em; }
.login-btn:hover { background: var(--nip-red-hover); }
.login-btn:active { transform: scale(0.99); }

.btn-ldap-login { width: 100%; height: 44px; background: var(--surface-0); border: 1.5px solid var(--field-border); border-radius: 8px; color: var(--field-text); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; margin-top: 8px; font-family: 'DM Sans', sans-serif; }
.btn-ldap-login:hover { border-color: var(--nip-red); background: var(--sso-hover-bg); }

/* OR divider */
.or-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; }
.or-divider .line { flex: 1; height: 1px; background: var(--divider-line); }
.or-divider span { font-size: 11px; color: var(--field-placeholder); white-space: nowrap; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500; }

/* SSO buttons — full-width stacked */
.social-login { display: flex; flex-direction: column; gap: 10px; }
.social-btn { width: 100%; height: 44px; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface-0); border: 1.5px solid var(--field-border); border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--field-text); font-family: 'DM Sans', sans-serif; cursor: pointer; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.social-btn:hover { border-color: var(--nip-red); background: var(--sso-hover-bg); }
.social-btn .sso-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.social-btn .sso-icon img,
.social-btn .sso-icon svg { width: 20px; height: 20px; }
.social-btn p { margin: 0; line-height: 1; }

/* Office 365 SSO glyph (Microsoft brand quadrants — vendor-owned colours) */
.nip-o365 { width: 18px; height: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5px; }
.nip-o365 i { display: block; border-radius: 1px; }
.nip-o365 i:nth-child(1) { background: var(--o365-red); }
.nip-o365 i:nth-child(2) { background: var(--o365-green); }
.nip-o365 i:nth-child(3) { background: var(--o365-blue); }
.nip-o365 i:nth-child(4) { background: var(--o365-yellow); }

/* Footer block: the only absolutely positioned footer element, with the
   powered-by row above the copyright row in normal flow, so they never overlap. */
.nip-footer-block { position: absolute; bottom: 16px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* Powered by — top row of the footer block */
.nip-powered { display: flex; align-items: center; justify-content: center; gap: 8px; }
.nip-powered > span { font-size: 11px; color: var(--field-icon); font-weight: 400; letter-spacing: 0.02em; }
.nip-powered .mgrant-logo { height: 18px; width: auto; object-fit: contain; opacity: 0.85; }
.nip-powered b { font-size: 13px; color: var(--auth-subtitle); font-weight: 700; letter-spacing: -.2px; }

/* Copyright, bottom row of the footer block */
.nip-footer-copy { text-align: center; }
.nip-footer-copy span { font-size: 10px; color: var(--field-icon); letter-spacing: 0.02em; }

/* Frappe state containers */
.nip-container { display: flex; width: 100%; height: 100%; }
.nip-container[style*="display: block"],
.nip-container[style*="display:block"] { display: flex !important; }
.nip-container.forgot-box,
.nip-container.for-login-with-email-link { display: none; }

/* Back link used in forgot / email-link panels */
.forgot { text-align: center; margin-top: 10px; }
.forgot a { font-size: 12px; color: var(--nip-red); text-decoration: none; font-weight: 500; }
.forgot a:hover { color: var(--nip-red-hover); text-decoration: underline; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (min-width: 1600px) {
    .nip-page-title h1 { font-size: 30px; }
    .nip-auth { max-width: 400px; }
    .nip-right-logo img { height: 52px; }
    .nip-slide-headline { font-size: 28px; }
}
@media (max-width: 1200px) {
    .nip-left { width: 55%; }
    .nip-right { width: 45%; }
}
@media (max-width: 1024px) {
    .nip-left { width: 50%; }
    .nip-right { width: 50%; }
    .nip-slide-headline { font-size: 20px; }
    .nip-slide-text { left: 32px; right: 32px; }
    .nip-sdg-badge { top: 28px; left: 32px; }
    .nip-hero-brand { top: 24px; right: 32px; }
    .nip-left-chrome { padding: 28px 32px; }
}
@media (max-width: 860px) {
    .nip-page-wrapper { flex-direction: column; }
    .nip-left { width: 100%; height: 38vh; min-height: 260px; flex-shrink: 0; }
    .nip-right { width: 100%; flex: 1; overflow-y: auto; }
    .nip-slide-desc { display: none; }
    .nip-left-chrome { padding: 24px; }
    .nip-slide-text { left: 24px; right: 24px; bottom: 56px; }
    .nip-sdg-badge { top: 20px; left: 24px; }
    .nip-hero-brand { top: 18px; right: 24px; }
}
@media (max-height: 700px) {
    .nip-page-title { margin-bottom: 16px; }
    .nip-input-wrap { margin-bottom: 10px; }
    .nip-login-box input,
    .nip-forgot-box input,
    .form-login-with-email-link input { height: 40px; }
    .login-btn { height: 42px; }
    .social-btn { height: 40px; }
    .or-divider { margin: 12px 0 10px; }
    .nip-page-title h1 { font-size: 22px; }
}
@media (max-height: 600px) {
    .nip-page-title p { display: none; }
    .nip-footer-block { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
