/* ================================================================
   LOGIN PAGE — Splash Screen & Login Form
   Uses CSS custom properties from colors.css
   ================================================================ */

/* ---- Page-level resets for login ---- */
.cb-login-page,
.cb-login-page html,
.cb-login-page body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: var(--cb-font-family);
    background: var(--cb-primary-dark);
    color: var(--cb-text);
}

/* ================================================================
   PHASE 1 — SPLASH SCREEN
   ================================================================ */
.cb-splash-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: linear-gradient(160deg, #0f2e10 0%, var(--cb-primary-dark) 40%, #163a17 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-splash-screen.cb-splash-exit {
    opacity: 0;
    transform: scale(1.08);
    pointer-events: none;
}

/* Splash background particles canvas */
.cb-splash-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Concentric rings pulsing outward from logo */
.cb-splash-rings {
    position: absolute;
    z-index: 1;
    width: 300px;
    height: 300px;
}

.cb-splash-ring {
    position: absolute;
    inset: 0;
    border: 1.5px solid rgba(87, 185, 89, 0.15);
    border-radius: 50%;
    animation: cbSplashRingPulse 3s ease-out infinite;
}

.cb-splash-ring:nth-child(2) {
    animation-delay: 0.6s;
}

.cb-splash-ring:nth-child(3) {
    animation-delay: 1.2s;
}

.cb-splash-ring:nth-child(4) {
    animation-delay: 1.8s;
}

@keyframes cbSplashRingPulse {
    0% {
        transform: scale(0.3);
        opacity: 1;
    }

    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Logo container */
.cb-splash-logo-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* gap: 20px; */
}

.cb-splash-logo-box {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    background: var(--cb-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 0 rgba(87, 185, 89, 0.4),
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    opacity: 0;
    transform: scale(0.4) rotate(-8deg);
    animation:
        cbSplashLogoEnter 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s forwards,
        cbSplashLogoGlow 2.5s ease-in-out 1.5s infinite;
}

.cb-splash-logo-box img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

@keyframes cbSplashLogoEnter {
    0% {
        opacity: 0;
        transform: scale(0.4) rotate(-8deg);
    }

    60% {
        opacity: 1;
        transform: scale(1.05) rotate(1deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes cbSplashLogoGlow {

    0%,
    100% {
        box-shadow:
            0 0 0 0 rgba(87, 185, 89, 0.3),
            0 20px 60px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }

    50% {
        box-shadow:
            0 0 30px 8px rgba(87, 185, 89, 0.2),
            0 20px 60px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

/* Brand name — character-by-character reveal */
.cb-splash-brand {
    display: flex;
    gap: 2px;
    opacity: 0;
    animation: cbSplashFadeUp 0.6s ease 0.9s forwards;
}

.cb-splash-char {
    display: inline-block;
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(16px);
    animation: cbSplashCharReveal 0.4s ease forwards;
}

@keyframes cbSplashCharReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cbSplashFadeUp {
    to {
        opacity: 1;
    }
}

/* Tagline */
.cb-splash-tagline {
    font-size: var(--cb-font-size-sm);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    animation: cbSplashFadeUp 0.6s ease 1.8s forwards;
}

/* Progress bar */
.cb-splash-progress-wrap {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    z-index: 2;
    opacity: 0;
    animation: cbSplashFadeUp 0.5s ease 1.4s forwards;
}

.cb-splash-progress-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.cb-splash-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cb-secondary), var(--cb-secondary-light));
    border-radius: 4px;
    animation: cbSplashProgressFill 2s cubic-bezier(0.4, 0, 0.2, 1) 1.6s forwards;
    box-shadow: 0 0 12px rgba(87, 185, 89, 0.4);
}

@keyframes cbSplashProgressFill {
    0% {
        width: 0%;
    }

    30% {
        width: 45%;
    }

    60% {
        width: 72%;
    }

    100% {
        width: 100%;
    }
}

.cb-splash-progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Version text */
.cb-splash-version {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    font-weight: 400;
    z-index: 2;
    opacity: 0;
    animation: cbSplashFadeUp 0.5s ease 2s forwards;
}

/* ================================================================
   PHASE 2 — LOGIN SCREEN
   ================================================================ */
.cb-login-screen {
    position: fixed;
    inset: 0;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.cb-login-screen.cb-login-visible {
    opacity: 1;
}

/* Animated gradient background */
.cb-login-anim-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(-45deg,
            var(--cb-primary-dark),
            var(--cb-primary),
            #1a5c1b,
            var(--cb-secondary-dark),
            var(--cb-primary-dark));
    background-size: 400% 400%;
    animation: cbLoginGradientShift 15s ease infinite;
}

@keyframes cbLoginGradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Floating shapes */
.cb-login-floating-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.cb-login-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.cb-login-shape:nth-child(1) {
    width: 350px;
    height: 350px;
    top: -100px;
    right: -80px;
    animation: cbLoginFloatA 9s ease-in-out infinite;
}

.cb-login-shape:nth-child(2) {
    width: 250px;
    height: 250px;
    bottom: -60px;
    left: -60px;
    animation: cbLoginFloatB 11s ease-in-out infinite;
}

.cb-login-shape:nth-child(3) {
    width: 140px;
    height: 140px;
    top: 25%;
    left: 12%;
    animation: cbLoginFloatA 13s ease-in-out infinite reverse;
}

.cb-login-shape:nth-child(4) {
    width: 90px;
    height: 90px;
    bottom: 28%;
    right: 18%;
    animation: cbLoginFloatB 8s ease-in-out infinite;
}

.cb-login-shape:nth-child(5) {
    width: 60px;
    height: 60px;
    top: 15%;
    right: 30%;
    border-radius: 12px;
    animation: cbLoginFloatA 10s ease-in-out infinite 2s;
}

@keyframes cbLoginFloatA {

    0%,
    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }

    33% {
        transform: translate(20px, -25px) scale(1.04) rotate(5deg);
    }

    66% {
        transform: translate(-10px, 15px) scale(0.97) rotate(-3deg);
    }
}

@keyframes cbLoginFloatB {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(-18px, 22px) scale(0.95);
    }
}

/* Dot grid overlay */
.cb-login-dot-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
}

