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

:root {
    --nl-primary: #69B345;
    --nl-primary-hover: #5a9e3a;
    --nl-primary-soft: #E8F5E0;
    --nl-primary-muted: #C8E6B8;
    --nl-bg: #F3F7F1;
    --nl-surface: #FFFFFF;
    --nl-border: #DCE5D8;
    --nl-border-focus: #69B345;
    --nl-text: #1F2937;
    --nl-text-secondary: #6B7280;
    --nl-danger: #DC2626;
    --nl-danger-bg: #FEF2F2;
    --nl-radius: 12px;
    --nl-radius-sm: 8px;
    --nl-shadow: 0 4px 24px rgba(31, 41, 55, 0.06), 0 1px 3px rgba(31, 41, 55, 0.04);
}

@font-face {
    font-family: My Segoeui;
    src: url(/lib/content/themes/coc/fonts/segoeui/segoeui.woff2) format('woff2'),
    url('/lib/content/themes/coc/fonts/segoeui/SegoeUI.woff') format('woff'),
    url('/lib/content/themes/coc/fonts/segoeui/segoeui.ttf') format('truetype'),
    url('/lib/lib/content/themes/coc/fonts/segoeui/SegoeUI.svg#svgFontName') format('svg');
    font-weight: normal;
}

@font-face {
    font-family: My Segoeui;
    src: url(/lib/content/themes/coc/fonts/segoeui/segoeuib.woff2) format('woff2'),
    url('/lib/content/themes/coc/fonts/segoeui/SegoeUI-Bold.woff') format('woff'),
    url('/lib/content/themes/coc/fonts/segoeui/segoeuib.ttf') format('truetype'),
    url('/lib/content/themes/coc/fonts/segoeui/SegoeUI-Bold.svg#svgFontName') format('svg');
    font-weight: bold;
}

@font-face {
    font-family: My Segoeui;
    src: url(/lib/content/themes/coc/fonts/segoeui/seguisb.woff2) format('woff2'),
    url('/lib/content/themes/coc/fonts/segoeui/SegoeUI-Semibold.woff') format('woff'),
    url('/lib/content/themes/coc/fonts/segoeui/seguisb.ttf') format('truetype'),
    url('/lib/content/themes/coc/fonts/segoeui/SegoeUI-Semibold.svg#svgFontName') format('svg');
    font-weight: 500;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body.login-page {
    position: relative;
    overflow-x: hidden;
    min-height: 100%;
    margin: 0;
    font-family: 'Be Vietnam Pro', 'My Segoeui', sans-serif;
    color: var(--nl-text);
    background-color: #EEF3EF;
    background-image:
        radial-gradient(ellipse 90% 70% at 50% 0%, rgba(105, 179, 69, 0.1), transparent 55%),
        linear-gradient(165deg, #E6EDE8 0%, #F3F7F1 48%, #E9F0EA 100%);
    -webkit-font-smoothing: antialiased;
}

/* ===== CNC-themed animated background ===== */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-bg__grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(70, 96, 78, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(70, 96, 78, 0.07) 1px, transparent 1px),
        linear-gradient(rgba(105, 179, 69, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(105, 179, 69, 0.12) 1px, transparent 1px);
    background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
    background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px;
    mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 20%, transparent 78%);
    animation: cnc-grid-drift 28s linear infinite;
}

.login-bg__scan {
    position: absolute;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(105, 179, 69, 0.05) 40%,
        rgba(105, 179, 69, 0.12) 50%,
        rgba(105, 179, 69, 0.05) 60%,
        transparent 100%
    );
    animation: cnc-scan 7.5s ease-in-out infinite;
}

.login-bg__bracket {
    position: absolute;
    width: 42px;
    height: 42px;
    border-color: rgba(105, 179, 69, 0.45);
    border-style: solid;
    border-width: 0;
    opacity: 0.7;
}

.login-bg__bracket--tl {
    top: 28px;
    left: 28px;
    border-top-width: 2px;
    border-left-width: 2px;
}

.login-bg__bracket--tr {
    top: 28px;
    right: 28px;
    border-top-width: 2px;
    border-right-width: 2px;
}

.login-bg__bracket--bl {
    bottom: 28px;
    left: 28px;
    border-bottom-width: 2px;
    border-left-width: 2px;
}

.login-bg__bracket--br {
    bottom: 28px;
    right: 28px;
    border-bottom-width: 2px;
    border-right-width: 2px;
}

