/* ================================
   NFT MARKETPLACE STYLES
   ================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0D0E12;
    --bg-secondary: #1A1C24;
    --bg-tertiary: #2A2D3A;
    --accent-primary: #00D9FF;
    --accent-secondary: #00FFD1;
    --text-primary: #FFFFFF;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: #2A2D3A;
    --error-color: #FF006E;
    --success-color: #00FF9C;
    --gradient-1: linear-gradient(135deg, #00D9FF 0%, #00FFD1 100%);
    --gradient-2: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 4px 24px rgba(0, 217, 255, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    padding-top: 80px;
}

body.alert-visible {
    padding-top: 220px;
}

.hidden {
    display: none !important;
}

/* Network Alert Banner */
.network-alert-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border-bottom: 3px solid #ff4757;
    box-shadow: 0 4px 20px rgba(255, 75, 87, 0.4);
    animation: slideDown 0.5s ease-out;
    padding: 20px 0;
}

.alert-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.alert-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.alert-content {
    flex: 1;
    max-width: 800px;
}

.alert-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #ffffff;
}

.alert-message {
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
}

.loss-warning {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.alert-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1) rotate(90deg);
}

/* Marketplace Main */
.marketplace-main {
    min-height: calc(100vh - 160px);
    padding: 40px 0 80px 0;
}

.marketplace-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Page Header */
.page-header {
    margin-bottom: 48px;
}

.page-title {
    font-size: 48px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
}

.gradient-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Content Layout */
.content-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 48px;
    align-items: start;
}

/* Filters Sidebar */
.filters-sidebar {
    position: sticky;
    top: 120px;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.filters-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--accent-primary);
}

.filters-header svg {
    color: var(--accent-primary);
}

.filters-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.filter-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.filter-select {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* Price Range Slider */
.price-range-slider {
    position: relative;
    height: 40px;
    margin-bottom: 12px;
}

.range-input {
    position: absolute;
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.4);
}

.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    pointer-events: all;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.4);
}

.price-values {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Category Chips */
.category-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-chip {
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.category-chip:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.category-chip.active {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    font-weight: 600;
}

.apply-filters-btn {
    width: 100%;
    padding: 14px;
    background: var(--gradient-1);
    border: none;
    border-radius: 10px;
    color: var(--bg-primary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: var(--shadow-glow);
    margin-top: 24px;
}

.apply-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 32px rgba(0, 217, 255, 0.5);
}

/* Main Content */
.main-content {
    flex: 1;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 20px 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.results-count {
    font-size: 15px;
    color: var(--text-secondary);
}

.results-count span {
    font-weight: 700;
    color: var(--text-primary);
}

.sort-select {
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Error State */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
    text-align: center;
}

.error-state svg {
    color: var(--error-color);
}

.error-state h3 {
    font-size: 24px;
    color: var(--text-primary);
}

.error-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

.retry-btn {
    padding: 12px 32px;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: var(--bg-primary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 12px;
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 20px;
    text-align: center;
}

.empty-state svg {
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 24px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 400px;
}

/* NFT Grid */
.nft-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

.nft-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.nft-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.nft-card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.nft-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nft-card-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
}

.nft-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nft-badge svg {
    width: 14px;
    height: 14px;
}

.nft-card-content {
    padding: 20px;
}

.nft-card-header {
    margin-bottom: 12px;
}

.nft-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nft-card-creator {
    font-size: 13px;
    color: var(--text-secondary);
}

.nft-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.nft-card-price-section {
    flex: 1;
}

.nft-price-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.nft-price-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-primary);
}

.nft-category-badge {
    padding: 6px 12px;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Mobile Filter FAB */
.mobile-filter-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    padding: 16px 24px;
    background: var(--gradient-1);
    border: none;
    border-radius: 50px;
    color: var(--bg-primary);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0, 217, 255, 0.5);
    transition: all 0.3s;
}

.mobile-filter-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 217, 255, 0.6);
}

/* Mobile Filter Modal */
.mobile-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: flex-end;
    animation: fadeIn 0.3s ease;
}

.mobile-filter-modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-height: 90vh;
    background: var(--bg-secondary);
    border-radius: 24px 24px 0 0;
    animation: slideUp 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.85; }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar.desktop-only {
        display: none;
    }
    
    .mobile-filter-fab {
        display: flex;
    }
}

@media (max-width: 768px) {
    body.alert-visible {
        padding-top: 200px;
    }
    
    .marketplace-container {
        padding: 0 20px;
    }
    
    .page-title {
        font-size: 36px;
    }
    
    .page-subtitle {
        font-size: 16px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .nft-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    body.alert-visible {
        padding-top: 220px;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .nft-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .mobile-filter-fab {
        bottom: 20px;
        right: 20px;
        padding: 14px 20px;
    }
}