/* 应用广场样式 */

/* 分类筛选按钮 */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.category-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 6px 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.category-btn.active {
    background: var(--primary-color, #007bff);
    border-color: var(--primary-color, #007bff);
    color: white;
}

/* 应用网格 */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
}

/* 应用卡片 */
.app-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.app-item .app-icon {
    text-align: center;
    margin-bottom: 10px;
}

.app-item .app-icon i {
    font-size: 24px;
    color: var(--primary-color, #007bff);
}

.app-info .app-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
    margin-bottom: 5px;
    text-align: center;
}

.app-info .app-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.3;
}

.app-info .app-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
}

.app-category {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 8px;
}

.app-points {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 2px 6px;
    border-radius: 8px;
}

/* 推荐徽章 */
.featured-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(45deg, #ffc107, #ff8c00);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* 加载和错误状态 */
.loading-placeholder,
.error-message,
.no-apps {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.error-message {
    color: #dc3545;
}

/* 应用使用对话框 */
.app-usage-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.dialog-content {
    position: relative;
    background: var(--sidebar-bg, #1e1e1e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.dialog-header .app-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dialog-header .app-info i {
    color: var(--primary-color, #007bff);
}

.dialog-header .app-info h3 {
    margin: 0;
    color: white;
    font-size: 18px;
}

.dialog-header .app-info p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.dialog-body {
    padding: 20px;
}

.input-section {
    margin-bottom: 20px;
}

.input-section label {
    display: block;
    color: white;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-section textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

.input-section textarea:focus {
    outline: none;
    border-color: var(--primary-color, #007bff);
    background: rgba(255, 255, 255, 0.1);
}

.input-section textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.action-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.app-cost {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffc107;
    font-size: 14px;
    font-weight: 500;
}

.use-app-btn {
    background: linear-gradient(45deg, var(--primary-color, #007bff), #0056b3);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.use-app-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

.use-app-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.result-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color, #007bff);
    font-weight: 500;
    margin-bottom: 15px;
}

.result-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
}

.response-text {
    color: white;
    line-height: 1.6;
    margin-bottom: 15px;
}

.response-meta {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.response-meta .text-muted {
    color: rgba(255, 255, 255, 0.6);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .dialog-content {
        width: 95%;
        height: 90vh;
        overflow-y: auto;
    }
    
    .dialog-header {
        padding: 15px;
    }
    
    .dialog-header .app-info {
        gap: 10px;
    }
    
    .dialog-header .app-info h3 {
        font-size: 16px;
    }
    
    .dialog-body {
        padding: 15px;
    }
    
    .action-section {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .use-app-btn {
        width: 100%;
        justify-content: center;
    }
}

/* 暗色模式适配 */
@media (prefers-color-scheme: dark) {
    .app-item {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .app-item:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}