.login-bg__spindle {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(105, 179, 69, 0.28);
}

.login-bg__spindle span {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(105, 179, 69, 0.16);
}

.login-bg__spindle span:nth-child(2) {
    inset: 18%;
    border-style: dashed;
    border-color: rgba(105, 179, 69, 0.28);
}

.login-bg__spindle span:nth-child(3) {
    inset: 36%;
    border-color: rgba(105, 179, 69, 0.35);
}

.login-bg__spindle--1 {
    width: 260px;
    height: 260px;
    top: 8%;
    right: 6%;
    animation: cnc-spindle-spin 22s linear infinite;
}

.login-bg__spindle--1::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: rgba(105, 179, 69, 0.55);
    box-shadow: 0 0 0 4px rgba(105, 179, 69, 0.12);
}

.login-bg__spindle--2 {
    width: 180px;
    height: 180px;
    bottom: 10%;
    left: 7%;
    animation: cnc-spindle-spin 18s linear infinite reverse;
}

.login-bg__toolpath {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.55;
}

.login-bg__toolpath-line {
    fill: none;
    stroke: rgba(105, 179, 69, 0.55);
    stroke-width: 2;
    stroke-linecap: square;
    stroke-linejoin: miter;
    stroke-dasharray: 14 10;
    animation: cnc-toolpath-dash 1.4s linear infinite;
}

.login-bg__toolpath-line--b {
    stroke: rgba(88, 122, 98, 0.35);
    stroke-width: 1.5;
    stroke-dasharray: 6 12;
    animation-duration: 2s;
    animation-direction: reverse;
}

.login-bg__tool-bit {
    fill: #69B345;
    stroke: #ffffff;
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px rgba(105, 179, 69, 0.65));
}

.login-bg__tool-bit--b {
    fill: #4F8A38;
    opacity: 0.85;
}

.login-bg__axis {
    position: absolute;
    left: 48px;
    bottom: 48px;
    width: 86px;
    height: 86px;
    border-left: 2px solid rgba(105, 179, 69, 0.5);
    border-bottom: 2px solid rgba(105, 179, 69, 0.5);
    opacity: 0.8;
}

.login-bg__axis::before,
.login-bg__axis::after {
    content: '';
    position: absolute;
    background: rgba(105, 179, 69, 0.5);
}

.login-bg__axis::before {
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 2px;
    transform: rotate(-35deg);
    transform-origin: right center;
}

.login-bg__axis::after {
    left: -1px;
    top: -1px;
    width: 2px;
    height: 10px;
    transform: rotate(-35deg);
    transform-origin: top center;
}

.login-bg__axis-label {
    position: absolute;
    right: -18px;
    bottom: -4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(79, 110, 86, 0.7);
}

.login-bg__axis-label--y {
    right: auto;
    left: -4px;
    bottom: auto;
    top: -18px;
}

.login-bg__readout {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    border: 1px solid rgba(105, 179, 69, 0.22);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(55, 78, 62, 0.75);
    box-shadow: 0 2px 10px rgba(31, 41, 55, 0.04);
}

.login-bg__readout .is-run {
    color: #69B345;
    animation: cnc-run-blink 1.6s ease-in-out infinite;
}

@keyframes cnc-grid-drift {
    from { background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px; }
    to { background-position: -1px 139px, 139px -1px, -1px 139px, 139px -1px; }
}

@keyframes cnc-scan {
    0% { top: -10%; opacity: 0; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { top: 95%; opacity: 0; }
}

@keyframes cnc-spindle-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes cnc-toolpath-dash {
    to { stroke-dashoffset: -48; }
}

@keyframes cnc-run-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.login-page .container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    width: 100%;
    max-width: 100%;
}

.box-login {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 0;
    animation: login-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes login-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

#login-logo {
    margin: 0 0 22px;
    text-align: center;
    animation: logo-fade 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

#login-logo > img {
    width: 280px;
    max-width: 92%;
    height: auto;
    display: inline-block;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

#login-form,
.login-form {
    margin: 0 auto;
    width: 100%;
    max-width: 420px;
    padding: 32px 28px 28px;
    color: var(--nl-text);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--nl-border);
    border-radius: var(--nl-radius);
    box-shadow: var(--nl-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: login-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

#login-form .form-group,
.login-form .form-group {
    margin-bottom: 18px;
}

#login-form label,
.login-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--nl-text-secondary);
}

