/* ================================================================
   ATLAS SOFTWARE — Premium Design
   Aurora Glassmorphism Edition · 2025/2026
   ================================================================ */

/* ── CSS Houdini property for animated border ── */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ================================================================
   DESIGN TOKENS
   ================================================================ */
:root {
    --primary-color:  #007AFF;  /* overridden per merchant by JS */
    --bg:             #06060f;
    --surface:        rgba(6, 7, 18, 0.72);
    --text:           #ffffff;
    --text-muted:     rgba(255, 255, 255, 0.55);
    --text-faint:     rgba(255, 255, 255, 0.33);

    /* Atlas accent palette */
    --indigo:  #6366f1;
    --violet:  #8b5cf6;
    --cyan:    #06b6d4;
    --success: #22c55e;
    --error:   #ef4444;

    /* Radius scale */
    --r-wrap:  33px;
    --r-card:  32px;
    --r-input: 14px;
    --r-btn:   14px;
}

/* ================================================================
   RESET
   ================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

input, button, select, textarea {
    font-family: inherit;
}

/* ================================================================
   BASE
   ================================================================ */
html { height: 100%; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.5s ease;
}

/* ================================================================
   NOISE / GRAIN TEXTURE OVERLAY
   ================================================================ */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 300px 300px;
}

/* ================================================================
   AURORA BACKGROUND
   ================================================================ */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

/* Orb 1 — Indigo, top-left, large */
.orb-1 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle at center,
        rgba(99, 102, 241, 0.50) 0%,
        rgba(99, 102, 241, 0.12) 40%,
        transparent 70%);
    top: -300px;
    left: -250px;
    animation: drift-1 20s ease-in-out infinite alternate;
}

/* Orb 2 — Violet, top-right */
.orb-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle at center,
        rgba(139, 92, 246, 0.40) 0%,
        rgba(139, 92, 246, 0.08) 40%,
        transparent 70%);
    top: -150px;
    right: -150px;
    animation: drift-2 16s ease-in-out infinite alternate;
    animation-delay: -6s;
}

/* Orb 3 — Cyan, bottom-right */
.orb-3 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle at center,
        rgba(6, 182, 212, 0.28) 0%,
        rgba(6, 182, 212, 0.06) 40%,
        transparent 70%);
    bottom: -250px;
    right: -200px;
    animation: drift-3 22s ease-in-out infinite alternate;
    animation-delay: -11s;
}

/* Orb 4 — Blue, bottom-center */
.orb-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle at center,
        rgba(0, 122, 255, 0.25) 0%,
        rgba(0, 122, 255, 0.05) 40%,
        transparent 70%);
    bottom: -100px;
    left: 25%;
    animation: drift-1 18s ease-in-out infinite alternate;
    animation-delay: -9s;
}

@keyframes drift-1 {
    0%   { transform: translate(0, 0)        scale(1.00); }
    33%  { transform: translate(60px, 40px)  scale(1.08); }
    66%  { transform: translate(20px, 70px)  scale(0.97); }
    100% { transform: translate(-30px, 30px) scale(1.04); }
}

@keyframes drift-2 {
    0%   { transform: translate(0, 0)        scale(1.00); }
    40%  { transform: translate(-50px, 30px) scale(1.12); }
    80%  { transform: translate(30px, 55px)  scale(0.94); }
    100% { transform: translate(50px, -40px) scale(1.06); }
}

@keyframes drift-3 {
    0%   { transform: translate(0, 0)          scale(1.00); }
    30%  { transform: translate(-40px, -60px)  scale(1.08); }
    70%  { transform: translate(30px, -20px)   scale(0.93); }
    100% { transform: translate(50px, 50px)    scale(1.10); }
}

/* ================================================================
   GRID OVERLAY
   ================================================================ */
.grid-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 20%, transparent 85%);
    -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 50%, black 20%, transparent 85%);
}

/* ================================================================
   LAYOUT CONTAINER
   ================================================================ */
.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 460px;
    padding: 20px;
}

/* ================================================================
   CARD WRAPPER — Rotating gradient border
   ================================================================ */
