/* Market Feed Panel Styles - Matching Twitter Feed */

#market-panel {
    position: fixed;
    left: 0;
    top: 80px;
    width: 400px;
    height: calc(100vh - 80px);
    background: #0d0d12 !important;
    border-right: 1px solid rgba(139, 92, 246, 0.2);
    overflow-y: auto;
    z-index: 0;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.5) transparent;
    transition: filter 0.3s ease;
}

/* Blur market panel when ANY modal is open (modular) */
body:has(#settings-modal:not(.hidden)) #market-panel,
body:has(#statistics-modal:not(.hidden)) #market-panel,
body:has(#deploy-modal:not(.hidden)) #market-panel,
body:has(#launch-modal:not(.hidden)) #market-panel,
body:has(#token-details-modal:not(.hidden)) #market-panel,
body:has(#confirm-modal:not(.hidden)) #market-panel,
body:has(#milestone-overlay:not(.hidden)) #market-panel {
    filter: blur(8px);
}

#market-panel::-webkit-scrollbar {
    width: 6px;
}

#market-panel::-webkit-scrollbar-track {
    background: transparent;
}

#market-panel::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.5);
    border-radius: 3px;
}

#market-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.7);
}

.market-header {
    position: sticky;
    top: 0;
    background: #0d0d12;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    z-index: 1;
}

.market-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, #9333ea, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.625rem 0;
}

.market-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.813rem;
    color: rgba(255, 255, 255, 0.6);
}

.market-container {
    padding: 0.625rem;
}

