.marketplace-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.marketplace-sidebar {
    width: 300px;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-right: 1px solid var(--border-primary);
    overflow-y: auto;
    padding: 24px;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.marketplace-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: var(--bg-primary);
}

.content-header {
    margin-bottom: 40px;
    padding: 32px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 16px;
    border: 1px solid var(--border-primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.content-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.content-header h1 {
    font-size: 36px;
    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: 8px;
}

.content-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

.nav-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.sidebar-section {
    margin-bottom: 32px;
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-section h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section h2::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.filter-group {
    margin-bottom: 24px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label::before {
    content: '';
    width: 3px;
    height: 12px;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
}

.search-input,
.filter-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 4px rgba(192, 192, 192, 0.15), 0 4px 12px rgba(192, 192, 192, 0.1);
    transform: translateY(-1px);
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-tertiary));
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(192, 192, 192, 0.15);
}

.stat-value {
    font-size: 32px;
    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: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Leaderboard */
.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.leaderboard-tab {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-tab:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-secondary);
}

.leaderboard-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-color: transparent;
    color: var(--bg-primary);
}

.leaderboard-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-secondary);
    transform: translateX(4px);
}

.leaderboard-rank {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--bg-primary);
    flex-shrink: 0;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #d97706, #b45309);
}

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

.leaderboard-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.leaderboard-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.leaderboard-meta i {
    font-size: 10px;
}

.scripts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.script-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.script-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-secondary), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.script-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--accent-secondary);
    box-shadow: 0 12px 40px rgba(192, 192, 192, 0.2), 0 0 0 1px rgba(192, 192, 192, 0.1);
}

.script-card:hover::before {
    opacity: 1;
}

.script-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
}

.script-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.category-badge {
    padding: 6px 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.3);
    transition: all 0.3s ease;
}

.category-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(192, 192, 192, 0.4);
}

.script-card-body {
    flex: 1;
    margin-bottom: 16px;
}

.script-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.script-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.script-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.script-meta .meta-item i {
    color: var(--accent-secondary);
}

.script-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-primary);
    margin-top: auto;
}

.script-date {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(192, 192, 192, 0.2);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border: 1px solid var(--border-primary);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(192, 192, 192, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px;
    border-bottom: 1px solid var(--border-primary);
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.05), transparent);
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-secondary), transparent);
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.form-group textarea {
    resize: vertical;
}

.code-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 4px rgba(192, 192, 192, 0.15), 0 4px 12px rgba(192, 192, 192, 0.1);
    transform: translateY(-2px);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.script-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: var(--bg-elevated);
    border-radius: 12px;
    margin-bottom: 24px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.meta-item i {
    color: var(--accent-secondary);
}

.script-description {
    margin-bottom: 24px;
}

.script-description h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.script-description p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.script-rating-section {
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-elevated);
    border-radius: 12px;
    border: 1px solid var(--border-primary);
}

.script-rating-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-primary);
}

.rating-stars {
    display: flex;
    gap: 4px;
    font-size: 20px;
}

.rating-stars i {
    color: #fbbf24;
}

.rating-stars i.far {
    color: var(--text-muted);
}

.rating-info {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

#viewRatingAverage {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.rating-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.rating-input {
    margin-top: 20px;
}

.rating-input p {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.rating-stars-input {
    display: flex;
    gap: 8px;
    font-size: 28px;
}

.rating-stars-input i {
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.rating-stars-input i:hover {
    transform: scale(1.15);
}

.rating-stars-input i.fas {
    color: #fbbf24;
}

.rating-stars-input i.far {
    color: var(--text-muted);
}

.script-code-container {
    margin-bottom: 24px;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.code-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.code-display {
    display: block;
    padding: 24px;
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
    overflow-x: auto;
    white-space: pre;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 16px;
    border: 1px solid var(--border-primary);
}

.loading-state p,
.empty-state p {
    color: var(--text-secondary);
    margin-top: 16px;
}

.empty-state i {
    font-size: 72px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

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

.notification {
    position: fixed;
    bottom: 32px;
    right: 32px;
    min-width: 320px;
    max-width: 420px;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transform: translateX(500px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(10px);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification i {
    font-size: 18px;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.notification-success {
    border-left: 3px solid var(--success);
}

.notification-success i {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.notification-error {
    border-left: 3px solid var(--error);
}

.notification-error i {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.notification-info {
    border-left: 3px solid var(--info);
}

.notification-info i {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.notification span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    flex: 1;
}

@media (max-width: 1024px) {
    .marketplace-sidebar {
        width: 250px;
    }
    
    .scripts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .marketplace-container {
        flex-direction: column;
    }
    
    .marketplace-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
    }
    
    .marketplace-content {
        padding: 20px;
    }
    
    .scripts-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-actions .btn {
        width: 100%;
    }
}