.card-wrap {
    position: relative;
    border-radius: var(--r-wrap);
}

/* The animated conic-gradient border beam */
.card-wrap::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--r-wrap);
    background: conic-gradient(
        from var(--angle),
        rgba(255, 255, 255, 0.03) 0%,
        rgba(99,  102, 241, 0.65) 25%,
        rgba(139,  92, 246, 0.88) 40%,
        rgba(6,   182, 212, 0.65) 55%,
        rgba(255, 255, 255, 0.03) 75%
    );
    animation: border-spin 8s linear infinite;
    z-index: 0;
}

@keyframes border-spin {
    to { --angle: 360deg; }
}

/* ================================================================
   GLASS CARD
   ================================================================ */
.glass-card {
    position: relative;
    z-index: 1;
    background: var(--surface);
    backdrop-filter: blur(48px) saturate(200%);
    -webkit-backdrop-filter: blur(48px) saturate(200%);
    border-radius: var(--r-card);
    padding: 48px 40px;
    text-align: center;
    animation: card-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
    box-shadow:
        inset 0  1px 0 rgba(255, 255, 255, 0.10),
        inset 0 -1px 0 rgba(0,   0,   0,   0.22),
        0 32px 80px rgba(0, 0, 0, 0.60),
        0  8px 24px rgba(0, 0, 0, 0.40);
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.96);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* ================================================================
   LOADING CARD
   ================================================================ */
.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 40px;
}

.loader-large {
    display: block;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color:   var(--indigo);
    border-right-color: var(--violet);
    animation: spin 0.9s linear infinite;
    margin-bottom: 24px;
}

.loading-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ================================================================
   HOME CARD — Atlas Software
   ================================================================ */
.home-card {
    padding: 52px 44px;
}

/* Brand block */
.atlas-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin-bottom: 32px;
}

/* Logo container */
.atlas-logo-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ambient glow behind logo */
.atlas-logo-glow {
    position: absolute;
    inset: -24px;
    background: radial-gradient(circle,
        rgba(99, 102, 241, 0.55) 0%,
        rgba(139, 92, 246, 0.28) 45%,
        transparent 70%);
    border-radius: 50%;
    animation: glow-pulse 3.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes glow-pulse {
    from { opacity: 0.5; transform: scale(0.82); }
    to   { opacity: 1.0; transform: scale(1.18); }
}

/* Logo tile */
.atlas-logo {
    position: relative;
    z-index: 1;
    width: 84px;
    height: 84px;
    border-radius: 26px;
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #38bdf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: -2px;
    user-select: none;
    animation: float-logo 6s ease-in-out infinite;
    box-shadow:
        inset 0  1px 0 rgba(255, 255, 255, 0.36),
        inset 0 -1px 0 rgba(0,   0,   0,   0.14),
        0 20px 48px rgba(99, 102, 241, 0.55),
        0  8px 16px rgba(0,   0,   0,   0.30);
}

@keyframes float-logo {
    0%,  100% { transform: translateY(0)    rotate(-8deg); }
    25%        { transform: translateY(-5px) rotate(-9deg); }
    75%        { transform: translateY(-9px) rotate(-7deg); }
}

/* Brand text */
.atlas-brand-text {
    text-align: center;
}

.atlas-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    line-height: 1;
    color: var(--text);
}

.atlas-title .light {
    font-weight: 400;
    color: rgba(255, 255, 255, 0.55);
}

.atlas-tagline {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-top: 8px;
    background: linear-gradient(90deg, var(--indigo), var(--violet), var(--cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
    margin: 28px 0;
    border: none;
}

/* Body copy */
.description {
    font-size: 0.925rem;
    line-height: 1.75;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* Footer hint */
.footer-note {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.78rem;
    color: var(--text-faint);
    line-height: 1.65;
}

/* ================================================================
   MERCHANT HEADER (enrollment card)
   ================================================================ */
.merchant-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
}

#merchant-logo {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    margin-bottom: 16px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.97);
    padding: 10px;
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.06),
        0 8px 24px rgba(0, 0, 0, 0.40);
}

/* ================================================================
   TYPOGRAPHY
   ================================================================ */
