/* ============================================
   LIVE TRANSACTION POPUP OVERLAY
   Chat Stream Style - Multiple Transactions
   ============================================ */

:root {
    /* Theme Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    /* Card Styles */
    --card-bg: rgba(18, 18, 26, 0.95);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --card-blur: 12px;
    --card-radius: 12px;

    /* Animation */
    --anim-duration: 0.35s;
    --anim-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Fonts */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Demo Background */
.demo-background {
    min-height: 100vh;
    padding: 30px;
    background:
        radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

.demo-header {
    text-align: center;
    margin-bottom: 30px;
}

.demo-header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.demo-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: flex-end;
    padding: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    margin-bottom: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.control-group select,
.control-group input {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-family);
    min-width: 120px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.control-group select:hover,
.control-group input:hover {
    border-color: var(--accent-primary);
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.btn-toggle {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 212, 255, 0.3);
}

.btn-toggle.paused {
    background: linear-gradient(135deg, var(--accent-success), #059669);
}

/* OBS URL Display */
.obs-url {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 10px;
    max-width: 900px;
    margin: 0 auto;
}

.obs-url strong {
    color: var(--accent-primary);
    font-size: 0.85rem;
}

.obs-url code {
    flex: 1;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
}

.btn-copy {
    padding: 6px 14px;
    background: var(--accent-primary);
    border: none;
    border-radius: 5px;
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: #00b8e0;
}

/* ============================================
   POPUP CONTAINER - CHAT STREAM STYLE
   New cards appear from BOTTOM and push older ones UP
   ============================================ */

.popup-container {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    /* NEW items at bottom, OLD items pushed up */
    gap: 8px;
    max-height: 85vh;
    overflow: hidden;
    pointer-events: none;
}

/* Bottom positions - new cards slide in from bottom */
.popup-container.bottom-right {
    bottom: 20px;
    right: 20px;
    align-items: flex-end;
}

.popup-container.bottom-left {
    bottom: 20px;
    left: 20px;
    align-items: flex-start;
}

/* Top positions - new cards slide in from top */
.popup-container.top-right {
    top: 20px;
    right: 20px;
    bottom: auto;
    align-items: flex-end;
    flex-direction: column;
    /* For top, normal order */
}

.popup-container.top-left {
    top: 20px;
    left: 20px;
    bottom: auto;
    align-items: flex-start;
    flex-direction: column;
    /* For top, normal order */
}

.popup-container.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    align-items: center;
    flex-direction: column-reverse;
}

/* ============================================
   COMPACT TRANSACTION CARD
   ============================================ */

.trx-card {
    width: 320px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    /* IMPORTANT: Fixed height to prevent jumping */
    opacity: 0;
    transform-origin: center center;
    will-change: transform, opacity;
}

/* Compact Header */
.trx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(0, 212, 255, 0.15));
    border-bottom: 1px solid var(--card-border);
}

.trx-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trx-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    font-size: 1rem;
}

.trx-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.trx-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.trx-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.trx-status.success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.trx-status.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.trx-status.process {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 212, 255, 0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Compact Body */
.trx-body {
    padding: 12px 14px;
}

.trx-product {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.trx-product-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 1.1rem;
}

.trx-product-info {
    flex: 1;
    min-width: 0;
}

.trx-product-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trx-product-provider {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Inline Details */
.trx-details {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--card-border);
}

.trx-detail-item {
    flex: 1;
}

.trx-detail-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.trx-detail-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trx-detail-value.price {
    color: var(--accent-success);
}

/* ============================================
   SMOOTH ANIMATIONS - NO JUMPING
   ============================================ */

/* Fade Animation */
.anim-fade-enter {
    animation: fadeInSmooth var(--anim-duration) var(--anim-ease) forwards;
}

.anim-fade-exit {
    animation: fadeOutSmooth var(--anim-duration) var(--anim-ease) forwards;
}

@keyframes fadeInSmooth {
    from {
        opacity: 0;
        transform: scale(0.97);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOutSmooth {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.97);
    }
}

/* Slide Left Animation */
.anim-slideLeft-enter {
    animation: slideLeftInSmooth var(--anim-duration) var(--anim-ease) forwards;
}

.anim-slideLeft-exit {
    animation: slideLeftOutSmooth var(--anim-duration) var(--anim-ease) forwards;
}

@keyframes slideLeftInSmooth {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideLeftOutSmooth {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

/* Slide Right Animation */
.anim-slideRight-enter {
    animation: slideRightInSmooth var(--anim-duration) var(--anim-ease) forwards;
}

.anim-slideRight-exit {
    animation: slideRightOutSmooth var(--anim-duration) var(--anim-ease) forwards;
}

@keyframes slideRightInSmooth {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideRightOutSmooth {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* Slide Up Animation - Card appears from BELOW and slides up into view */
.anim-slideUp-enter {
    animation: slideUpInSmooth var(--anim-duration) var(--anim-ease) forwards;
}

.anim-slideUp-exit {
    animation: slideUpOutSmooth var(--anim-duration) var(--anim-ease) forwards;
}

@keyframes slideUpInSmooth {
    from {
        opacity: 0;
        transform: translateY(40px);
        /* Start below */
    }

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

@keyframes slideUpOutSmooth {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
        /* Exit upward */
    }
}

/* Bounce Animation - Smoother */
.anim-bounce-enter {
    animation: bounceInSmooth var(--anim-duration) var(--anim-ease) forwards;
}

.anim-bounce-exit {
    animation: bounceOutSmooth 0.25s var(--anim-ease) forwards;
}

@keyframes bounceInSmooth {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    60% {
        transform: scale(1.02);
    }

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

@keyframes bounceOutSmooth {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Scale Animation */
.anim-scale-enter {
    animation: scaleInSmooth var(--anim-duration) var(--anim-ease) forwards;
}

.anim-scale-exit {
    animation: scaleOutSmooth 0.25s var(--anim-ease) forwards;
}

@keyframes scaleInSmooth {
    from {
        opacity: 0;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOutSmooth {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.85);
    }
}

/* ============================================
   THEME VARIATIONS
   ============================================ */

/* Light Glass Theme */
.theme-light .trx-card {
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(0, 0, 0, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
}

.theme-light .trx-header {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(0, 212, 255, 0.08));
}

/* Neon Glow Theme */
.theme-neon .trx-card {
    border: 1px solid var(--accent-primary);
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.25),
        0 0 30px rgba(124, 58, 237, 0.15);
}

.theme-neon .trx-header {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(124, 58, 237, 0.25));
}

.theme-neon .trx-icon {
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}

/* Minimal Theme */
.theme-minimal .trx-card {
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.9);
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.theme-minimal .trx-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-minimal .trx-icon {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .demo-background {
        padding: 15px;
    }

    .controls {
        padding: 14px;
        gap: 12px;
    }

    .trx-card {
        width: 280px;
    }
}