#login-form input.form-control,
.login-form input.form-control {
    height: 44px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--nl-text);
    background: #FAFCFA;
    border: 1px solid var(--nl-border);
    border-radius: var(--nl-radius-sm);
    box-shadow: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.password-input-wrap {
    position: relative;
}

.password-input-wrap .form-control {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: var(--nl-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.password-toggle:hover,
.password-toggle:focus {
    color: var(--nl-primary);
    outline: none;
}

.password-toggle__icon {
    display: block;
    width: 20px;
    height: 20px;
}

.password-toggle__icon.is-hidden {
    display: none;
}

.password-toggle .fa {
    font-size: 16px;
}

#login-form input.form-control:hover,
.login-form input.form-control:hover {
    border-color: var(--nl-primary-muted);
}

#login-form input.form-control:focus,
.login-form input.form-control:focus {
    outline: none;
    background: #FFFFFF;
    border-color: var(--nl-border-focus);
    box-shadow: 0 0 0 3px rgba(105, 179, 69, 0.2);
}

.login-error {
    margin: 4px 0 8px;
    padding: 12px 14px;
    background: var(--nl-danger-bg);
    border: 1px solid #FECACA;
    border-radius: var(--nl-radius-sm);
    color: var(--nl-danger);
    font-size: 13px;
    line-height: 1.45;
}

.login-error strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.login-error ul {
    margin: 0;
    padding-left: 18px;
}

.login-error li {
    margin: 0;
}

#login-form .note,
.login-form .note {
    margin-top: 4px;
    margin-bottom: 4px;
    font-size: 14px;
    color: var(--nl-danger);
}

#login-form .alert-danger,
.login-form .alert-danger {
    margin: 0 0 8px;
    padding: 12px 14px;
    background: var(--nl-danger-bg);
    border: 1px solid #FECACA;
    border-radius: var(--nl-radius-sm);
    color: var(--nl-danger);
    font-size: 13px;
    line-height: 1.45;
}

#login-form .alert-danger strong,
.login-form .alert-danger strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

#login-form footer,
.login-form footer {
    margin-top: 18px;
}

.login-message {
    margin: 0 0 8px;
    text-align: center;
}

.login-message__title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--nl-text);
    line-height: 1.4;
}

.login-message__desc {
    margin: 0;
    font-size: 14px;
    color: var(--nl-text-secondary);
    line-height: 1.5;
}

.login-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.btn-login,
a.btn-login,
.btn-login-secondary,
a.btn-login-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 46px;
    padding: 0 16px;
    margin: 0;
    border-radius: var(--nl-radius-sm);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
}

.btn-login-secondary,
a.btn-login-secondary {
    border: 1px solid var(--nl-border);
    background-color: #FFFFFF;
    color: var(--nl-text);
    box-shadow: none;
    transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.btn-login-secondary:hover,
.btn-login-secondary:focus,
a.btn-login-secondary:hover,
a.btn-login-secondary:focus {
    color: var(--nl-primary);
    border-color: var(--nl-primary-muted);
    background-color: var(--nl-primary-soft);
    text-decoration: none;
    outline: none;
}

.btn-login,
a.btn-login {
    border: none;
    background-color: var(--nl-primary);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(105, 179, 69, 0.35);
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.btn-login:hover,
.btn-login:active,
.btn-login:focus {
    color: #FFFFFF;
    background-color: var(--nl-primary-hover);
    box-shadow: 0 4px 14px rgba(105, 179, 69, 0.4);
}

.btn-login:active {
    transform: translateY(1px);
}

.btn-login:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(105, 179, 69, 0.28), 0 4px 14px rgba(105, 179, 69, 0.35);
}

.grecaptcha-badge {
    visibility: hidden !important;
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .login-bg__grid,
    .login-bg__scan,
    .login-bg__spindle,
    .login-bg__toolpath-line,
    .login-bg__tool-bit,
    .login-bg__readout .is-run,
    .box-login,
    #login-logo,
    #login-form,
    .login-form {
        animation: none !important;
    }

    .login-bg__tool-bit animateMotion {
        display: none;
    }
}

@media (max-width: 500px) {
    #login-form,
    .login-form {
        padding: 28px 20px 24px;
    }

    #login-logo > img {
        width: 220px;
    }

    .login-bg__readout,
    .login-bg__axis,
    .login-bg__spindle--2 {
        display: none;
    }

    .login-bg__bracket {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 350px) {
    #login-logo > img {
        width: 180px;
    }
}
