/* ===== DigiByte Wallet — Light/Dark Theme ===== */

/* Self-hosted Inter variable font */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove link underlines from NavLink */
a { text-decoration: none; color: inherit; }

/* ===== Animations ===== */

/* Navigation progress bar */
@keyframes navpulse {
    0%   { width: 20%; margin-left: 0; }
    50%  { width: 50%; margin-left: 25%; }
    100% { width: 20%; margin-left: 80%; }
}

/* Page entrance — fade + slide up */
@keyframes page-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.page-enter {
    animation: page-enter 0.3s ease both;
}

/* Fade in */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.fade-in           { animation: fade-in 0.4s ease both; }
.fade-in-delay-1   { animation: fade-in 0.4s ease 0.08s both; }
.fade-in-delay-2   { animation: fade-in 0.4s ease 0.16s both; }
.fade-in-delay-3   { animation: fade-in 0.4s ease 0.24s both; }
.fade-in-delay-4   { animation: fade-in 0.4s ease 0.32s both; }

/* Slide up + fade (staggered children) */
@keyframes slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.slide-up           { animation: slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both; }
.slide-up-delay-1   { animation: slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both; }
.slide-up-delay-2   { animation: slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both; }
.slide-up-delay-3   { animation: slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both; }
.slide-up-delay-4   { animation: slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both; }
.slide-up-delay-5   { animation: slide-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.30s both; }

/* Scale in (for cards) */
@keyframes scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
.scale-in           { animation: scale-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }
.scale-in-delay-1   { animation: scale-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
.scale-in-delay-2   { animation: scale-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both; }

/* Modal backdrop + sheet */
@keyframes backdrop-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes sheet-up {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
}
.backdrop-enter { animation: backdrop-in 0.3s ease both; }
.sheet-enter    { animation: sheet-up 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Unified modal overlay — covers full viewport regardless of parent container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 8, 20, 0.75);
    -webkit-backdrop-filter: blur(16px) saturate(130%);
    backdrop-filter: blur(16px) saturate(130%);
    animation: backdrop-in 0.3s ease both;
}
.modal-card {
    width: 100%;
    max-width: 380px;
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.05);
    animation: scale-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.dark .modal-card {
    background: #0d1526;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.06);
}

/* Subtle glow pulse for hero elements */
@keyframes glow-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 0.7; transform: scale(1.05); }
}
.glow-pulse { animation: glow-pulse 3s ease-in-out infinite; }

/* Shimmer for loading states */
@keyframes shimmer {
    from { background-position: -200% 0; }
    to   { background-position: 200% 0; }
}
.shimmer {
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.08) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

/* Nav icon bounce on tap */
@keyframes nav-bounce {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.85); }
    70%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}
.nav-tap { animation: nav-bounce 0.35s cubic-bezier(0.22, 1, 0.36, 1); }

/* Nav indicator pill */
@keyframes pill-expand {
    from { transform: translateX(-50%) scaleX(0); opacity: 0; }
    to   { transform: translateX(-50%) scaleX(1); opacity: 1; }
}

/* Floating entrance for hero/logo */
@keyframes float-in {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.float-in { animation: float-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Subtle continuous float */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
.float { animation: float 4s ease-in-out infinite; }

/* Button press feedback */
.press-effect {
    transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.15s ease;
}
.press-effect:active {
    transform: scale(0.96);
}

/* Card hover lift */
.card-hover {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -6px rgba(0, 0, 0, 0.1);
}

/* Success checkmark */
@keyframes check-pop {
    0%   { transform: scale(0); opacity: 0; }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.check-pop { animation: check-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ===== Thin Scrollbar ===== */
.thin-scrollbar::-webkit-scrollbar {
    width: 3px;
    height: 3px;
}
.thin-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.thin-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}
.thin-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}
.dark .thin-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.3);
}
/* Firefox */
.thin-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

/* ===== Hide nav when modal is open ===== */
body:has(.modal-overlay) nav {
    visibility: hidden;
    pointer-events: none;
}

/* ===== Skeleton loading ===== */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg,
        rgba(148,163,184,0.1) 25%,
        rgba(148,163,184,0.2) 50%,
        rgba(148,163,184,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}
.dark .skeleton {
    background: linear-gradient(90deg,
        rgba(100,116,139,0.15) 25%,
        rgba(100,116,139,0.25) 50%,
        rgba(100,116,139,0.15) 75%);
    background-size: 200% 100%;
}

/* ===== Success animation ===== */
@keyframes check-pop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.check-pop { animation: check-pop 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.fade-in { animation: fade-in 0.3s ease both; }

/* ===== Shake animation (PIN error) ===== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.animate-shake { animation: shake 0.5s ease-in-out; }

/* ===== QR Scanner ===== */
@keyframes scan {
    0%, 100% { top: 2rem; }
    50% { top: calc(100% - 2rem); }
}
.animate-scan { animation: scan 2s ease-in-out infinite; }

/* ===== Error UI ===== */
#blazor-error-ui {
    background: #ef4444;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
.blazor-error-boundary {
    background: #ef4444;
    padding: 1rem;
    color: white;
    border-radius: 12px;
}
.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===== 3D Spinning Coin ===== */
.coin-scene {
    perspective: 600px;
    display: inline-block;
}
.coin {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}
.coin-spin {
    animation: coin-rotate 4s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}
.coin-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    backface-visibility: hidden;
    overflow: hidden;
    /* Metallic edge effect */
    box-shadow:
        inset 0 0 8px rgba(255,255,255,0.15),
        0 2px 12px rgba(0,35,82,0.3);
}
.coin-front {
    transform: rotateY(0deg);
}
.coin-back {
    transform: rotateY(180deg);
}
@keyframes coin-rotate {
    0%   { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}
/* Coin settling from spin to front-face */
@keyframes coin-settle {
    0%   { transform: rotateY(0deg) scale(0.5); opacity: 0; }
    60%  { transform: rotateY(540deg) scale(1.1); opacity: 1; }
    80%  { transform: rotateY(700deg) scale(0.95); }
    100% { transform: rotateY(720deg) scale(1); opacity: 1; }
}
/* Coin shine sweep */
.coin-face::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255,255,255,0.25) 45%,
        rgba(255,255,255,0.05) 50%,
        transparent 55%
    );
    pointer-events: none;
}

/* ===== Tx Success Celebration ===== */
@keyframes success-ring {
    0%   { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}
@keyframes confetti-fall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(120px) rotate(720deg); opacity: 0; }
}
@keyframes confetti-pop {
    0%   { transform: scale(0) translateY(0); opacity: 0; }
    15%  { opacity: 1; }
    100% { opacity: 0; }
}
.success-ring {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid rgba(74, 222, 128, 0.6);
    border-radius: 50%;
    animation: success-ring 1s ease-out forwards;
}
.success-ring-2 {
    animation-delay: 0.15s;
    border-color: rgba(74, 222, 128, 0.3);
}
.confetti-container {
    position: absolute;
    width: 200px;
    height: 200px;
    pointer-events: none;
}
/* Individual confetti particles — positioned via inline styles */
.confetti-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 1px;
    animation: confetti-pop 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
/* Sparkle burst for success */
@keyframes sparkle {
    0%   { transform: scale(0) rotate(0deg); opacity: 1; }
    50%  { opacity: 1; }
    100% { transform: scale(1) rotate(180deg); opacity: 0; }
}
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fbbf24;
    border-radius: 50%;
    animation: sparkle 0.8s ease-out forwards;
}
