/* =====================================================================
   Login page — Garments Mantra "Manufacturing Studio" design.
   Layout = null page (see Views/Home/Index.cshtml), so this file owns the
   entire visual language rather than plugging into the app shell's tokens.
   Organized: Variables / Layout & background / Garment icons / Card /
   Fields / Checkbox / Buttons / Toast / Animations / Responsive.
   ===================================================================== */

/* ---------- Variables ---------- */
:root {
    --navy-950: #1C4F60;
    --navy-900: #256074;
    --navy-800: #2C7288;
    --teal-700: #2597B0;
    --teal-500: #33AECC;
    --sky: #55CBF3;
    --gold: #F2D073;
    --gold-dim: #DEBB57;
    --ink: #FBFDFE;
    --muted: rgba(251, 253, 254, 0.68);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body.login-page {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    margin: 0;
    background:
        radial-gradient(120% 90% at 15% 10%, rgba(85, 203, 243, 0.16), transparent 55%),
        radial-gradient(100% 80% at 90% 85%, rgba(242, 208, 115, 0.18), transparent 55%),
        linear-gradient(160deg, #F4EFE3 0%, #ECE4D2 50%, #F1EAD9 100%);
}

@media (prefers-reduced-motion: reduce) {
    .login-page * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Layout & background ---------- */

.login-page .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
}

.login-page .blob-1 {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, var(--sky), transparent 70%);
    top: -120px;
    left: -100px;
    opacity: 0.35;
    animation: login-drift1 22s ease-in-out infinite;
}

.login-page .blob-2 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, var(--gold), transparent 70%);
    bottom: -140px;
    right: -90px;
    opacity: 0.3;
    animation: login-drift2 26s ease-in-out infinite;
}

.login-page .blob-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--teal-500), transparent 70%);
    top: 40%;
    right: 10%;
    opacity: 0.2;
    animation: login-drift3 30s ease-in-out infinite;
}

.login-page .grain {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.05;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.login-page .pattern-ring {
    position: absolute;
    z-index: 1;
    width: 580px;
    height: 580px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px dashed rgba(37, 151, 176, 0.28);
    animation: login-spin 110s linear infinite;
}

.login-page .pattern-ring::before {
    content: "";
    position: absolute;
    inset: 34px;
    border-radius: 50%;
    border: 1px dashed rgba(222, 187, 87, 0.34);
}

.login-page .pattern-ring::after {
    content: "";
    position: absolute;
    inset: 68px;
    border-radius: 50%;
    border: 1px dashed rgba(37, 151, 176, 0.2);
}

/* ---------- Garment icons (decorative, replaces the old solid "chip" divs) ---------- */

.login-page .garment {
    position: absolute;
    z-index: 1;
    animation: login-float 9s ease-in-out infinite;
}

.login-page .garment svg {
    width: 100%;
    height: 100%;
    display: block;
}

.login-page .g-shirt { width: 40px; height: 40px; top: 13%; left: 11%; color: var(--gold-dim); animation-delay: 0s; }
.login-page .g-thread { width: 30px; height: 30px; top: 20%; right: 14%; color: var(--teal-700); animation-delay: 1.2s; }
.login-page .g-scissors { width: 32px; height: 32px; bottom: 17%; left: 8%; color: var(--navy-900); opacity: 0.5; animation-delay: 2.4s; }
.login-page .g-hanger { width: 34px; height: 34px; bottom: 24%; right: 10%; color: var(--teal-500); opacity: 0.5; animation-delay: 0.8s; }
.login-page .g-tape { width: 28px; height: 28px; top: 8%; right: 30%; color: var(--gold-dim); opacity: 0.55; animation-delay: 1.8s; }

/* ---------- Card ---------- */

.login-page .card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 410px;
    padding: 44px 40px 36px;
    border-radius: 20px;
    background: linear-gradient(175deg, rgba(44, 114, 136, 0.97), rgba(28, 79, 96, 0.97));
    border: 1px solid rgba(85, 203, 243, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 30px 70px -25px rgba(0, 0, 0, 0.5), 0 2px 0 rgba(85, 203, 243, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login-page .card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(85, 203, 243, 0.55), transparent);
}

.login-page .badge {
    width: 104px;
    height: 104px;
    margin: 0 auto 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(160deg, #ffffff, #eef7fb);
    box-shadow: 0 0 0 6px rgba(63, 188, 232, 0.1), 0 0 34px rgba(63, 188, 232, 0.28), 0 12px 28px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden; /* without this, a flex child img can render past the circular boundary
                          even with width/height:100% set on it — flex items default to
                          min-width:auto, which for an <img> resolves to its intrinsic size
                          (e.g. gm-brand.png's real 1024x1024), not 0, so a large source image
                          can overflow its 100% box instead of shrinking to fit. */
}

.login-page .badge span {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 30px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--teal-700), var(--navy-900));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-page .badge img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    border-radius: 50%;
    padding: 14px;
    box-sizing: border-box;
}

.login-page .brand-sub {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3.5px;
    text-transform: uppercase;
    color: var(--teal-700);
    margin-bottom: 28px;
}

.login-page .stitch-divider {
    border: none;
    border-top: 1.5px dashed rgba(234, 243, 245, 0.16);
    margin: 24px 0 18px;
}

