/* ==================== Market Showcase Styles ==================== */
/* A gallery-inspired, editorial aesthetic for showcasing TTS works */

/* Container */
.market-container {
    display: none;
    padding: 40px 48px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100%;
    background: linear-gradient(180deg, var(--bg-color) 0%, var(--panel-bg) 100%);
}

.market-container.active {
    display: block;
}

/* Header Section - Editorial Style */
.market-header {
    text-align: center;
    margin-bottom: 56px;
    position: relative;
}

.market-header::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #f59e0b, #ef4444, #ec4899);
    border-radius: 2px;
}

.market-header h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -1.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, #6366f1 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.market-header p {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
    font-weight: 400;
}

/* Category Pills */
.market-categories {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.market-category-pill {
    padding: 10px 24px;
    border-radius: 100px;
    border: 1.5px solid var(--border-color);
    background: var(--card-bg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.market-category-pill::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    opacity: 0;
    transition: opacity 0.3s;
}

.market-category-pill:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.market-category-pill.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.market-category-pill span {
    position: relative;
    z-index: 1;
}

/* Showcase Grid - Masonry-inspired */
.market-showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 32px;
    margin-bottom: 64px;
}

/* Showcase Card - Editorial Card Design */
.market-showcase-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.market-showcase-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 1.5px;
    background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0.3) 50%, rgba(236, 72, 153, 0.3) 100%);
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.market-showcase-card:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.08),
        0 8px 16px rgba(99, 102, 241, 0.06);
}

.market-showcase-card:hover::before {
    opacity: 1;
}

/* Card Visual Section - Waveform & Play */
.card-visual {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.card-waveform-bg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* Dynamic gradient backgrounds for each card */
.card-visual.gradient-sunset {
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #ff9ff3 100%);
}

.card-visual.gradient-ocean {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.card-visual.gradient-forest {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.card-visual.gradient-aurora {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 50%, #00d9ff 100%);
}

.card-visual.gradient-ember {
    background: linear-gradient(135deg, #f12711 0%, #f5af19 100%);
}

.card-visual.gradient-twilight {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* Waveform Visualization */
.waveform-display {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 80px;
    width: 100%;
}

.waveform-bar {
    width: 4px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 2px;
    transition: height 0.2s ease;
}

/* Animate waveform on hover */
.market-showcase-card:hover .waveform-bar {
    animation: waveform-pulse 0.6s ease-in-out infinite;
}

.waveform-bar:nth-child(1) { height: 30%; animation-delay: 0s; }
.waveform-bar:nth-child(2) { height: 50%; animation-delay: 0.05s; }
.waveform-bar:nth-child(3) { height: 70%; animation-delay: 0.1s; }
.waveform-bar:nth-child(4) { height: 45%; animation-delay: 0.15s; }
.waveform-bar:nth-child(5) { height: 80%; animation-delay: 0.2s; }
.waveform-bar:nth-child(6) { height: 60%; animation-delay: 0.25s; }
.waveform-bar:nth-child(7) { height: 90%; animation-delay: 0.3s; }
.waveform-bar:nth-child(8) { height: 55%; animation-delay: 0.35s; }
.waveform-bar:nth-child(9) { height: 75%; animation-delay: 0.4s; }
.waveform-bar:nth-child(10) { height: 40%; animation-delay: 0.45s; }
.waveform-bar:nth-child(11) { height: 65%; animation-delay: 0.5s; }
.waveform-bar:nth-child(12) { height: 50%; animation-delay: 0.55s; }
.waveform-bar:nth-child(13) { height: 85%; animation-delay: 0.6s; }
.waveform-bar:nth-child(14) { height: 45%; animation-delay: 0.65s; }
.waveform-bar:nth-child(15) { height: 70%; animation-delay: 0.7s; }
.waveform-bar:nth-child(16) { height: 35%; animation-delay: 0.75s; }

@keyframes waveform-pulse {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.3); }
}

/* Play Button Overlay */
.card-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s;
}

.market-showcase-card:hover .card-play-overlay {
    opacity: 1;
}

.play-btn-large {
    width: 72px;
    height: 72px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: none;
}

.play-btn-large:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.play-btn-large svg {
    width: 28px;
    height: 28px;
    margin-left: 4px;
    color: var(--text-primary);
}

.play-btn-large.playing svg {
    margin-left: 0;
}

/* Duration Badge */
.duration-badge {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Card Content Section */
.card-content {
    padding: 24px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-voice-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.voice-avatar-mini {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    background-size: cover;
    background-position: center;
}

.voice-name-tag {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Prompt Section - The Key Feature */
.card-prompt-section {
    background: var(--panel-bg);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    position: relative;
}

.prompt-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.prompt-label svg {
    width: 14px;
    height: 14px;
}

.prompt-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
    position: relative;
    padding-left: 16px;
}

.prompt-text::before {
    content: '"';
    position: absolute;
    left: 0;
    top: -4px;
    font-size: 28px;
    color: #6366f1;
    font-family: Georgia, serif;
    opacity: 0.5;
}

/* Copy Prompt Button */
.copy-prompt-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--card-bg);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.copy-prompt-btn:hover {
    background: #6366f1;
    color: white;
    transform: scale(1.05);
}

.copy-prompt-btn.copied {
    background: #10b981;
    color: white;
}

/* Card Footer - Stats & Actions */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--panel-bg);
}

.card-stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-item svg {
    width: 16px;
    height: 16px;
}

.stat-item.likes svg {
    color: #ef4444;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn.secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.action-btn.secondary:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.action-btn.primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.action-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

/* Featured Banner */
.market-featured-banner {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4c1d95 100%);
    border-radius: 24px;
    padding: 48px;
    margin-bottom: 48px;
    position: relative;
    overflow: hidden;
    color: white;
}

.market-featured-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.market-featured-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    pointer-events: none;
}