h1 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.75px;
    line-height: 1.1;
    color: var(--text);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.65;
}

/* ================================================================
   FORM & INPUTS
   ================================================================ */
#enrollment-form {
    text-align: left;
}

.input-group {
    margin-bottom: 14px;
}

label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.58);
    margin-bottom: 8px;
}

.req {
    color: rgba(239, 68, 68, 0.75);
}

input {
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--r-input);
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.975rem;
    font-weight: 400;
    outline: none;
    transition:
        border-color 0.2s ease,
        background   0.2s ease,
        box-shadow   0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

input:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
}

input:focus {
    border-color: rgba(99, 102, 241, 0.65);
    background: rgba(99, 102, 241, 0.07);
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.27);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.glass-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px 24px;
    border: none;
    border-radius: var(--r-btn);
    background: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    text-decoration: none;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    transition:
        transform  0.2s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.30);
    -webkit-tap-highlight-color: transparent;
}

/* Shimmer sweep on hover */
.glass-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -80%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.18),
        transparent
    );
    transform: skewX(-15deg);
    transition: left 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top inner highlight */
.glass-btn::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 45%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.16), transparent);
    border-radius: var(--r-btn) var(--r-btn) 0 0;
    pointer-events: none;
}

.glass-btn:hover {
    transform: translateY(-2px);
}

.glass-btn:hover::before {
    left: 150%;
}

.glass-btn:active {
    transform: translateY(0) scale(0.99);
}

/* ── Home button: gradient override ── */
.home-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #0891b2 100%);
    box-shadow:
        0 8px 32px rgba(99, 102, 241, 0.48),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.home-btn:hover {
    box-shadow:
        0 12px 42px rgba(99, 102, 241, 0.62),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* Arrow icon inside home button */
.btn-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.glass-btn:hover .btn-arrow {
    transform: translateX(3px);
}

/* ── Secondary button (Retour) ── */
.glass-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 28px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition:
        background    0.2s ease,
        border-color  0.2s ease,
        transform     0.2s ease;
    margin-top: 16px;
    -webkit-tap-highlight-color: transparent;
}

.glass-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

/* ================================================================
   LOADERS
   ================================================================ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.30);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* ================================================================
   SUCCESS STATE
   ================================================================ */
.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.10);
    border: 1.5px solid rgba(34, 197, 94, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: pop-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    box-shadow: 0 0 28px rgba(34, 197, 94, 0.18);
}

.success-icon svg {
    width: 30px;
    height: 30px;
    stroke: #4ade80;
}

@keyframes pop-in {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1.0); opacity: 1; }
}

.success-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    color: var(--text);
}

.success-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ================================================================
   INLINE ERROR MESSAGE
   ================================================================ */
.error-msg {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.22);
    padding: 12px 16px;
    border-radius: 12px;
    margin-top: 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    text-align: left;
}

/* ================================================================
   NOT FOUND CARD
   ================================================================ */
.error-card {
    padding: 52px 40px;
}

.not-found-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.not-found-icon svg {
    width: 36px;
    height: 36px;
    stroke: rgba(255, 255, 255, 0.45);
}

.not-found-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    color: var(--text);
}

.not-found-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 480px) {
    .container {
        padding: 16px;
    }

    .glass-card {
        padding: 36px 28px;
    }

    .home-card {
        padding: 44px 32px;
    }

    .error-card {
        padding: 44px 32px;
    }

    .atlas-logo {
        width: 72px;
        height: 72px;
        font-size: 2.1rem;
        border-radius: 22px;
    }

    .atlas-title {
        font-size: 2.1rem;
    }
}

@media (max-width: 360px) {
    .glass-card {
        padding: 28px 20px;
        border-radius: 24px;
    }

    .card-wrap,
    .card-wrap::before {
        border-radius: 25px;
    }

    h1 {
        font-size: 1.65rem;
    }
}

/* ================================================================
   WALLET BUTTONS
   ================================================================ */
#wallet-buttons-container {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.wallet-badge {
    height: 50px;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.wallet-badge:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

#btn-generic-wallet {
    width: 100%;
}

.btn-loader-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.loader-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}