/* Token Cards - Matching Tweet Card Style */
.market-token-card {
    background: #15151c !important;
    border: 1px solid rgba(139, 92, 246, 0.15) !important;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.625rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.market-token-card:hover {
    background: #1a1a24 !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
    transform: translateY(-2px);
}

/* Owned Token Styling */
.market-token-card.owned-token {
    border: 2px solid rgba(255, 255, 255, 0.4) !important;
    background: rgba(30, 30, 40, 0.98) !important;
    box-shadow: 0 2px 12px rgba(255, 255, 255, 0.1);
}

.market-token-card.owned-token:hover {
    border-color: rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
    background: rgba(35, 35, 45, 0.98) !important;
}

.owned-token-badge {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.owned-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: rgba(16, 185, 129, 0.3);
    border-radius: 50%;
    color: #10b981;
    font-weight: 700;
    font-size: 0.875rem;
}

.owned-badge-text {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
}

.market-token-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.market-token-image-wrapper {
    width: 3rem;
    height: 3rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.market-token-image {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139, 92, 246, 0.3);
}

.market-token-fallback {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(139, 92, 246, 0.3);
}

.market-token-loading {
    background: rgba(139, 92, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-top-color: rgba(139, 92, 246, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-small {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-top-color: rgba(139, 92, 246, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.market-token-info {
    flex: 1;
    min-width: 0;
}

.market-token-name {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.market-token-symbol {
    color: white;
}

.market-token-platform {
    font-size: 0.688rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

.platform-pumpfun {
    background: linear-gradient(to right, #9333ea, #7e22ce);
    color: white;
}

.platform-raydium {
    background: linear-gradient(to right, #3b82f6, #2563eb);
    color: white;
}

.platform-mayhem {
    background: linear-gradient(to right, #dc2626, #991b1b);
    color: white;
    animation: mayhemPulse 2s ease-in-out infinite;
}

@keyframes mayhemPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.5);
    }
    50% {
        box-shadow: 0 0 15px rgba(220, 38, 38, 0.8);
    }
}

/* ATH Badge - Matching Tweet Indicator Style */
.market-ath-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    display: inline-block;
}

.ath-perfect {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ath-great {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.ath-poor {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Price Section */
.market-price-section {
    display: flex;
    justify-content: space-around;
    margin: 0.75rem 0;
    padding: 0.625rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.5rem;
}

.price-item {
    text-align: center;
    flex: 1;
}

.price-label {
    font-size: 0.688rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.price-value {
    font-size: 0.813rem;
    font-weight: 600;
    color: white;
    font-family: 'Courier New', monospace;
}

/* Stats Row */
.market-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.625rem;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 0.375rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-label {
    font-size: 0.688rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    position: relative;
    z-index: 1;
}

/* Volume Momentum Highlighting */
.stat-box {
    transition: all 0.5s ease-in-out;
}

.stat-box.volume-hot {
    background: rgba(236, 72, 153, 0.2) !important;
    border: 1px solid rgba(236, 72, 153, 0.4);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.3);
    animation: volumePulse 1.5s ease-in-out infinite;
    transition: all 0.5s ease-in-out;
}

.stat-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, 
        rgba(236, 72, 153, 0.1),
        rgba(147, 51, 234, 0.1));
    opacity: 0;
    z-index: 0;
    transition: opacity 0.5s ease-in-out;
}

.stat-box.volume-hot::before {
    opacity: 1;
    animation: volumeShimmer 2s linear infinite;
}

.stat-box .stat-value {
    transition: all 0.5s ease-in-out;
}

.stat-box.volume-hot .stat-value {
    color: #ec4899;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

.stat-box .stat-label {
    transition: all 0.5s ease-in-out;
}

.stat-box.volume-hot .stat-label {
    color: rgba(236, 72, 153, 0.8);
}

@keyframes volumePulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(236, 72, 153, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(236, 72, 153, 0.6),
                    0 0 15px rgba(236, 72, 153, 0.4);
    }
}

@keyframes volumeShimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Quick Deploy Section */
.market-quick-deploy {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-deploy-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-deploy-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    min-width: 2rem;
    text-align: center;
}

.quick-deploy-presets {
    display: flex;
    gap: 0.375rem;
    flex: 1;
}

.preset-btn {
    flex: 1;
    padding: 0.375rem;
    background: rgba(147, 51, 234, 0.15);
    border: 1px solid rgba(147, 51, 234, 0.3);
    border-radius: 0.375rem;
    color: #a78bfa;
    font-size: 0.813rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

.preset-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(147, 51, 234, 0.2), rgba(236, 72, 153, 0.2));
    opacity: 0;
    transition: opacity 0.15s ease;
}

.preset-btn:hover {
    background: rgba(147, 51, 234, 0.25);
    border-color: rgba(147, 51, 234, 0.5);
    color: #c4b5fd;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

.preset-btn:hover::before {
    opacity: 1;
}

.preset-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(147, 51, 234, 0.4);
}

.preset-btn.deploying {
    background: linear-gradient(to right, #9333ea, #ec4899);
    border-color: #9333ea;
    color: white;
    animation: deployPulse 0.6s ease;
    pointer-events: none;
}

@keyframes deployPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Social Links */
.market-socials {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.625rem;
    flex-wrap: wrap;
}

.social-link {
    padding: 0.25rem 0.625rem;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.375rem;
    font-size: 0.688rem;
    color: #a78bfa;
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-link:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: #c4b5fd;
    transform: translateY(-1px);
}

/* Loading State */
.market-loading {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: rgba(255, 255, 255, 0.6);
}

.market-loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(139, 92, 246, 0.2);
    border-top-color: #9333ea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.market-error {
    text-align: center;
    padding: 1.25rem;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 0.5rem;
    margin: 0.625rem;
}

/* Adjust main content to make room for market panel */
body.market-active main {
    margin-left: 400px !important;
}

body.market-active #live-feed-panel {
    right: 0 !important;
}

/* Bonding Curve Progress Bar */
.market-bonding-curve {
    margin: 0.75rem 0;
}

.bc-progress-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* ATH Marker - Enhanced visibility */
.bc-ath-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    pointer-events: none;
    z-index: 10;
    transform: translateX(-1.5px);
}

.bc-ath-line {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #fbbf24, #f59e0b);
    box-shadow: 0 0 15px rgba(251, 191, 36, 1),
                0 0 8px rgba(251, 191, 36, 0.6);
    position: relative;
    animation: athPulse 2s ease-in-out infinite;
}

@keyframes athPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(251, 191, 36, 1),
                    0 0 8px rgba(251, 191, 36, 0.6);
    }
    50% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 1),
                    0 0 12px rgba(251, 191, 36, 0.8),
                    0 0 6px rgba(251, 191, 36, 0.4);
    }
}

.bc-ath-line::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #fbbf24;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.8));
}

.bc-ath-line::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 6px solid #fbbf24;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.8));
}

/* ATH Region Highlight (area between current and ATH) */
.bc-ath-region {
    position: absolute;
    top: 0;
    bottom: 0;
    background: linear-gradient(to right, 
        rgba(251, 191, 36, 0.15),
        rgba(251, 191, 36, 0.05));
    pointer-events: none;
    z-index: 5;
    border-right: 1px dashed rgba(251, 191, 36, 0.4);
}

/* Animations */
.market-token-card.animating {
    pointer-events: none;
}

@keyframes bcPulse {
    0%, 100% {
        opacity: 0.1;
    }
    50% {
        opacity: 0.2;
    }
}

.bc-progress-fill .animate-pulse {
    animation: bcPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Border glow animation for card updates (replaces scale animation) */
@keyframes borderGlow {
    0% {
        border-color: rgba(139, 92, 246, 0.2);
        box-shadow: 0 0 0 rgba(139, 92, 246, 0);
    }
    50% {
        border-color: rgba(139, 92, 246, 1);
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.6), inset 0 0 10px rgba(139, 92, 246, 0.3);
    }
    100% {
        border-color: rgba(139, 92, 246, 0.2);
        box-shadow: 0 0 0 rgba(139, 92, 246, 0);
    }
}

.market-token-card.updating {
    animation: borderGlow 0.6s ease-in-out;
}