.featured-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 48px;
}

.featured-text {
    flex: 1;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 8px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.featured-badge svg {
    width: 14px;
    height: 14px;
    color: #fbbf24;
}

.featured-text h2 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
}

.featured-text p {
    font-size: 16px;
    opacity: 0.85;
    line-height: 1.7;
    max-width: 500px;
}

.featured-play-btn {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.featured-play-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.featured-play-btn svg {
    width: 48px;
    height: 48px;
    margin-left: 6px;
    transition: margin-left 0.3s ease; /* Smooth icon transition */
}

/* Featured play button - playing state */
.featured-play-btn.playing svg {
    margin-left: 0; /* Remove play icon offset when showing pause */
}

/* Empty State */
.market-empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-secondary);
}

.market-empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    opacity: 0.4;
}

.market-empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.market-empty-state p {
    font-size: 15px;
    line-height: 1.6;
}

/* Dark Mode Adjustments */
.dark .market-container {
    background: linear-gradient(180deg, var(--bg-color) 0%, #0f0f23 100%);
}

.dark .market-showcase-card {
    background: #1a1a2e;
    border-color: #2d2d44;
}

.dark .card-prompt-section {
    background: #0f0f1a;
}

.dark .card-footer {
    background: #0f0f1a;
    border-color: #2d2d44;
}

.dark .play-btn-large {
    background: rgba(30, 30, 50, 0.95);
}

.dark .play-btn-large svg {
    color: white;
}

.dark .copy-prompt-btn {
    background: #1a1a2e;
}

/* Responsive */
@media (max-width: 900px) {
    .market-showcase-grid {
        grid-template-columns: 1fr;
    }
    
    .market-header h1 {
        font-size: 36px;
    }
    
    .featured-content {
        flex-direction: column;
        text-align: center;
    }
    
    .featured-text p {
        max-width: 100%;
    }
}

/* Loading State Animation */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.market-showcase-card.loading {
    background: linear-gradient(90deg, var(--panel-bg) 25%, var(--border-color) 50%, var(--panel-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