.login-page .foot-note {
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}

.login-page .foot-note .foot-link {
    color: var(--gold);
    font-weight: 600;
}

/* ---------- Fields (re-themes the shared ui-field / ui-field-box components) ---------- */

.login-page .login-box {
    --ui-accent: var(--sky);
    --ui-accent-hover: var(--teal-500);
    --ui-accent-active: var(--teal-700);
    --ui-ring: rgba(63, 188, 232, 0.16);
    --ui-border: rgba(255, 255, 255, 0.14);
    --ui-border-hover: rgba(255, 255, 255, 0.28);
    --ui-label: rgba(234, 243, 245, 0.55);
    --ui-helper: var(--gold-dim);
    --ui-text: var(--ink);
}

.login-page .login-box .ui-field {
    margin-bottom: 20px;
}

.login-page .login-box .ui-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.login-page .login-box .ui-field-box {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-page .login-box .ui-field-box:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.login-page .login-box .ui-field-box:focus-within {
    background: rgba(63, 188, 232, 0.1);
    border-color: rgba(85, 203, 243, 0.55);
    box-shadow: 0 0 0 4px rgba(63, 188, 232, 0.16);
}

.login-page .login-box .ui-input {
    color: var(--ink);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    padding: 13px 12px 13px 0;
    caret-color: var(--sky);
}

.login-page .login-box .ui-input::placeholder {
    color: rgba(234, 243, 245, 0.32);
}

/* Neutralize the browser's autofill styling (Chrome/Edge force a white/yellow
   background + black text on autofilled inputs, ignoring normal CSS) so only
   the entered text renders — the field-box itself stays translucent/dark. */
.login-page .login-box .ui-input:-webkit-autofill,
.login-page .login-box .ui-input:-webkit-autofill:hover,
.login-page .login-box .ui-input:-webkit-autofill:focus,
.login-page .login-box .ui-input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--ink) !important;
    caret-color: var(--sky) !important;
    box-shadow: 0 0 0 1000px rgba(37, 91, 110, 0.98) inset !important;
    -webkit-box-shadow: 0 0 0 1000px rgba(37, 91, 110, 0.98) inset !important;
    transition: background-color 9999s ease-in-out 0s;
    font-family: 'Space Grotesk', sans-serif;
}

.login-page .login-box .ui-field-icon {
    color: var(--sky);
    font-size: 13px;
}

.login-page .login-box .ui-field-toggle {
    color: rgba(234, 243, 245, 0.45);
}

.login-page .login-box .ui-field-toggle:hover {
    color: var(--sky);
}

/* ---------- Checkbox / row (re-themes the shared ui-checkbox component) ---------- */

.login-page .login-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 26px;
}

.login-page .login-row .ui-checkbox {
    font-size: 12.5px;
    color: var(--muted);
}

.login-page .login-row .ui-checkbox input[type="checkbox"] {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(234, 243, 245, 0.32);
}

.login-page .login-row .ui-checkbox input[type="checkbox"]:hover {
    border-color: rgba(85, 203, 243, 0.6);
}

.login-page .login-row .ui-checkbox input[type="checkbox"]:checked {
    background-color: var(--sky);
    border-color: var(--sky);
    box-shadow: 0 0 0 3px rgba(85, 203, 243, 0.18);
}

.login-page .forgot-link {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--sky);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.login-page .forgot-link:hover {
    color: var(--teal-500);
    border-color: currentColor;
}

/* ---------- Buttons (re-themes the shared ui-btn component) ---------- */

.login-page .login-box .ui-btn-primary {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    background: linear-gradient(100deg, var(--teal-700), var(--sky) 55%, var(--gold) 130%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.4px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 10px 22px -10px rgba(63, 188, 232, 0.5);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
}

.login-page .login-box .ui-btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
}

.login-page .login-box .ui-btn-primary:hover::before {
    left: 130%;
}

.login-page .login-box .ui-btn-primary:hover {
    box-shadow: 0 16px 30px -10px rgba(63, 188, 232, 0.55);
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.login-page .login-box .ui-btn-primary:active {
    transform: translateY(0);
    filter: brightness(0.98);
}

/* ---------- Toast (error feedback — logic untouched, visuals fit the new theme) ---------- */

.login-page .phx-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 320px;
    max-width: 380px;
    background: #b3261e;
    color: #fff;
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    animation: login-toast-in 0.3s ease;
}

.login-page .phx-toast-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.login-page .phx-toast-msg {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    flex: 1;
}

.login-page .phx-toast-close {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.login-page .phx-toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.login-page .phx-toast-hide {
    animation: login-toast-out 0.3s ease forwards;
}

/* ---------- Animations ---------- */

@keyframes login-drift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, 50px) scale(1.1); }
}

@keyframes login-drift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-50px, -40px) scale(1.08); }
}

@keyframes login-drift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, 30px) scale(0.95); }
}

@keyframes login-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes login-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-16px) rotate(6deg); }
}

@keyframes login-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes login-toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
    .login-page .card {
        padding: 34px 26px 28px;
    }

    .login-page .pattern-ring {
        width: 400px;
        height: 400px;
    }
}