/* Centering wrapper */
.cb-login-center {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
}

/* Main login card */
.cb-login-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    background: var(--cb-surface);
    border-radius: 20px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.05),
        0 32px 80px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    max-width: 880px;
    width: 90vw;
    min-height: 540px;
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s;
}

.cb-login-container.cb-login-card-enter {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---- Left info panel ---- */
.cb-login-left {
    flex: 1;
    min-width: 280px;
    background: linear-gradient(160deg, var(--cb-primary), var(--cb-primary-dark));
    padding: 44px 36px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.cb-login-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.05;
    background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
    background-size: 22px 22px;
}

.cb-login-glow {
    position: absolute;
    bottom: -80px;
    left: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(87, 185, 89, 0.12);
    filter: blur(60px);
}

.cb-login-left-top {
    position: relative;
    z-index: 1;
}

.cb-login-left-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
}

.cb-login-logo-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 255);
    border-radius: var(--cb-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cb-login-logo-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.cb-login-left-logo span {
    color: #fff;
    font-weight: 900;
    font-size: var(--cb-font-size-3xl);
}

.cb-login-left h3 {
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.cb-login-desc {
    color: rgba(255, 255, 255, 255);
    font-size: var(--cb-font-size-sm);
    line-height: var(--cb-line-height-relaxed);
}

/* Features list */
.cb-login-features {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 32px;
}

.cb-login-feat {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 255);
    font-size: var(--cb-font-size-sm);
}

.cb-login-feat-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cb-login-feat-icon svg {
    width: 14px;
    height: 14px;
    color: var(--cb-secondary-light);
}

/* Social proof */
.cb-login-left-bottom {
    position: relative;
    z-index: 1;
}

.cb-login-avatars {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.cb-login-av {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2.5px solid var(--cb-primary-dark);
    margin-right: -10px;
    object-fit: cover;
    background: var(--cb-primary-100);
    transition: transform 0.2s ease;
}

.cb-login-av:last-child {
    margin-right: 0;
}

.cb-login-av:hover {
    transform: scale(1.15);
    z-index: 1;
}

.cb-login-social-proof {
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--cb-font-size-xs);
}

.cb-login-social-proof strong {
    color: var(--cb-secondary-light);
    font-weight: 600;
}

/* ---- Right form panel ---- */
.cb-login-right {
    flex: 1;
    min-width: 320px;
    padding: 48px 40px;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.cb-login-form-inner {
    width: 100%;
    max-width: 330px;
}

.cb-login-panel-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.cb-login-panel-logo img {
    max-width: 250px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.cb-login-form-inner h2 {
    font-size: var(--cb-font-size-xl);
    font-weight: 700;
    color: var(--cb-text);
    margin-bottom: 4px;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.5s ease;
}

.cb-login-form-sub {
    color: var(--cb-text-muted);
    font-size: var(--cb-font-size-sm);
    margin-bottom: 28px;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.5s ease 0.06s;
}

/* Staggered form field animations */
.cb-login-form-field {
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-login-form-field:nth-child(1) {
    transition-delay: 0.12s;
}

.cb-login-form-field:nth-child(2) {
    transition-delay: 0.18s;
}

.cb-login-form-field:nth-child(3) {
    transition-delay: 0.24s;
}

.cb-login-form-field:nth-child(4) {
    transition-delay: 0.30s;
}

.cb-login-form-field:nth-child(5) {
    transition-delay: 0.36s;
}

.cb-login-form-field:nth-child(6) {
    transition-delay: 0.42s;
}

.cb-login-form-field:nth-child(7) {
    transition-delay: 0.48s;
}

.cb-login-form-field:nth-child(8) {
    transition-delay: 0.54s;
}

.cb-login-form-inner.cb-login-reveal h2,
.cb-login-form-inner.cb-login-reveal .cb-login-form-sub,
.cb-login-form-inner.cb-login-reveal .cb-login-form-field {
    opacity: 1;
    transform: translateY(0);
}

/* Input groups */
.cb-login-input-group {
    position: relative;
    margin-bottom: 16px;
}

.cb-login-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1.5px solid var(--cb-border-dark);
    border-radius: var(--cb-radius-md);
    font-family: var(--cb-font-family);
    font-size: var(--cb-font-size-base);
    color: var(--cb-text);
    background: var(--cb-surface);
    transition: all var(--cb-transition-base);
    outline: none;
}

.cb-login-input[type="password"] {
    padding-right: 44px;
}

.cb-login-input:focus {
    border-color: var(--cb-primary);
    box-shadow: 0 0 0 3px rgba(42, 101, 43, 0.12);
}

.cb-login-input::placeholder {
    color: var(--cb-text-light);
}

.cb-login-input-icon {
    position: absolute;
    left: 14px;
    top: 23px;
    transform: translateY(-50%);
    color: var(--cb-text-light);
    width: 18px;
    height: 18px;
    transition: color var(--cb-transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-login-input-group:focus-within .cb-login-input-icon {
    color: var(--cb-primary);
}

/* Password toggle */
.cb-login-pw-toggle {
    position: absolute;
    right: 14px;
    top: 23px;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: var(--cb-text-light);
    transition: color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-login-pw-toggle:hover {
    color: var(--cb-text-muted);
}

/* Primary login button */
.cb-login-btn {
    width: 100%;
    padding: 13px 24px;
    border: none;
    border-radius: var(--cb-radius-md);
    font-family: var(--cb-font-family);
    font-size: var(--cb-font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--cb-transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--cb-primary-light), var(--cb-primary));
    color: #fff;
    box-shadow: 0 4px 14px rgba(42, 101, 43, 0.3);
    position: relative;
    overflow: hidden;
}

.cb-login-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--cb-primary), var(--cb-primary-dark));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cb-login-btn:hover {
    box-shadow: 0 6px 24px rgba(42, 101, 43, 0.4);
    transform: translateY(-1px);
}

.cb-login-btn:hover::after {
    opacity: 1;
}

.cb-login-btn:active {
    transform: translateY(0);
}

.cb-login-btn span,
.cb-login-btn svg {
    position: relative;
    z-index: 1;
}

/* Validation errors container */
.cb-login-errors {
    margin-bottom: 16px;
}

.cb-login-errors .alert {
    font-size: var(--cb-font-size-sm);
    padding: 10px 14px;
    border-radius: var(--cb-radius-md);
}

/* Status message */
.cb-login-status {
    margin-bottom: 16px;
    font-size: var(--cb-font-size-sm);
}

.cb-login-status-success {
    color: var(--cb-success);
    font-weight: var(--cb-font-weight-medium);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .cb-login-container {
        flex-direction: column;
        min-height: auto;
        max-height: 95vh;
        overflow-y: auto;
    }

    .cb-login-left {
        padding: 28px 24px;
        min-width: auto;
    }

    .cb-login-features {
        display: none;
    }

    .cb-login-left h3 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .cb-login-desc {
        font-size: 13px;
    }

    .cb-login-right {
        padding: 28px 24px;
        min-width: auto;
    }

    .cb-login-form-inner {
        max-width: 100%;
    }

    .cb-splash-logo-box {
        width: 80px;
        height: 80px;
        border-radius: 20px;
    }

    .cb-splash-logo-box img {
        width: 64px;
        height: 64px;
    }

    .cb-splash-char {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .cb-login-center {
        padding: 16px;
    }

    .cb-login-container {
        border-radius: 16px;
        min-height: auto;
    }

    .cb-login-left {
        padding: 24px 20px;
    }

    .cb-login-avatars {
        display: none;
    }

    .cb-login-right {
        padding: 24px 20px;
    }

    .cb-splash-rings {
        width: 200px;
        height: 200px;
    }

    .cb-splash-progress-wrap {
        bottom: 60px;
        width: 160px;
    }
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {

    .cb-splash-screen,
    .cb-splash-ring,
    .cb-splash-logo-box,
    .cb-splash-brand,
    .cb-splash-char,
    .cb-splash-tagline,
    .cb-splash-progress-wrap,
    .cb-splash-progress-bar,
    .cb-splash-version,
    .cb-login-screen,
    .cb-login-container,
    .cb-login-anim-bg,
    .cb-login-shape,
    .cb-login-form-inner h2,
    .cb-login-form-inner .cb-login-form-sub,
    .cb-login-form-field {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
